diff mbox series

[net,v2] net/sched: act_mirred: Don't zero blockid when net device is being deleted

Message ID 20240207222902.1469398-1-victor@mojatatu.com (mailing list archive)
State Accepted
Commit aae09a6c7783e28d1bcafee85e172fe411923b22
Delegated to: Netdev Maintainers
Headers show
Series [net,v2] net/sched: act_mirred: Don't zero blockid when net device is being deleted | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1019 this patch: 1019
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 1036 this patch: 1036
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1036 this patch: 1036
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-09--00-00 (tests: 687)

Commit Message

Victor Nogueira Feb. 7, 2024, 10:29 p.m. UTC
While testing tdc with parallel tests for mirred to block we caught an
intermittent bug. The blockid was being zeroed out when a net device
was deleted and, thus, giving us an incorrect blockid value whenever
we tried to dump the mirred action. Since we don't increment the block
refcount in the control path (and only use the ID), we don't need to
zero the blockid field whenever a net device is going down.

Fixes: 42f39036cda8 ("net/sched: act_mirred: Allow mirred to block")
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
---
v1 -> v2:
- Reword commit message to emphasise the bug is caused when a net
  device is being deleted
- Reword subject to emphasise the bug is caused when a net device is
  being deleted. Original patch subject was:
  "net/sched: act_mirred: Don't zero blockid when netns is going down"

 net/sched/act_mirred.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Simon Horman Feb. 9, 2024, 9:41 a.m. UTC | #1
On Wed, Feb 07, 2024 at 07:29:02PM -0300, Victor Nogueira wrote:
> While testing tdc with parallel tests for mirred to block we caught an
> intermittent bug. The blockid was being zeroed out when a net device
> was deleted and, thus, giving us an incorrect blockid value whenever
> we tried to dump the mirred action. Since we don't increment the block
> refcount in the control path (and only use the ID), we don't need to
> zero the blockid field whenever a net device is going down.
> 
> Fixes: 42f39036cda8 ("net/sched: act_mirred: Allow mirred to block")
> Signed-off-by: Victor Nogueira <victor@mojatatu.com>
> ---
> v1 -> v2:
> - Reword commit message to emphasise the bug is caused when a net
>   device is being deleted
> - Reword subject to emphasise the bug is caused when a net device is
>   being deleted. Original patch subject was:
>   "net/sched: act_mirred: Don't zero blockid when netns is going down"

Thanks for the update.

Reviewed-by: Simon Horman <horms@kernel.org>
Eric Dumazet Feb. 9, 2024, 10:30 a.m. UTC | #2
On Wed, Feb 7, 2024 at 11:29 PM Victor Nogueira <victor@mojatatu.com> wrote:
>
> While testing tdc with parallel tests for mirred to block we caught an
> intermittent bug. The blockid was being zeroed out when a net device
> was deleted and, thus, giving us an incorrect blockid value whenever
> we tried to dump the mirred action. Since we don't increment the block
> refcount in the control path (and only use the ID), we don't need to
> zero the blockid field whenever a net device is going down.
>
> Fixes: 42f39036cda8 ("net/sched: act_mirred: Allow mirred to block")
> Signed-off-by: Victor Nogueira <victor@mojatatu.com>

Reviewed-by: Eric Dumazet <edumazet@google.com>
Jamal Hadi Salim Feb. 9, 2024, 11:28 a.m. UTC | #3
On Wed, Feb 7, 2024 at 5:29 PM Victor Nogueira <victor@mojatatu.com> wrote:
>
> While testing tdc with parallel tests for mirred to block we caught an
> intermittent bug. The blockid was being zeroed out when a net device
> was deleted and, thus, giving us an incorrect blockid value whenever
> we tried to dump the mirred action. Since we don't increment the block
> refcount in the control path (and only use the ID), we don't need to
> zero the blockid field whenever a net device is going down.
>
> Fixes: 42f39036cda8 ("net/sched: act_mirred: Allow mirred to block")
> Signed-off-by: Victor Nogueira <victor@mojatatu.com>

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

> ---
> v1 -> v2:
> - Reword commit message to emphasise the bug is caused when a net
>   device is being deleted
> - Reword subject to emphasise the bug is caused when a net device is
>   being deleted. Original patch subject was:
>   "net/sched: act_mirred: Don't zero blockid when netns is going down"
>
>  net/sched/act_mirred.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
> index 93a96e9d8d90..6f4bb1c8ce7b 100644
> --- a/net/sched/act_mirred.c
> +++ b/net/sched/act_mirred.c
> @@ -533,8 +533,6 @@ static int mirred_device_event(struct notifier_block *unused,
>                                  * net_device are already rcu protected.
>                                  */
>                                 RCU_INIT_POINTER(m->tcfm_dev, NULL);
> -                       } else if (m->tcfm_blockid) {
> -                               m->tcfm_blockid = 0;
>                         }
>                         spin_unlock_bh(&m->tcf_lock);
>                 }
> --
> 2.34.1
>
patchwork-bot+netdevbpf@kernel.org Feb. 9, 2024, 9 p.m. UTC | #4
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  7 Feb 2024 19:29:02 -0300 you wrote:
> While testing tdc with parallel tests for mirred to block we caught an
> intermittent bug. The blockid was being zeroed out when a net device
> was deleted and, thus, giving us an incorrect blockid value whenever
> we tried to dump the mirred action. Since we don't increment the block
> refcount in the control path (and only use the ID), we don't need to
> zero the blockid field whenever a net device is going down.
> 
> [...]

Here is the summary with links:
  - [net,v2] net/sched: act_mirred: Don't zero blockid when net device is being deleted
    https://git.kernel.org/netdev/net/c/aae09a6c7783

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 93a96e9d8d90..6f4bb1c8ce7b 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -533,8 +533,6 @@  static int mirred_device_event(struct notifier_block *unused,
 				 * net_device are already rcu protected.
 				 */
 				RCU_INIT_POINTER(m->tcfm_dev, NULL);
-			} else if (m->tcfm_blockid) {
-				m->tcfm_blockid = 0;
 			}
 			spin_unlock_bh(&m->tcf_lock);
 		}