scsi: sg: check length passed to SG_NEXT_CMD_LEN

commit bf33f87dd04c371ea33feb821b60d63d754e3124 upstream.

The user can control the size of the next command passed along, but the
value passed to the ioctl isn't checked against the usable max command

Signed-off-by: Peter Chang <>
Acked-by: Douglas Gilbert <>
Signed-off-by: Martin K. Petersen <>
Signed-off-by: Greg Kroah-Hartman <>

1 file changed