diff mbox series

[nf] netfilter: nft_inner: release local_lock before re-enabling softirqs

Message ID 20260512093052.24326-1-fw@strlen.de
State Accepted, archived
Headers show
Series [nf] netfilter: nft_inner: release local_lock before re-enabling softirqs | expand

Commit Message

Florian Westphal May 12, 2026, 9:30 a.m. UTC
Quoting sashiko:
 In the error path, local_bh_enable() is called before
 local_unlock_nested_bh().

Fixes: ba36fada9ab4 ("netfilter: nft_inner: Use nested-BH locking for nft_pcpu_tun_ctx")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nft_inner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Fernando Fernandez Mancera May 12, 2026, 12:57 p.m. UTC | #1
On 5/12/26 11:30 AM, Florian Westphal wrote:
> Quoting sashiko:
>   In the error path, local_bh_enable() is called before
>   local_unlock_nested_bh().
> 
> Fixes: ba36fada9ab4 ("netfilter: nft_inner: Use nested-BH locking for nft_pcpu_tun_ctx")
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>   net/netfilter/nft_inner.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/nft_inner.c b/net/netfilter/nft_inner.c
> index 03ffb1159fc1..85164369b924 100644
> --- a/net/netfilter/nft_inner.c
> +++ b/net/netfilter/nft_inner.c
> @@ -247,8 +247,8 @@ static bool nft_inner_restore_tun_ctx(const struct nft_pktinfo *pkt,
>   	local_lock_nested_bh(&nft_pcpu_tun_ctx.bh_lock);
>   	this_cpu_tun_ctx = this_cpu_ptr(&nft_pcpu_tun_ctx.ctx);
>   	if (this_cpu_tun_ctx->cookie != (unsigned long)pkt->skb) {
> -		local_bh_enable();
>   		local_unlock_nested_bh(&nft_pcpu_tun_ctx.bh_lock);
> +		local_bh_enable();
>   		return false;
>   	}
>   	*tun_ctx = *this_cpu_tun_ctx;

Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>

Thanks!
diff mbox series

Patch

diff --git a/net/netfilter/nft_inner.c b/net/netfilter/nft_inner.c
index 03ffb1159fc1..85164369b924 100644
--- a/net/netfilter/nft_inner.c
+++ b/net/netfilter/nft_inner.c
@@ -247,8 +247,8 @@  static bool nft_inner_restore_tun_ctx(const struct nft_pktinfo *pkt,
 	local_lock_nested_bh(&nft_pcpu_tun_ctx.bh_lock);
 	this_cpu_tun_ctx = this_cpu_ptr(&nft_pcpu_tun_ctx.ctx);
 	if (this_cpu_tun_ctx->cookie != (unsigned long)pkt->skb) {
-		local_bh_enable();
 		local_unlock_nested_bh(&nft_pcpu_tun_ctx.bh_lock);
+		local_bh_enable();
 		return false;
 	}
 	*tun_ctx = *this_cpu_tun_ctx;