]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: sg: Don't use GFP_ATOMIC in sg_start_req()
authorChristoph Hellwig <hch@lst.de>
Wed, 15 Apr 2026 06:08:06 +0000 (08:08 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 21 Apr 2026 02:13:41 +0000 (22:13 -0400)
sg_start_req() is called from normal user context and can sleep when
waiting for memory.  Switch it to use GFP_KERNEL, which fixes allocation
failures seen with the bio_alloc rework.

Fixes: b520c4eef83d ("block: split bio_alloc_bioset more clearly into a fast and slowpath")
Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20260415060813.807659-2-hch@lst.de
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sg.c

index 2b4b2a1a8e442c18b338a2e72e2f82630e730348..74cd4e8a61c2a089332825ca7684d74d46e6cfcc 100644 (file)
@@ -1801,7 +1801,7 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
        }
 
        res = blk_rq_map_user_io(rq, md, hp->dxferp, hp->dxfer_len,
-                       GFP_ATOMIC, iov_count, iov_count, 1, rw);
+                       GFP_KERNEL, iov_count, iov_count, 1, rw);
        if (!res) {
                srp->bio = rq->bio;