Commit eaa015d2 authored by Rickard Strandqvist's avatar Rickard Strandqvist Committed by Jiri Kosina

scsi: mvsas: mv_sas.c: Fix for possible null pointer dereference

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: default avatarRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 305af08c
......@@ -1344,19 +1344,23 @@ void mvs_dev_gone_notify(struct domain_device *dev)
{
unsigned long flags = 0;
struct mvs_device *mvi_dev = dev->lldd_dev;
struct mvs_info *mvi = mvi_dev->mvi_info;
struct mvs_info *mvi;
if (!mvi_dev) {
mv_dprintk("found dev has gone.\n");
return;
}
mvi = mvi_dev->mvi_info;
spin_lock_irqsave(&mvi->lock, flags);
if (mvi_dev) {
mv_dprintk("found dev[%d:%x] is gone.\n",
mvi_dev->device_id, mvi_dev->dev_type);
mvs_release_task(mvi, dev);
mvs_free_reg_set(mvi, mvi_dev);
mvs_free_dev(mvi_dev);
} else {
mv_dprintk("found dev has gone.\n");
}
dev->lldd_dev = NULL;
mvi_dev->sas_device = NULL;
......
Markdown is supported
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