[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230912083519.e2yveio72emi7rd4@debian.org>
Date: Tue, 12 Sep 2023 05:35:19 -0300
From: "Ricardo B. Marliere" <ricardo@...liere.net>
To: syzbot <syzbot+a532b03fdfee2c137666@...kaller.appspotmail.com>
Cc: axboe@...nel.dk, dan.j.williams@...el.com,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com, viro@...iv.linux.org.uk
Subject: Re: [syzbot] [block?] WARNING in blk_rq_map_user_iov
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",
Powered by blists - more mailing lists