Skip to content

Commit 849f858

Browse files
libin2015martinkpetersen
authored andcommitted
scsi: sg: add sg_remove_request in sg_common_write
If the dxfer_len is greater than 256M then the request is invalid and we need to call sg_remove_request in sg_common_write. Link: https://lore.kernel.org/r/[email protected] Fixes: f930c70 ("scsi: sg: only check for dxfer_len greater than 256M") Acked-by: Douglas Gilbert <[email protected]> Signed-off-by: Li Bin <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 066f79a commit 849f858

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/scsi/sg.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,10 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
793793
"sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n",
794794
(int) cmnd[0], (int) hp->cmd_len));
795795

796-
if (hp->dxfer_len >= SZ_256M)
796+
if (hp->dxfer_len >= SZ_256M) {
797+
sg_remove_request(sfp, srp);
797798
return -EINVAL;
799+
}
798800

799801
k = sg_start_req(srp, cmnd);
800802
if (k) {

0 commit comments

Comments
 (0)