Skip to contentSkip to conversation

netfilter: nft_compat: use nfnetlink_unicast()

PATCH New Pablo Neira Ayuso 1 participant 1 message Jul 15, 2021

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH v2 1/1 netfilter: nft_compat: use nfnetlink_unicast()

Use nfnetlink_unicast() which already translates EAGAIN to ENOBUFS, since EAGAIN is reserved to report missing module dependencies to the nfnetlink core.

e0241ae6ac59 ("netfilter: use nfnetlink_unicast() forgot to update this spot.

---
v2: update return value of nfnl_compat_get_rcu().

 net/netfilter/nft_compat.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
net/netfilter/nft_compat.c +3 -5
index 639c337c885b..272bcdb1392d 100644
@@ -683,14 +683,12 @@ static int nfnl_compat_get_rcu(struct sk_buff *skb,
 		goto out_put;
 	}
 
-	ret = netlink_unicast(info->sk, skb2, NETLINK_CB(skb).portid,
-			      MSG_DONTWAIT);
-	if (ret > 0)
-		ret = 0;
+	ret = nfnetlink_unicast(skb2, info->net, NETLINK_CB(skb).portid);
 out_put:
 	rcu_read_lock();
 	module_put(THIS_MODULE);
-	return ret == -EAGAIN ? -ENOBUFS : ret;
+
+	return ret;
 }
 
 static const struct nla_policy nfnl_compat_policy_get[NFTA_COMPAT_MAX+1] = {
Signature · 1 line
2.20.1