lkml.org 
[lkml]   [2024]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] scsi: elx: efct: adjust error handling inside efct_hw_setup_io
On Sat, Feb 10, 2024 at 02:08:33PM +0300, Fedor Pchelkin wrote:
> IO and WQE buffers are allocated once per HW and can be reused later. If
> WQE buffers allocation fails then the whole allocation is marked as failed
> but already created IO array internal objects are not freed. hw->io is
> freed but not nullified in that specific case - it may become a problem
> later as efct_hw_setup_io() is supposed to be reusable for the same HW.
>
> Also rollback if HW IO objects initialization loop fails due to memory
> allocation error.
>
> While at it, use kcalloc instead of kmalloc_array/memset-zero combination
> and get rid of some needless NULL assignments: nullifying hw->io[i]
> elements just before freeing hw->io is not really useful.
>
> Found by Linux Verification Center (linuxtesting.org).
>
> Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines")
> Cc: stable@vger.kernel.org
> Suggested-by: Daniel Wagner <dwagner@suse.de>
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
> ---
> v2: per Daniel Wagner's notice, handle the other possible memory
> allocation errors inside the function.

Looks good to me! Thanks!

Reviewed-by: Daniel Wagner <dwagner@suse.de>

\
 
 \ /
  Last update: 2024-05-27 14:57    [W:0.080 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site