Re: [PATCH] net: Use nlmsg_unicast() instead of netlink_unicast()

From: Pablo Neira Ayuso
Date: Mon Jul 12 2021 - 12:49:15 EST


On Mon, Jul 12, 2021 at 08:53:01PM +0800, Yajun Deng wrote:
> diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
> index 639c337c885b..aa3397eec330 100644
> --- a/net/netfilter/nft_compat.c
> +++ b/net/netfilter/nft_compat.c
> @@ -683,10 +683,8 @@ 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 = nlmsg_unicast(info->sk, skb2, NETLINK_CB(skb).portid);

netfilter needs nfnetlink_unicast to deal with EAGAIN, see e0241ae6ac59

So either:

a) use nfnetlink_unicast.
b) remove this chunk and I'll route a patch to fix this in the
netfilter tree.

Pick one at your choice.

Thanks.

> out_put:
> rcu_read_lock();
> module_put(THIS_MODULE);