Skip to contentSkip to conversation

netfilter: nfnetlink_queue: remove locking in nfqnl_get_sk_secctx

PATCH New Florian Westphal 1 participant 1 message Feb 26

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nfnetlink_queue: remove locking in nfqnl_get_sk_secctx

We don't need the cb lock here. Also, if skb was NULL we'd have crashed already.

---
 net/netfilter/nfnetlink_queue.c | 7 -------
 1 file changed, 7 deletions(-)
net/netfilter/nfnetlink_queue.c +0 -7
index fbe5a8d71433..5390d085329a 100644
@@ -592,15 +592,8 @@ static int nfqnl_get_sk_secctx(struct sk_buff *skb, struct lsm_context *ctx)
 {
 	int seclen = 0;
 #if IS_ENABLED(CONFIG_NETWORK_SECMARK)
-
-	if (!skb || !sk_fullsock(skb->sk))
-		return 0;
-
-	read_lock_bh(&skb->sk->sk_callback_lock);
-
 	if (skb->secmark)
 		seclen = security_secid_to_secctx(skb->secmark, ctx);
-	read_unlock_bh(&skb->sk->sk_callback_lock);
 #endif
 	return seclen;
 }
Signature · 1 line
2.52.0