Subject: Re: [PATCH net v2] net: team: fix NULL pointer dereference in team_xmit during mode change

From: Jakub Kicinski <[email-masked]>
Date: Wed, 20 May 2026 15:20:18 -0700

On Wed, 20 May 2026 14:14:10 +0800 Weiming Shi wrote:
> > From looking at the repro it seems like you never add any ports?
> > I suspect that the author of this code assumed that if there are 
> > no ports there must be no traffic, so it's safe to be flipping the
> > modes. I'd rather prevent the race than make it safe. Could we defer
> > setting the real handler until after the first port is added?  
> 
> The next version will drops the release/acquire and replaces memset/memcpy 
> with per-field updates that skip transmit/receive entirely. They stay as dummies 
> throughout mode change since team_adjust_ops() already handles them based on port count.
> WRITE_ONCE/READ_ONCE for tearing, synchronize_net() before exit_op() to drain old readers.
> 
> Does that match what you had in mind, or would you prefer a different structure?

Please post it and we'll take it from there