Commit 4c0e2e4a authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by Greg Kroah-Hartman
Browse files

scsi: sd: don't crash the host on invalid commands

[ Upstream commit f1f1fada


When sd_init_command() get's a command with a unknown req_op() it crashes the
system via BUG().

This makes debugging the actual reason for the broken request cmd_flags pretty
hard as the system is down before it's able to write out debugging data on the
serial console or the trace buffer.

Change the BUG() to a WARN_ON() and return BLKPREP_KILL to fail gracefully and
return an I/O error to the producer of the request.

Signed-off-by: default avatarJohannes Thumshirn <>
Cc: Hannes Reinecke <>
Cc: Bart Van Assche <>
Cc: Christoph Hellwig <>
Reviewed-by: default avatarChristoph Hellwig <>
Reviewed-by: default avatarBart Van Assche <>
Signed-off-by: default avatarMartin K. Petersen <>
Signed-off-by: default avatarSasha Levin <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent b6b5bc24
......@@ -1285,7 +1285,8 @@ static int sd_init_command(struct scsi_cmnd *cmd)
return sd_zbc_setup_reset_cmnd(cmd);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment