Commit 91724c20613484555ba7e7b3d8549dac1e24f7a8
Committed by
Christoph Hellwig
1 parent
99531e6063
scsi: Avoid crashing if device uses DIX but adapter does not support it
This can happen if a multipathed device uses DIX and another path is added via an adapter that does not support it. Multipath should not allow this path to be added, but we should not depend upon that to avoid crashing. Signed-off-by: Ewan D. Milne <emilne@redhat.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Showing 1 changed file with 11 additions and 1 deletions Side-by-side Diff
drivers/scsi/scsi_lib.c
... | ... | @@ -1143,7 +1143,17 @@ |
1143 | 1143 | struct scsi_data_buffer *prot_sdb = cmd->prot_sdb; |
1144 | 1144 | int ivecs, count; |
1145 | 1145 | |
1146 | - BUG_ON(prot_sdb == NULL); | |
1146 | + if (prot_sdb == NULL) { | |
1147 | + /* | |
1148 | + * This can happen if someone (e.g. multipath) | |
1149 | + * queues a command to a device on an adapter | |
1150 | + * that does not support DIX. | |
1151 | + */ | |
1152 | + WARN_ON_ONCE(1); | |
1153 | + error = BLKPREP_KILL; | |
1154 | + goto err_exit; | |
1155 | + } | |
1156 | + | |
1147 | 1157 | ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); |
1148 | 1158 | |
1149 | 1159 | if (scsi_alloc_sgtable(prot_sdb, ivecs, is_mq)) { |