Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1673591 > unrolled thread

[PATCH] scsi: aacraid: Don't copy uninitialized stack memory to userspace

Started bySeth Forshee <seth.forshee@canonical.com>
First post2017-06-23 16:10 +0200
Last post2017-06-26 19:40 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] scsi: aacraid: Don't copy uninitialized stack memory to userspace Seth Forshee <seth.forshee@canonical.com> - 2017-06-23 16:10 +0200
    Re: [PATCH] scsi: aacraid: Don't copy uninitialized stack memory to  userspace Johannes Thumshirn <jthumshirn@suse.de> - 2017-06-23 16:20 +0200
    Re: [PATCH] scsi: aacraid: Don't copy uninitialized stack memory to userspace "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-06-26 19:40 +0200

#1673591 — [PATCH] scsi: aacraid: Don't copy uninitialized stack memory to userspace

FromSeth Forshee <seth.forshee@canonical.com>
Date2017-06-23 16:10 +0200
Subject[PATCH] scsi: aacraid: Don't copy uninitialized stack memory to userspace
Message-ID<tVxrA-3cr-41@gated-at.bofh.it>
Both aac_send_raw_srb() and aac_get_hba_info() may copy stack
allocated structs to userspace without initializing all members
of these structs. Clear out this memory to prevent information
leaks.

Fixes: 423400e64d377 ("scsi: aacraid: Include HBA direct interface")
Fixes: c799d519bf088 ("scsi: aacraid: Retrieve HBA host information ioctl")
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 drivers/scsi/aacraid/commctrl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index d2f8d5954840..476ada6e39d0 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -950,6 +950,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
 			&((struct aac_native_hba *)srbfib->hw_fib_va)->resp.err;
 		struct aac_srb_reply reply;
 
+		memset(&reply, 0, sizeof(reply));
 		reply.status = ST_OK;
 		if (srbfib->flags & FIB_CONTEXT_FLAG_FASTRESP) {
 			/* fast response */
@@ -1019,6 +1020,7 @@ static int aac_get_hba_info(struct aac_dev *dev, void __user *arg)
 {
 	struct aac_hba_info hbainfo;
 
+	memset(&hbainfo, 0, sizeof(hbainfo));
 	hbainfo.adapter_number		= (u8) dev->id;
 	hbainfo.system_io_bus_number	= dev->pdev->bus->number;
 	hbainfo.device_number		= (dev->pdev->devfn >> 3);
-- 
2.11.0

[toc] | [next] | [standalone]


#1673598 — Re: [PATCH] scsi: aacraid: Don't copy uninitialized stack memory to userspace

FromJohannes Thumshirn <jthumshirn@suse.de>
Date2017-06-23 16:20 +0200
SubjectRe: [PATCH] scsi: aacraid: Don't copy uninitialized stack memory to userspace
Message-ID<tVxBf-3fw-5@gated-at.bofh.it>
In reply to#1673591
On Fri, Jun 23, 2017 at 09:04:22AM -0500, Seth Forshee wrote:
> Both aac_send_raw_srb() and aac_get_hba_info() may copy stack
> allocated structs to userspace without initializing all members
> of these structs. Clear out this memory to prevent information
> leaks.
> 
> Fixes: 423400e64d377 ("scsi: aacraid: Include HBA direct interface")
> Fixes: c799d519bf088 ("scsi: aacraid: Retrieve HBA host information ioctl")
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> ---

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

[toc] | [prev] | [next] | [standalone]


#1674971

From"Martin K. Petersen" <martin.petersen@oracle.com>
Date2017-06-26 19:40 +0200
Message-ID<tWG9t-5iW-35@gated-at.bofh.it>
In reply to#1673591
Seth,

> Both aac_send_raw_srb() and aac_get_hba_info() may copy stack
> allocated structs to userspace without initializing all members of
> these structs. Clear out this memory to prevent information leaks.

Applied to 4.13/scsi-queue. Thank you!

-- 
Martin K. Petersen	Oracle Linux Engineering

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web