linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: aacraid: fix leak of data from stack back to userspace
@ 2017-05-15 14:56 Colin King
  2017-05-15 15:07 ` walter harms
  2017-06-13 21:06 ` Dave Carroll
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-05-15 14:56 UTC (permalink / raw)
  To: Raghava Aditya Renukunta, Adaptec OEM Raid Solutions,
	James E . J . Bottomley, Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The fields sense_data_size and sense_data are unitialized garbage from
the stack and are being copied back to userspace.  Fix this leak of
stack information by ensuring they are zero'd.

Detected by CoverityScan, CID#1435473 ("Uninitialized scalar variable")

Fixes: 423400e64d377 ("scsi: aacraid: Include HBA direct interface")
Signed-off-by: Colin Ian King <colin.king@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 106b9332f718..6bb6ed48e31d 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -955,6 +955,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
 			reply.srb_status = SRB_STATUS_SUCCESS;
 			reply.scsi_status = 0;
 			reply.data_xfer_length = byte_count;
+			reply.sense_data_size = 0;
+			memset(reply.sense_data, 0, AAC_SENSE_BUFFERSIZE);
 		} else {
 			reply.srb_status = err->service_response;
 			reply.scsi_status = err->status;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: aacraid: fix leak of data from stack back to userspace
  2017-05-15 14:56 [PATCH] scsi: aacraid: fix leak of data from stack back to userspace Colin King
@ 2017-05-15 15:07 ` walter harms
  2017-06-13 21:06 ` Dave Carroll
  1 sibling, 0 replies; 3+ messages in thread
From: walter harms @ 2017-05-15 15:07 UTC (permalink / raw)
  To: Colin King
  Cc: Raghava Aditya Renukunta, Adaptec OEM Raid Solutions,
	James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	kernel-janitors, linux-kernel



Am 15.05.2017 16:56, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The fields sense_data_size and sense_data are unitialized garbage from
> the stack and are being copied back to userspace.  Fix this leak of
> stack information by ensuring they are zero'd.
> 
> Detected by CoverityScan, CID#1435473 ("Uninitialized scalar variable")
> 
> Fixes: 423400e64d377 ("scsi: aacraid: Include HBA direct interface")
> Signed-off-by: Colin Ian King <colin.king@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 106b9332f718..6bb6ed48e31d 100644
> --- a/drivers/scsi/aacraid/commctrl.c
> +++ b/drivers/scsi/aacraid/commctrl.c
> @@ -955,6 +955,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
>  			reply.srb_status = SRB_STATUS_SUCCESS;
>  			reply.scsi_status = 0;
>  			reply.data_xfer_length = byte_count;
> +			reply.sense_data_size = 0;
> +			memset(reply.sense_data, 0, AAC_SENSE_BUFFERSIZE);
>  		} else {
>  			reply.srb_status = err->service_response;
>  			reply.scsi_status = err->status;


an other idea would be initialize the reply with zero:
struct aac_srb_reply reply={0};

maybe that is more future proof but i have no idea about the speed penalty.

just my 2 cents,
 wh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] scsi: aacraid: fix leak of data from stack back to userspace
  2017-05-15 14:56 [PATCH] scsi: aacraid: fix leak of data from stack back to userspace Colin King
  2017-05-15 15:07 ` walter harms
@ 2017-06-13 21:06 ` Dave Carroll
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Carroll @ 2017-06-13 21:06 UTC (permalink / raw)
  To: Colin King, Raghava Aditya Renukunta,
	dl-esc-Aacraid Linux Driver, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

> -----Original Message-----
> From: Colin King [mailto:colin.king@canonical.com]
> Sent: Monday, May 15, 2017 8:56 AM
> To: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>;
> dl-esc-Aacraid Linux Driver <aacraid@microsemi.com>; James E . J . Bottomley
> <jejb@linux.vnet.ibm.com>; Martin K . Petersen
> <martin.petersen@oracle.com>; linux-scsi@vger.kernel.org
> Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] scsi: aacraid: fix leak of data from stack back to userspace
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> The fields sense_data_size and sense_data are unitialized garbage from the
> stack and are being copied back to userspace.  Fix this leak of stack information
> by ensuring they are zero'd.
> 
> Detected by CoverityScan, CID#1435473 ("Uninitialized scalar variable")
> 
> Fixes: 423400e64d377 ("scsi: aacraid: Include HBA direct interface")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/scsi/aacraid/commctrl.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
Acked-by: Dave Carroll <david.carroll@microsemi.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-13 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15 14:56 [PATCH] scsi: aacraid: fix leak of data from stack back to userspace Colin King
2017-05-15 15:07 ` walter harms
2017-06-13 21:06 ` Dave Carroll

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).