]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
netfilter: nfnetlink: fix potential dead lock in nfnetlink_rcv_msg()
authorZiyang Xuan <william.xuanziyang@huawei.com>
Thu, 3 Nov 2022 01:12:02 +0000 (09:12 +0800)
committerFlorian Westphal <fw@strlen.de>
Tue, 8 Nov 2022 22:16:13 +0000 (23:16 +0100)
When type is NFNL_CB_MUTEX and -EAGAIN error occur in nfnetlink_rcv_msg(),
it does not execute nfnl_unlock(). That would trigger potential dead lock.

Fixes: 50f2db9e368f ("netfilter: nfnetlink: consolidate callback types")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nfnetlink.c

index 9c44518cb70ff74c3b0754c95b5d65fa2495f88e..6d18fb3468683fe3cfbad5d8a9604ea46a89437c 100644 (file)
@@ -294,6 +294,7 @@ replay:
                        nfnl_lock(subsys_id);
                        if (nfnl_dereference_protected(subsys_id) != ss ||
                            nfnetlink_find_client(type, ss) != nc) {
+                               nfnl_unlock(subsys_id);
                                err = -EAGAIN;
                                break;
                        }