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


Groups > linux.kernel > #1641778 > unrolled thread

[PATCH] scsi: aacraid: fix leak of data from stack back to userspace

Started byColin King <colin.king@canonical.com>
First post2017-05-15 17:00 +0200
Last post2017-05-15 17:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] scsi: aacraid: fix leak of data from stack back to userspace Colin King <colin.king@canonical.com> - 2017-05-15 17:00 +0200
    Re: [PATCH] scsi: aacraid: fix leak of data from stack back to userspace walter harms <wharms@bfs.de> - 2017-05-15 17:10 +0200

#1641778 — [PATCH] scsi: aacraid: fix leak of data from stack back to userspace

FromColin King <colin.king@canonical.com>
Date2017-05-15 17:00 +0200
Subject[PATCH] scsi: aacraid: fix leak of data from stack back to userspace
Message-ID<tHpDA-12A-25@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1641788

Fromwalter harms <wharms@bfs.de>
Date2017-05-15 17:10 +0200
Message-ID<tHpNf-1m3-11@gated-at.bofh.it>
In reply to#1641778

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web