[SRU][Trusty][PATCH 1/1] scsi: sg: fixup infoleak when using SG_GET_REQUEST_TABLE
Kleber Sacilotto de Souza
kleber.souza at canonical.com
Wed Jul 11 15:45:25 UTC 2018
From: Hannes Reinecke <hare at suse.de>
When calling SG_GET_REQUEST_TABLE ioctl 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 at suse.com>
Reviewed-by: Bart Van Assche <bart.vanassche at wdc.com>
Reviewed-by: Christoph Hellwig <hch at lst.de>
Reviewed-by: Eric Dumazet <edumazet at google.com>
Signed-off-by: Martin K. Petersen <martin.petersen at oracle.com>
CVE-2017-14991
(backported from commit 3e0097499839e0fe3af380410eababe5a47c4cf9)
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza at canonical.com>
---
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 47b8f7b8b7b4..1c3dd355b317 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1003,14 +1003,13 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
sg_req_info_t *rinfo;
unsigned int ms;
- 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);
for (srp = sfp->headrp, val = 0; val < SG_MAX_QUEUE;
++val, srp = srp ? srp->nextrp : srp) {
- memset(&rinfo[val], 0, SZ_SG_REQ_INFO);
if (srp) {
rinfo[val].req_state = srp->done + 1;
rinfo[val].problem =
--
2.17.1
More information about the kernel-team
mailing list