lkml.org 
[lkml]   [2022]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] ice: ice_sched: fix an incorrect NULL check on list iterator
Date


-----Original Message-----
> From: Xiaomeng Tong <xiam0nd.tong@gmail.com>
> Sent: Saturday, March 26, 2022 11:44 PM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>;
> davem@davemloft.net; kuba@kernel.org; pabeni@redhat.com; Raj, Victor
> <victor.raj@intel.com>; intel- wired-lan@lists.osuosl.org;
> netdev@vger.kernel.org; linux- kernel@vger.kernel.org; Xiaomeng Tong
> <xiam0nd.tong@gmail.com>; stable@vger.kernel.org
> Subject: [PATCH] ice: ice_sched: fix an incorrect NULL check on list
> iterator
>
> The bugs are here:
> if (old_agg_vsi_info)
> if (old_agg_vsi_info && !old_agg_vsi_info->tc_bitmap[0]) {
>
> The list iterator value 'old_agg_vsi_info' will *always* be set and
> non-NULL by list_for_each_entry_safe(), so it is incorrect to assume
> that the iterator value will be NULL if the list is empty or no
> element found (in this case, the check 'if (old_agg_vsi_info)' will
> always be true unexpectly).
>
> To fix the bug, use a new variable 'iter' as the list iterator, while
> use the original variable 'old_agg_vsi_info' as a dedicated pointer to
> point to the found element.
>

Yep. This looks correct to me.

> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
>
> Thanks,
> Jake

> Cc: stable@vger.kernel.org
> Fixes: 37c592062b16d ("ice: remove the VSI info from previous agg")
> Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
> ---
> drivers/net/ethernet/intel/ice/ice_sched.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>

Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)

\
 
 \ /
  Last update: 2022-05-02 10:18    [W:0.291 / U:1.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site