scsi: sg: add sg_remove_request in sg_write

commit 83c6f2390040f188cc25b270b4befeb5628c1aee upstream.

If the __copy_from_user function failed we need to call sg_remove_request
in sg_write.

Acked-by: Douglas Gilbert <>
Signed-off-by: Wu Bo <>
Signed-off-by: Martin K. Petersen <>
Signed-off-by: Sasha Levin <>
[groeck: Backport to v5.4.y and older kernels]
Signed-off-by: Guenter Roeck <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: Ben Hutchings <>
1 file changed