Re: [PATCH net v2] ice: Fix use-after-scope in ice_sched_add_nodes_to_layer()

From: Tony Nguyen

Date: Tue Jun 23 2026 - 16:36:23 EST




On 6/17/2026 12:21 AM, NeKon69 wrote:
Commit 7fb09a737536 ("ice: Modify recursive way of adding nodes")
changed ice_sched_add_nodes_to_layer() from recursive control flow to an
iterative loop.

Inside the loop, first_teid_ptr may be set to the address of a
block-local variable:

u32 temp;
...
if (num_added)
first_teid_ptr = &temp;

On the next loop iteration, first_teid_ptr may be passed to
ice_sched_add_nodes_to_hw_layer(), after temp from the previous
iteration has gone out of scope.

Instead of keeping temporary storage for later calls, allow
first_node_teid to be NULL when the caller does not need the TEID.

This was found by Clang with LifetimeSafety enabled while testing C
language support on a Linux allmodconfig build.

Fixes: 7fb09a737536 ("ice: Modify recursive way of adding nodes")
Link: https://github.com/llvm/llvm-project/pull/203270
Signed-off-by: NeKon69 <nobodqwe@xxxxxxxxx>

Hi,

The patch itself looks ok but I believe author/sign-off should be an actual name.

Thanks,
Tony