Skip to contentSkip to conversation

netfilter: nf_tables_offload: Fix check the NETDEV_UNREGISTER in netdev event

PATCH Applied [email protected] 2 participants 5 messages Nov 13, 2019 – Dec 2, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: nf_tables_offload: Fix check the NETDEV_UNREGISTER in netdev event

From: wenxu <[email protected]>

It should check the NETDEV_UNREGISTER in nft_offload_netdev_event

Fixes 06d392cbe3db ("netfilter: nf_tables_offload: remove rules when the device unregisters")
---
 net/netfilter/nf_tables_offload.c | 3 +++
 1 file changed, 3 insertions(+)
net/netfilter/nf_tables_offload.c +3 -0
index e25dab8..b002832 100644
@@ -446,6 +446,9 @@ static int nft_offload_netdev_event(struct notifier_block *this,
 	struct net *net = dev_net(dev);
 	struct nft_chain *chain;
 
+	if (event != NETDEV_UNREGISTER)
+		return 0;
+
 	mutex_lock(&net->nft.commit_mutex);
 	chain = __nft_offload_get_chain(dev);
 	if (chain)
Signature · 1 line
1.8.3.1
author
#1 lore raw

Hi pablo,

Any comments about this patch?

BR

wenxu

Quoted 24 lines · On 11/13/2019 12:21 PM, [email protected] wrote:

From: wenxu <[email protected]>

It should check the NETDEV_UNREGISTER in nft_offload_netdev_event

Fixes 06d392cbe3db ("netfilter: nf_tables_offload: remove rules when the device unregisters")
---
 net/netfilter/nf_tables_offload.c | 3 +++
 1 file changed, 3 insertions(+)
net/netfilter/nf_tables_offload.c +3 -0
index e25dab8..b002832 100644
@@ -446,6 +446,9 @@ static int nft_offload_netdev_event(struct notifier_block *this,
 	struct net *net = dev_net(dev);
 	struct nft_chain *chain;
 
+	if (event != NETDEV_UNREGISTER)
+		return 0;
+
 	mutex_lock(&net->nft.commit_mutex);
 	chain = __nft_offload_get_chain(dev);
 	if (chain)
#3 lore raw
In reply to [email protected]
Quoted 15 lines · On Wed, Nov 13, 2019 at 12:21:07PM +0800, [email protected] wrote:

From: wenxu <[email protected]>

It should check the NETDEV_UNREGISTER in nft_offload_netdev_event

Fixes 06d392cbe3db ("netfilter: nf_tables_offload: remove rules when the device unregisters")
---
 net/netfilter/nf_tables_offload.c | 3 +++
 1 file changed, 3 insertions(+)
net/netfilter/nf_tables_offload.c +0 -0
index e25dab8..b002832 100644

net/netfilter/nf_tables_offload.c static int nft_offload_netdev_event(struct notifier_block *this, · line 450

Quoted 5 lines
net/netfilter/nf_tables_offload.c +2 -0
@@ -446,6 +446,9 @@ static int nft_offload_netdev_event(struct notifier_block *this,
 	struct net *net = dev_net(dev);
 	struct nft_chain *chain;
 
+	if (event != NETDEV_UNREGISTER)
+		return 0;

Actually I cannot apply this.

        if (event != NETDEV_UNREGISTER &&
            event != NETDEV_CHANGENAME)
                return NOTIFY_DONE;

You also have to check for change name and use NOTIFY_DONE as return value instead. Sorry.

#4 lore raw
Quoted 24 lines · Pablo Neira Ayuso
Quoted 15 lines · On Wed, Nov 13, 2019 at 12:21:07PM +0800, [email protected] wrote:

From: wenxu <[email protected]>

It should check the NETDEV_UNREGISTER in nft_offload_netdev_event

Fixes 06d392cbe3db ("netfilter: nf_tables_offload: remove rules when the device unregisters")
---
 net/netfilter/nf_tables_offload.c | 3 +++
 1 file changed, 3 insertions(+)
net/netfilter/nf_tables_offload.c +0 -0
index e25dab8..b002832 100644

net/netfilter/nf_tables_offload.c static int nft_offload_netdev_event(struct notifier_block *this, · line 450

Quoted 5 lines
net/netfilter/nf_tables_offload.c +2 -0
@@ -446,6 +446,9 @@ static int nft_offload_netdev_event(struct notifier_block *this,
 	struct net *net = dev_net(dev);
 	struct nft_chain *chain;
 
+	if (event != NETDEV_UNREGISTER)
+		return 0;

Actually I cannot apply this.

Quoted 6 lines
        if (event != NETDEV_UNREGISTER &&
            event != NETDEV_CHANGENAME)
                return NOTIFY_DONE;

You also have to check for change name and use NOTIFY_DONE as return value instead. Sorry.

It's only NOTIFY_DONE that is missing.

I'll mangle this patch and apply, no need to send a new version.