Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp5084111pjb; Mon, 27 Jul 2020 12:31:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQ9M66I1qk7hYWl8DtZossRblIEExxXwBjbMg5e6xvNCoa+yaZ/hQJBuS5HfpIzRiYem79 X-Received: by 2002:a17:906:a242:: with SMTP id bi2mr21816757ejb.243.1595878312388; Mon, 27 Jul 2020 12:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595878312; cv=none; d=google.com; s=arc-20160816; b=etdwXCZe3/691pUu6G8GS+7lWt/O9hIseZniBYsV2euTDfiZvBALTqrpj81G3jI+PI eG868+fzGY2OUJ9MeiN0CLlkehEQ5UGoThBHgEuUH5SWiSK+t+ATBBLbLXVnIpDhdVGT G80RtU+eDvzfCb75GK+Iq576KUwcXNW6BuI7YOWCcNiYIakWuvZ6g39MGvpR1HoY01EY hJartnqvDkOpXTTdZOYtMSWM4B0yqMrY+BOU+InNokqjT90ngMl8z+RP9ZXHdaawXUjL hwhc2TLV71JTlni+FXmzvQS8Lo/GzoKzxPKo1uIn+j7Mteyls2Vgu56ZtBNRHH/CfAh9 0rig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uPEUCGwUhu6gC7effbwPg+v6omwHm9FSYu/MnszzrTw=; b=UgEENAhyB12EXRFqQcx1UciKXTI3i9mTZZdsCgkXAYb//o/gmur/8KKLsaJz8AgWCM 6G6nPdJx70yJPnyvP3ACEWPT3gQhX7eqMCun+eSSCQYoHyi3No/BMPdPA4B2q9HDaxcb sqrUM997wS7CdlhdykPKgWstMighANXC6TR4q7zhCDTGeT4nc/5fi6+95CIr+quEHGfu 5Q0EbQ2Kl2avt9ugPVEFdm2M12HPrALjr+fMpx7CmfDnAqxOuyzjchnS+JN3Ooxozw09 EESDuPnA9RLmhHngRdEz6ahu9D2P9VrZdUXY6wt9u3VtL5cwgICxjdH3DTBuO2jJAgt6 NkxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CIpehUOt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si6694306edq.189.2020.07.27.12.31.29; Mon, 27 Jul 2020 12:31:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CIpehUOt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728142AbgG0TCJ (ORCPT + 99 others); Mon, 27 Jul 2020 15:02:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726897AbgG0TCJ (ORCPT ); Mon, 27 Jul 2020 15:02:09 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 511B8C061794; Mon, 27 Jul 2020 12:02:09 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id a19so1986129qvy.3; Mon, 27 Jul 2020 12:02:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uPEUCGwUhu6gC7effbwPg+v6omwHm9FSYu/MnszzrTw=; b=CIpehUOt0pFLGtZUceSvBaC7bKoxZRO5SIVUlQxu72u1BpL2T7RsEqJZkmlZgbQlNI ytkyQCLn2n1RnVX+H6GtBKDp9qt8SAvZpm+2KnCzJD1HwCKKDqzR1jYaRyopVDaNCv9s wXE2QZvRW2KliOdYmLGCiSjgteZdqeX6yWfWIceG+rdnBhUECimGxWr4I/vf0lIeubN/ 092IvLfWVygDK6Uzi4Fjb4JPPrGBf2Lz5twZNdFtfUgwfT6lg5vUcDV/tD0uGvNIFGg4 QX4TrAF1mhaZZhLCC0oWLJOgeYHHZOlxlDWwZ4ztcNmURs54knHDYuGFLPELdHHT9TCB /K1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uPEUCGwUhu6gC7effbwPg+v6omwHm9FSYu/MnszzrTw=; b=rprPbP/DjpHBlxj0YU7KVKeAx9NjDNFLD0U2GxPA2+C5/VAnbBNtGcU/f1SIcs/mY/ /snB1zAAhaa2i7T4izGz6KXjwVnl934vPN29kJN4CkCaOmBx2f8DZOQckvdNOXKikAgl VmbTBlkLo6b8RDSrnTHlKXboYAmDMIenxHPc2bebwgvW1r1nadNXQuZbUBcTHHTN+qZl on6+5PQhUAmYlzMoik7uf7itj7MYzulEi9laECXRJuPv1dznpmloxTkZYoILzKGtNAtr bfggl0w3SbBEzVbtPtU0qWyIsrs15RL+QuFQGrGFh2mWVZWvqkSaRZOo7220YeRikBfe Bn9Q== X-Gm-Message-State: AOAM531Tb+SgLosve1WIsReDQRi+Lw6JgvVozVp/06I1tFcUAC9xtnhZ 3q77kJWIPuzqJdtu/D9VdH0l4DqoAg== X-Received: by 2002:ad4:4ead:: with SMTP id ed13mr8757280qvb.161.1595876528455; Mon, 27 Jul 2020 12:02:08 -0700 (PDT) Received: from localhost.localdomain ([209.94.141.207]) by smtp.gmail.com with ESMTPSA id 6sm18964139qkj.134.2020.07.27.12.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 12:02:07 -0700 (PDT) From: Peilin Ye To: Jens Axboe Cc: Peilin Ye , Dan Carpenter , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel-mentees@lists.linuxfoundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [Linux-kernel-mentees] [PATCH v2] block/scsi-ioctl: Prevent kernel-infoleak in scsi_put_cdrom_generic_arg() Date: Mon, 27 Jul 2020 15:00:13 -0400 Message-Id: <20200727190013.324812-1-yepeilin.cs@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200727161932.322955-1-yepeilin.cs@gmail.com> References: <20200727161932.322955-1-yepeilin.cs@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org scsi_put_cdrom_generic_arg() is copying uninitialized stack memory to userspace due to the compiler not initializing holes in statically allocated structures. Fix it by adding a padding field to `struct compat_cdrom_generic_command`. Cc: stable@vger.kernel.org Fixes: f3ee6e63a9df ("compat_ioctl: move CDROM_SEND_PACKET handling into scsi") Suggested-by: Dan Carpenter Suggested-by: Arnd Bergmann Signed-off-by: Peilin Ye --- Change in v2: - Add a padding field to `struct compat_cdrom_generic_command`, instead of doing memset() on `cgc32`. (Suggested by Jens Axboe ) block/scsi_ioctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index ef722f04f88a..72108404718f 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -651,6 +651,7 @@ struct compat_cdrom_generic_command { compat_int_t stat; compat_caddr_t sense; unsigned char data_direction; + unsigned char pad[3]; compat_int_t quiet; compat_int_t timeout; compat_caddr_t reserved[1]; -- 2.25.1