[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230329120826.GR831478@unreal>
Date: Wed, 29 Mar 2023 15:08:26 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Tony Nguyen <anthony.l.nguyen@...el.com>
Cc: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com, netdev@...r.kernel.org,
Jakob Koschel <jkl820.git@...il.com>,
Arpana Arland <arpanax.arland@...el.com>
Subject: Re: [PATCH net 4/4] ice: fix invalid check for empty list in
ice_sched_assoc_vsi_to_agg()
On Tue, Mar 28, 2023 at 10:20:35AM -0700, Tony Nguyen wrote:
> From: Jakob Koschel <jkl820.git@...il.com>
>
> The code implicitly assumes that the list iterator finds a correct
> handle. If 'vsi_handle' is not found the 'old_agg_vsi_info' was
> pointing to an bogus memory location. For safety a separate list
> iterator variable should be used to make the != NULL check on
> 'old_agg_vsi_info' correct under any circumstances.
>
> Additionally Linus proposed to avoid any use of the list iterator
> variable after the loop, in the attempt to move the list iterator
> variable declaration into the macro to avoid any potential misuse after
> the loop. Using it in a pointer comparison after the loop is undefined
> behavior and should be omitted if possible [1].
>
> Fixes: 37c592062b16 ("ice: remove the VSI info from previous agg")
> Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1]
> Signed-off-by: Jakob Koschel <jkl820.git@...il.com>
> Tested-by: Arpana Arland <arpanax.arland@...el.com> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
> ---
> drivers/net/ethernet/intel/ice/ice_sched.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@...dia.com>
Powered by blists - more mailing lists