netfilter: nfnetlink: nfnetlink_unicast() reports EAGAIN instead of ENOBUFS
authorPablo Neira Ayuso <pablo@netfilter.org>
Sun, 23 Aug 2020 11:55:36 +0000 (13:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Sep 2020 17:14:19 +0000 (19:14 +0200)
commit4b5158a2f6b79fb8c1a8157712917ae81b41a68b
tree816ec9848c8026d8276979a1e31f90092675972d
parente8df547c81d0ce5ad2d7a6d34a6cf07490902948
netfilter: nfnetlink: nfnetlink_unicast() reports EAGAIN instead of ENOBUFS

[ Upstream commit ee921183557af39c1a0475f982d43b0fcac25e2e ]

Frontend callback reports EAGAIN to nfnetlink to retry a command, this
is used to signal that module autoloading is required. Unfortunately,
nlmsg_unicast() reports EAGAIN in case the receiver socket buffer gets
full, so it enters a busy-loop.

This patch updates nfnetlink_unicast() to turn EAGAIN into ENOBUFS and
to use nlmsg_unicast(). Remove the flags field in nfnetlink_unicast()
since this is always MSG_DONTWAIT in the existing code which is exactly
what nlmsg_unicast() passes to netlink_unicast() as parameter.

Fixes: 96518518cc41 ("netfilter: add nftables")
Reported-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/netfilter/nfnetlink.h
net/netfilter/nf_tables_api.c
net/netfilter/nfnetlink.c
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c