Commit f1f1fada authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by Martin K. Petersen
Browse files

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

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 <>
parent 318ddb34
......@@ -1276,7 +1276,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