* [PATCH] scsi: megaraid: Fix null dereference
@ 2023-04-03 14:34 Igor Artemiev
2023-04-03 15:19 ` James Bottomley
0 siblings, 1 reply; 3+ messages in thread
From: Igor Artemiev @ 2023-04-03 14:34 UTC (permalink / raw)
To: Kashyap Desai
Cc: Igor Artemiev, Sumit Saxena, Shivasharan S, James E.J. Bottomley,
Martin K. Petersen, megaraidlinux.pdl, linux-scsi, linux-kernel,
lvc-project
When cmdid == CMDID_INT_CMDS, the 'mbox' pointer is NULL but is
dereferenced below.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 0f2bb84d2a68 ("[SCSI] megaraid: simplify internal command handling")
Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
---
drivers/scsi/megaraid.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index bf491af9f0d6..4fbf92dc717e 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1441,6 +1441,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
*/
if (cmdid == CMDID_INT_CMDS) {
scb = &adapter->int_scb;
+ mbox = (mbox_t *)scb->raw_mbox;
list_del_init(&scb->list);
scb->state = SCB_FREE;
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: megaraid: Fix null dereference
2023-04-03 14:34 [PATCH] scsi: megaraid: Fix null dereference Igor Artemiev
@ 2023-04-03 15:19 ` James Bottomley
2023-04-03 16:47 ` Igor A. Artemiev
0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2023-04-03 15:19 UTC (permalink / raw)
To: Igor Artemiev, Kashyap Desai
Cc: Sumit Saxena, Shivasharan S, Martin K. Petersen,
megaraidlinux.pdl, linux-scsi, linux-kernel, lvc-project
On Mon, 2023-04-03 at 17:34 +0300, Igor Artemiev wrote:
> When cmdid == CMDID_INT_CMDS, the 'mbox' pointer is NULL but is
> dereferenced below.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 0f2bb84d2a68 ("[SCSI] megaraid: simplify internal command
> handling")
> Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
> ---
> drivers/scsi/megaraid.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
> index bf491af9f0d6..4fbf92dc717e 100644
> --- a/drivers/scsi/megaraid.c
> +++ b/drivers/scsi/megaraid.c
> @@ -1441,6 +1441,7 @@ mega_cmd_done(adapter_t *adapter, u8
> completed[], int nstatus, int status)
> */
> if (cmdid == CMDID_INT_CMDS) {
> scb = &adapter->int_scb;
> + mbox = (mbox_t *)scb->raw_mbox;
Have you actually seen this and if so which firmware? I thought
megaraid internal commands only ever returned success or fail (0 or 1)
meaning they can never get into the sense processing case that is the
only consumer of the mbox.
James
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: megaraid: Fix null dereference
2023-04-03 15:19 ` James Bottomley
@ 2023-04-03 16:47 ` Igor A. Artemiev
0 siblings, 0 replies; 3+ messages in thread
From: Igor A. Artemiev @ 2023-04-03 16:47 UTC (permalink / raw)
To: jejb, Kashyap Desai
Cc: Sumit Saxena, Shivasharan S, Martin K. Petersen,
megaraidlinux.pdl, linux-scsi, linux-kernel, lvc-project
On 4/3/23 18:19, James Bottomley wrote:
> On Mon, 2023-04-03 at 17:34 +0300, Igor Artemiev wrote:
>> When cmdid == CMDID_INT_CMDS, the 'mbox' pointer is NULL but is
>> dereferenced below.
>>
>> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>>
>> Fixes: 0f2bb84d2a68 ("[SCSI] megaraid: simplify internal command
>> handling")
>> Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
>> ---
>> drivers/scsi/megaraid.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
>> index bf491af9f0d6..4fbf92dc717e 100644
>> --- a/drivers/scsi/megaraid.c
>> +++ b/drivers/scsi/megaraid.c
>> @@ -1441,6 +1441,7 @@ mega_cmd_done(adapter_t *adapter, u8
>> completed[], int nstatus, int status)
>> */
>> if (cmdid == CMDID_INT_CMDS) {
>> scb = &adapter->int_scb;
>> + mbox = (mbox_t *)scb->raw_mbox;
> Have you actually seen this and if so which firmware? I thought
> megaraid internal commands only ever returned success or fail (0 or 1)
> meaning they can never get into the sense processing case that is the
> only consumer of the mbox.
>
> James
>
No, I haven't seen this. A null dereference can be if the 'status' is
0x02. But if 'status' cannot be equal to 0x02, assignment isn't required.
Thanks,
Igor
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-03 16:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-03 14:34 [PATCH] scsi: megaraid: Fix null dereference Igor Artemiev
2023-04-03 15:19 ` James Bottomley
2023-04-03 16:47 ` Igor A. Artemiev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®