Re: [PATCH 2/2] sg: fixup infoleak when using SG_GET_REQUEST_TABLE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2017-09-15 08:05 AM, Hannes Reinecke wrote:
When calling SG_GET_REQUEST_TABLE ioctl that only a half-filled
table is returned; the remaining part will then contain stale
kernel memory information.
This patch zeroes out the entire table to avoid this issue.

Signed-off-by: Hannes Reinecke <hare@xxxxxxxx>
Acked-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx>

Thanks.

---
  drivers/scsi/sg.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index f1e20ca0..7f98ab4 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -868,7 +868,6 @@ static int max_sectors_bytes(struct request_queue *q)
  	list_for_each_entry(srp, &sfp->rq_list, entry) {
  		if (val > SG_MAX_QUEUE)
  			break;
-		memset(&rinfo[val], 0, SZ_SG_REQ_INFO);
  		rinfo[val].req_state = srp->done + 1;
  		rinfo[val].problem =
  			srp->header.masked_status &
@@ -1076,8 +1075,8 @@ static int max_sectors_bytes(struct request_queue *q)
  		else {
  			sg_req_info_t *rinfo;
- rinfo = kmalloc(SZ_SG_REQ_INFO * SG_MAX_QUEUE,
-								GFP_KERNEL);
+			rinfo = kzalloc(SZ_SG_REQ_INFO * SG_MAX_QUEUE,
+					GFP_KERNEL);
  			if (!rinfo)
  				return -ENOMEM;
  			read_lock_irqsave(&sfp->rq_list_lock, iflags);





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux