batctl: update to version 2023.3
[feed/routing.git] / batman-adv / patches / 0003-batman-adv-Hold-rtnl-lock-during-MTU-update-via-netl.patch
1 From: Sven Eckelmann <sven@narfation.org>
2 Date: Mon, 21 Aug 2023 21:48:48 +0200
3 Subject: batman-adv: Hold rtnl lock during MTU update via netlink
4
5 The automatic recalculation of the maximum allowed MTU is usually triggered
6 by code sections which are already rtnl lock protected by callers outside
7 of batman-adv. But when the fragmentation setting is changed via
8 batman-adv's own batadv genl family, then the rtnl lock is not yet taken.
9
10 But dev_set_mtu requires that the caller holds the rtnl lock because it
11 uses netdevice notifiers. And this code will then fail the check for this
12 lock:
13
14 RTNL: assertion failed at net/core/dev.c (1953)
15
16 Cc: stable@vger.kernel.org
17 Reported-by: syzbot+f8812454d9b3ac00d282@syzkaller.appspotmail.com
18 Fixes: 27c4d7c1c7fa ("batman-adv: Trigger events for auto adjusted MTU")
19 Reviewed-by: Simon Horman <horms@kernel.org>
20 Signed-off-by: Sven Eckelmann <sven@narfation.org>
21
22 --- a/net/batman-adv/netlink.c
23 +++ b/net/batman-adv/netlink.c
24 @@ -495,7 +495,10 @@ static int batadv_netlink_set_mesh(struc
25 attr = info->attrs[BATADV_ATTR_FRAGMENTATION_ENABLED];
26
27 atomic_set(&bat_priv->fragmentation, !!nla_get_u8(attr));
28 +
29 + rtnl_lock();
30 batadv_update_min_mtu(bat_priv->soft_iface);
31 + rtnl_unlock();
32 }
33
34 if (info->attrs[BATADV_ATTR_GW_BANDWIDTH_DOWN]) {