[SCSI] mvsas: bug fix, null pointer may be used
authorAndy Yan <ayan@marvell.com>
Mon, 11 May 2009 13:49:52 +0000 (21:49 +0800)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Sat, 23 May 2009 20:44:08 +0000 (15:44 -0500)
Null pointer check to avoid corruption.

Signed-off-by: Ying Chu <jasonchu@marvell.com>
Signed-off-by: Andy Yan <ayan@marvell.com>
Signed-off-by: Ke Wei <kewei@marvell.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/mvsas/mv_sas.c

index 4279b5e8808a834fc72639f985c709bf9d4d4713..3fc396fc050db4d17b846588fefba643997f8137 100644 (file)
@@ -1873,11 +1873,11 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags)
        }
 
 out:
-       if (mvi_dev)
+       if (mvi_dev) {
                mvi_dev->runing_req--;
-       if (sas_protocol_ata(task->task_proto))
-               mvs_free_reg_set(mvi, mvi_dev);
-
+               if (sas_protocol_ata(task->task_proto))
+                       mvs_free_reg_set(mvi, mvi_dev);
+       }
        mvs_slot_task_free(mvi, task, slot, slot_idx);
        sts = tstat->stat;