[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bf6746d0-d8cc-412e-ac7b-6f17c3e3de9d@acm.org>
Date: Tue, 3 Sep 2024 14:01:18 -0700
From: Bart Van Assche <bvanassche@....org>
To: Riyan Dhiman <riyandhiman14@...il.com>, aacraid@...rosemi.com,
James.Bottomley@...senPartnership.com, martin.petersen@...cle.com
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scsi: aacraid: Fix memory leak in open_getadapter_fib
function
On 9/3/24 1:30 PM, Riyan Dhiman wrote:
>> Just above the copy_to_user() call there is the following statement:
>>
>> list_add_tail(&fibctx->next, &dev->fib_list);
>>
>> Does that mean that the above kfree() will cause list corruption?
>
> Yes, you are correct. I overlooked that fibctx is part of a list, and freeing the
> memory without removing the list entry would corrupt the list.
> The list entry should be deleted before freeing the memory if copy_to_user() fails.
Are you sure that this is what the code should do?
Thanks,
Bart.
Powered by blists - more mailing lists