scsi: myrb: Fix up null pointer access on myrb_cleanup()
authorHannes Reinecke <hare@suse.de>
Mon, 23 May 2022 12:02:44 +0000 (14:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:36:22 +0000 (18:36 +0200)
commit2cd1adcb8c08fd1243c458ccdbb071fb442db39b
tree1dff93cba9054ce213b58f1fa462dad08976d5e8
parentb5a0f17b03df93dd3587b1d0e733871ffa01843b
scsi: myrb: Fix up null pointer access on myrb_cleanup()

[ Upstream commit f9f0a46141e2e39bedb4779c88380d1b5f018c14 ]

When myrb_probe() fails the callback might not be set, so we need to
validate the 'disable_intr' callback in myrb_cleanup() to not cause a null
pointer exception. And while at it do not call myrb_cleanup() if we cannot
enable the PCI device at all.

Link: https://lore.kernel.org/r/20220523120244.99515-1-hare@suse.de
Reported-by: Zheyu Ma <zheyuma97@gmail.com>
Tested-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/myrb.c