>-----Original Message----- >From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf Of >Zaremba, Larysa >Sent: Wednesday, July 24, 2024 10:19 PM >To: intel-wired-lan@xxxxxxxxxxxxxxxx >Cc: Drewek, Wojciech <wojciech.drewek@xxxxxxxxx>; Fijalkowski, Maciej ><maciej.fijalkowski@xxxxxxxxx>; Jesper Dangaard Brouer <hawk@xxxxxxxxxx>; >Daniel Borkmann <daniel@xxxxxxxxxxxxx>; Zaremba, Larysa ><larysa.zaremba@xxxxxxxxx>; netdev@xxxxxxxxxxxxxxx; John Fastabend ><john.fastabend@xxxxxxxxx>; Alexei Starovoitov <ast@xxxxxxxxxx>; linux- >kernel@xxxxxxxxxxxxxxx; Eric Dumazet <edumazet@xxxxxxxxxx>; Kubiak, >Michal <michal.kubiak@xxxxxxxxx>; Nguyen, Anthony L ><anthony.l.nguyen@xxxxxxxxx>; Nambiar, Amritha ><amritha.nambiar@xxxxxxxxx>; Keller, Jacob E <jacob.e.keller@xxxxxxxxx>; >Jakub Kicinski <kuba@xxxxxxxxxx>; bpf@xxxxxxxxxxxxxxx; Paolo Abeni ><pabeni@xxxxxxxxxx>; David S. Miller <davem@xxxxxxxxxxxxx>; Karlsson, >Magnus <magnus.karlsson@xxxxxxxxx> >Subject: [Intel-wired-lan] [PATCH iwl-net v2 4/6] ice: check ICE_VSI_DOWN >under rtnl_lock when preparing for reset > >Consider the following scenario: > >.ndo_bpf() | ice_prepare_for_reset() | >________________________|_______________________________________| >rtnl_lock() | | >ice_down() | | > | test_bit(ICE_VSI_DOWN) - true | > | ice_dis_vsi() returns | >ice_up() | | > | proceeds to rebuild a running VSI | > >.ndo_bpf() is not the only rtnl-locked callback that toggles the interface to apply >new configuration. Another example is .set_channels(). > >To avoid the race condition above, act only after reading ICE_VSI_DOWN under >rtnl_lock. > >Fixes: 0f9d5027a749 ("ice: Refactor VSI allocation, deletion and rebuild flow") >Reviewed-by: Wojciech Drewek <wojciech.drewek@xxxxxxxxx> >Signed-off-by: Larysa Zaremba <larysa.zaremba@xxxxxxxxx> >--- > drivers/net/ethernet/intel/ice/ice_lib.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > Tested-by: Chandan Kumar Rout <chandanx.rout@xxxxxxxxx> (A Contingent Worker at Intel)