Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net-next] act_mirred: Fix mirred_init_module error handling
@ 2019-10-09  3:10 YueHaibing
  2019-10-10  2:23 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2019-10-09  3:10 UTC (permalink / raw)
  To: jhs, xiyou.wangcong, jiri, davem; +Cc: netdev, linux-kernel, YueHaibing

If tcf_register_action failed, mirred_device_notifier
should be unregistered.

Fixes: 3b87956ea645 ("net sched: fix race in mirred device removal")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 net/sched/act_mirred.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 9d1bf50..d0d397e 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -479,7 +479,11 @@ static int __init mirred_init_module(void)
 		return err;
 
 	pr_info("Mirror/redirect action on\n");
-	return tcf_register_action(&act_mirred_ops, &mirred_net_ops);
+	err = tcf_register_action(&act_mirred_ops, &mirred_net_ops);
+	if (err)
+		unregister_netdevice_notifier(&mirred_device_notifier);
+
+	return err;
 }
 
 static void __exit mirred_cleanup_module(void)
-- 
2.7.4



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] act_mirred: Fix mirred_init_module error handling
  2019-10-09  3:10 [PATCH net-next] act_mirred: Fix mirred_init_module error handling YueHaibing
@ 2019-10-10  2:23 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2019-10-10  2:23 UTC (permalink / raw)
  To: YueHaibing; +Cc: jhs, xiyou.wangcong, jiri, davem, netdev, linux-kernel

On Wed, 9 Oct 2019 11:10:52 +0800, YueHaibing wrote:
> If tcf_register_action failed, mirred_device_notifier
> should be unregistered.
> 
> Fixes: 3b87956ea645 ("net sched: fix race in mirred device removal")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Why does the subject say net-next, looks like the bug was introduced
all the way back in 2.6.36. For fixes for code which is already in
Linus'es main tree the subject should say [PATCH net]. Those are on the
fast path to the -rc releases and stable.

Applied to net, and queued for stable, please let me know if I
misunderstood the intention here.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09  3:10 [PATCH net-next] act_mirred: Fix mirred_init_module error handling YueHaibing
2019-10-10  2:23 ` Jakub Kicinski

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org netdev@archiver.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox