This repository was archived by the owner on Sep 24, 2020. It is now read-only.
Commit 01ea306
netfilter: drop outermost socket lock in getsockopt()
The Syzbot reported a possible deadlock in the netfilter area caused by
rtnl lock, xt lock and socket lock being acquired with a different order
on different code paths, leading to the following backtrace:
Reviewed-by: Xin Long <lucien.xin@gmail.com>
======================================================
WARNING: possible circular locking dependency detected
4.15.0+ #301 Not tainted
------------------------------------------------------
syzkaller233489/4179 is trying to acquire lock:
(rtnl_mutex){+.+.}, at: [<0000000048e996fd>] rtnl_lock+0x17/0x20
net/core/rtnetlink.c:74
but task is already holding lock:
(&xt[i].mutex){+.+.}, at: [<00000000328553a2>]
xt_find_table_lock+0x3e/0x3e0 net/netfilter/x_tables.c:1041
which lock already depends on the new lock.
===
Since commit 3f34cfae1230 ("netfilter: on sockopt() acquire sock lock
only in the required scope"), we already acquire the socket lock in
the innermost scope, where needed. In such commit I forgot to remove
the outer-most socket lock from the getsockopt() path, this commit
addresses the issues dropping it now.
v1 -> v2: fix bad subj, added relavant 'fixes' tag
Fixes: 22265a5 ("netfilter: xt_TEE: resolve oif using netdevice notifiers")
Fixes: 202f59a ("netfilter: ipt_CLUSTERIP: do not hold dev")
Fixes: 3f34cfae1230 ("netfilter: on sockopt() acquire sock lock only in the required scope")
Reported-by: syzbot+ddde1c7b7ff7442d7f2d@syzkaller.appspotmail.com
Suggested-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>1 parent b3e456f commit 01ea306
2 files changed
+3
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1567 | 1567 | | |
1568 | 1568 | | |
1569 | 1569 | | |
1570 | | - | |
1571 | | - | |
1572 | | - | |
1573 | | - | |
| 1570 | + | |
1574 | 1571 | | |
1575 | 1572 | | |
1576 | 1573 | | |
| |||
1602 | 1599 | | |
1603 | 1600 | | |
1604 | 1601 | | |
1605 | | - | |
1606 | 1602 | | |
1607 | | - | |
1608 | 1603 | | |
1609 | 1604 | | |
1610 | 1605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1367 | 1367 | | |
1368 | 1368 | | |
1369 | 1369 | | |
1370 | | - | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
| 1370 | + | |
1374 | 1371 | | |
1375 | 1372 | | |
1376 | 1373 | | |
| |||
1409 | 1406 | | |
1410 | 1407 | | |
1411 | 1408 | | |
1412 | | - | |
1413 | | - | |
1414 | | - | |
1415 | | - | |
| 1409 | + | |
1416 | 1410 | | |
1417 | 1411 | | |
1418 | 1412 | | |
| |||
0 commit comments