From: Douglas Gilbert <dgilbert@interlog.com>
To: Hannes Reinecke <hare@suse.de>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
linux-scsi@vger.kernel.org,
Alexander Potapenko <glider@google.com>,
Ingo Molnar <mingo@redhat.com>,
Dmitry Vyukov <dvyukov@google.com>,
security@kernel.org, Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCH 2/2] sg: fixup infoleak when using SG_GET_REQUEST_TABLE
Date: Fri, 15 Sep 2017 15:44:33 -0400 [thread overview]
Message-ID: <2ecd9e8e-6c65-d036-cc49-e5124bfe47de@interlog.com> (raw)
In-Reply-To: <1505477116-75013-3-git-send-email-hare@suse.de>
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@suse.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
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);
>
prev parent reply other threads:[~2017-09-15 19:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-15 12:05 [PATCH 0/2] sg: fix infoleak when using SG_GET_REQUEST_TABLE Hannes Reinecke
2017-09-15 12:05 ` [PATCH 1/2] sg: factor out sg_fill_request_table() Hannes Reinecke
2017-09-15 14:26 ` Bart Van Assche
2017-09-15 17:54 ` Christoph Hellwig
2017-09-15 19:24 ` Martin K. Petersen
2017-09-15 19:44 ` Douglas Gilbert
2017-09-15 12:05 ` [PATCH 2/2] sg: fixup infoleak when using SG_GET_REQUEST_TABLE Hannes Reinecke
2017-09-15 14:29 ` Bart Van Assche
2017-09-15 17:54 ` Christoph Hellwig
2017-09-15 18:03 ` Eric Dumazet
2017-09-15 18:49 ` Linus Torvalds
2017-09-15 19:24 ` Martin K. Petersen
2017-09-15 19:44 ` Douglas Gilbert [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2ecd9e8e-6c65-d036-cc49-e5124bfe47de@interlog.com \
--to=dgilbert@interlog.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=hare@suse.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mingo@redhat.com \
--cc=security@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.