public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ricardo B. Marliere" <ricardo@marliere.net>
To: syzbot <syzbot+a532b03fdfee2c137666@syzkaller.appspotmail.com>
Cc: axboe@kernel.dk, dan.j.williams@intel.com,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk
Subject: Re: [syzbot] [block?] WARNING in blk_rq_map_user_iov
Date: Tue, 12 Sep 2023 05:35:19 -0300	[thread overview]
Message-ID: <20230912083519.e2yveio72emi7rd4@debian.org> (raw)
In-Reply-To: <0000000000009b92c10604d7a5e9@google.com>

Flag iter as the data source if dxfer_direction is set to
SG_DXFER_TO_DEV or SG_DXFER_TO_FROM_DEV.

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 0d8afffd1683..991c6554bef4 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1737,8 +1737,13 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
        Sg_scatter_hold *rsv_schp = &sfp->reserve;
        struct request_queue *q = sfp->parentdp->device->request_queue;
        struct rq_map_data *md, map_data;
-       int rw = hp->dxfer_direction == SG_DXFER_TO_DEV ? ITER_SOURCE : ITER_DEST;
        struct scsi_cmnd *scmd;
+       int rw;
+       if (hp->dxfer_direction == SG_DXFER_TO_DEV ||
+           hp->dxfer_direction == SG_DXFER_TO_FROM_DEV)
+               rw = ITER_SOURCE;
+       else
+               rw = ITER_DEST;

        SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp,
                                      "sg_start_req: dxfer_len=%d\n",


  reply	other threads:[~2023-09-12  8:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08 11:55 [syzbot] [block?] WARNING in blk_rq_map_user_iov syzbot
2023-09-12  8:35 ` Ricardo B. Marliere [this message]
2023-09-12 10:17   ` syzbot

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=20230912083519.e2yveio72emi7rd4@debian.org \
    --to=ricardo@marliere.net \
    --cc=axboe@kernel.dk \
    --cc=dan.j.williams@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+a532b03fdfee2c137666@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=viro@zeniv.linux.org.uk \
    /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