From: Tadeusz Struk <tadeusz.struk@linaro.org>
To: dgilbert@interlog.com, Bart Van Assche <bvanassche@acm.org>,
linux-scsi@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>,
"James E . J . Bottomley" <jejb@linux.ibm.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
syzbot+5516b30f5401d4dcbcae@syzkaller.appspotmail.com
Subject: Re: [PATCH] scsi: core: initialize cmd->cmnd before it is used
Date: Tue, 2 Nov 2021 15:22:19 -0700 [thread overview]
Message-ID: <f80fd188-a0e5-2e75-506c-3e82d138fe28@linaro.org> (raw)
In-Reply-To: <cad499a9-7587-1fa9-9f7d-223e66a18efa@interlog.com>
On 11/2/21 14:33, Douglas Gilbert wrote:
>> Thanks for having taken a look. I found the above check in sg_new_write(). To
>> me that function seems to come from a code path that is unrelated to sg_io(),
>> the function shown in the call stack in the email at the start of this thread.
>> Maybe I overlooked something but I haven't found a minimum size check for
>> hdr->cmd_len in sg_io() before the blk_execute_rq() call. Should such a check
>> perhaps be added?
>
> I guess it came from ioctl(<non_sg_fd>, SG_IO, ) and I found no lower bound
> check when I looked in lk 5.15.0 . No-one has complained to me about the
> hp->cmd_len < 6
>
> check in the sg driver ***. So I think such a check may be useful in the
> scsi_fill_sghdr_rq() function in drivers/scsi/scsi_ioctl.c . And a return
> of -EMSGSIZE seems to be tailor made for this situation.
>
> Doug Gilbert
>
>
> *** It is possible a vendor specific command could be between 1 and 5 bytes
> long, but that would probably be an unwise choice.
Bart,
Do you want me to send a patch with the check in scsi_fill_sghdr_rq()?
I want to close the mentioned syzbot issue in 5.10. I can also do the
back-porting if anything will be required.
--
Thanks,
Tadeusz
next prev parent reply other threads:[~2021-11-02 22:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 19:24 Tadeusz Struk
2021-11-01 20:06 ` Bart Van Assche
2021-11-01 20:13 ` Tadeusz Struk
2021-11-01 20:20 ` Bart Van Assche
2021-11-02 1:56 ` Douglas Gilbert
2021-11-02 3:06 ` Bart Van Assche
2021-11-02 21:33 ` Douglas Gilbert
2021-11-02 22:22 ` Tadeusz Struk [this message]
2021-11-02 22:27 ` Bart Van Assche
2021-11-02 23:01 ` Tadeusz Struk
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=f80fd188-a0e5-2e75-506c-3e82d138fe28@linaro.org \
--to=tadeusz.struk@linaro.org \
--cc=bvanassche@acm.org \
--cc=dgilbert@interlog.com \
--cc=hch@lst.de \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+5516b30f5401d4dcbcae@syzkaller.appspotmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®