Skip to content

Commit 27c064a

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf
Pablo Neira Ayuso says: ==================== The following patchset contains Netfilter fixes for net: 1) Fix deadlock in nfnetlink due to missing mutex release in error path, from Ziyang Xuan. 2) Clean up pending autoload module list from nf_tables_exit_net() path, from Shigeru Yoshida. 3) Fixes for the netfilter's reverse path selftest, from Phil Sutter. All of these bugs have been around for several releases. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 5d04158 + 58bb78c commit 27c064a

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

net/netfilter/nf_tables_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10090,7 +10090,8 @@ static void __net_exit nf_tables_exit_net(struct net *net)
1009010090
struct nftables_pernet *nft_net = nft_pernet(net);
1009110091

1009210092
mutex_lock(&nft_net->commit_mutex);
10093-
if (!list_empty(&nft_net->commit_list))
10093+
if (!list_empty(&nft_net->commit_list) ||
10094+
!list_empty(&nft_net->module_list))
1009410095
__nf_tables_abort(net, NFNL_ABORT_NONE);
1009510096
__nft_release_tables(net);
1009610097
mutex_unlock(&nft_net->commit_mutex);

net/netfilter/nfnetlink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
294294
nfnl_lock(subsys_id);
295295
if (nfnl_dereference_protected(subsys_id) != ss ||
296296
nfnetlink_find_client(type, ss) != nc) {
297+
nfnl_unlock(subsys_id);
297298
err = -EAGAIN;
298299
break;
299300
}

tools/testing/selftests/netfilter/rpath.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fi
1515

1616
if ip6tables-legacy --version >/dev/null 2>&1; then
1717
ip6tables='ip6tables-legacy'
18-
elif ! ip6tables --version >/dev/null 2>&1; then
18+
elif ip6tables --version >/dev/null 2>&1; then
1919
ip6tables='ip6tables'
2020
else
2121
ip6tables=''
@@ -62,9 +62,11 @@ ip -net "$ns1" a a fec0:42::2/64 dev v0 nodad
6262
ip -net "$ns2" a a fec0:42::1/64 dev d0 nodad
6363

6464
# firewall matches to test
65-
ip netns exec "$ns2" "$iptables" -t raw -A PREROUTING -s 192.168.0.0/16 -m rpfilter
66-
ip netns exec "$ns2" "$ip6tables" -t raw -A PREROUTING -s fec0::/16 -m rpfilter
67-
ip netns exec "$ns2" nft -f - <<EOF
65+
[ -n "$iptables" ] && ip netns exec "$ns2" \
66+
"$iptables" -t raw -A PREROUTING -s 192.168.0.0/16 -m rpfilter
67+
[ -n "$ip6tables" ] && ip netns exec "$ns2" \
68+
"$ip6tables" -t raw -A PREROUTING -s fec0::/16 -m rpfilter
69+
[ -n "$nft" ] && ip netns exec "$ns2" $nft -f - <<EOF
6870
table inet t {
6971
chain c {
7072
type filter hook prerouting priority raw;
@@ -106,8 +108,8 @@ testrun() {
106108
if [ -n "$nft" ]; then
107109
(
108110
echo "delete table inet t";
109-
ip netns exec "$ns2" nft -s list table inet t;
110-
) | ip netns exec "$ns2" nft -f -
111+
ip netns exec "$ns2" $nft -s list table inet t;
112+
) | ip netns exec "$ns2" $nft -f -
111113
fi
112114

113115
# test 1: martian traffic should fail rpfilter matches

0 commit comments

Comments
 (0)