scsi: mpt3sas: Fix error return code of mpt3sas_base_attach()
authorJia-Ju Bai <baijiaju1990@gmail.com>
Mon, 8 Mar 2021 03:52:41 +0000 (19:52 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Mar 2021 12:40:12 +0000 (14:40 +0200)
commit531fa1b28c81f5de330e82a4fbf9d157bed99582
treeb5b1b7e4e977c4d3f9daac048a92dd66322f008e
parent3674bcb773a48f09b2007c8800757e7a2e5ead89
scsi: mpt3sas: Fix error return code of mpt3sas_base_attach()

[ Upstream commit 3401ecf7fc1b9458a19d42c0e26a228f18ac7dda ]

When kzalloc() returns NULL, no error return code of mpt3sas_base_attach()
is assigned. To fix this bug, r is assigned with -ENOMEM in this case.

Link: https://lore.kernel.org/r/20210308035241.3288-1-baijiaju1990@gmail.com
Fixes: c696f7b83ede ("scsi: mpt3sas: Implement device_remove_in_progress check in IOCTL path")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/mpt3sas/mpt3sas_base.c