]> git.karo-electronics.de Git - karo-tx-linux.git/commit
netfilter: nf_tables: don't call nfnetlink_set_err() if nfnetlink_send() fails
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 1 Mar 2017 11:52:31 +0000 (12:52 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 3 Mar 2017 12:48:34 +0000 (13:48 +0100)
commit25e94a997b324b5f167f56d56d7106d38b78c9de
treeb393990fc6137004a3b1a1c568b522005ef6a72b
parentf9121355eb6f9babadb97bf5b34ab0cce7764406
netfilter: nf_tables: don't call nfnetlink_set_err() if nfnetlink_send() fails

The underlying nlmsg_multicast() already sets sk->sk_err for us to
notify socket overruns, so we should not do anything with this return
value. So we just call nfnetlink_set_err() if:

1) We fail to allocate the netlink message.

or

2) We don't have enough space in the netlink message to place attributes,
   which means that we likely need to allocate a larger message.

Before this patch, the internal ESRCH netlink error code was propagated
to userspace, which is quite misleading. Netlink semantics mandate that
listeners just hit ENOBUFS if the socket buffer overruns.

Reported-by: Alexander Alemayhu <alexander@alemayhu.com>
Tested-by: Alexander Alemayhu <alexander@alemayhu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c