The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@xxxxxxxxxxxxxxx>. To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y git checkout FETCH_HEAD git cherry-pick -x 987aae75fc1041072941ffb622b45ce2359a99b9 # <resolve conflicts, build, test, etc.> git commit -s git send-email --to '<stable@xxxxxxxxxxxxxxx>' --in-reply-to '2023082644-placard-bullfight-dbc3@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^.. Possible dependencies: 987aae75fc10 ("batman-adv: Hold rtnl lock during MTU update via netlink") 3e15b06eb7e4 ("batman-adv: Add fragmentation mesh genl configuration") a1c8de803296 ("batman-adv: Add distributed_arp_table mesh genl configuration") 43ff6105a527 ("batman-adv: Add bridge_loop_avoidance mesh genl configuration") d7e52506b680 ("batman-adv: Add bonding mesh genl configuration") e43d16b87dc2 ("batman-adv: Add ap_isolation mesh/vlan genl configuration") 9ab4cee5ced9 ("batman-adv: Add aggregated_ogms mesh genl configuration") 49e7e37cd981 ("batman-adv: Prepare framework for vlan genl config") 5c55a40fa801 ("batman-adv: Prepare framework for hardif genl config") 600405135360 ("batman-adv: Prepare framework for mesh genl config") c4a7a8d9bb8f ("batman-adv: Move common genl doit code pre/post hooks") fb69be697916 ("batman-adv: Add inconsistent hardif netlink dump detection") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 987aae75fc1041072941ffb622b45ce2359a99b9 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann <sven@xxxxxxxxxxxxx> Date: Mon, 21 Aug 2023 21:48:48 +0200 Subject: [PATCH] batman-adv: Hold rtnl lock during MTU update via netlink The automatic recalculation of the maximum allowed MTU is usually triggered by code sections which are already rtnl lock protected by callers outside of batman-adv. But when the fragmentation setting is changed via batman-adv's own batadv genl family, then the rtnl lock is not yet taken. But dev_set_mtu requires that the caller holds the rtnl lock because it uses netdevice notifiers. And this code will then fail the check for this lock: RTNL: assertion failed at net/core/dev.c (1953) Cc: stable@xxxxxxxxxxxxxxx Reported-by: syzbot+f8812454d9b3ac00d282@xxxxxxxxxxxxxxxxxxxxxxxxx Fixes: c6a953cce8d0 ("batman-adv: Trigger events for auto adjusted MTU") Signed-off-by: Sven Eckelmann <sven@xxxxxxxxxxxxx> Reviewed-by: Simon Horman <horms@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230821-batadv-missing-mtu-rtnl-lock-v1-1-1c5a7bfe861e@xxxxxxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index ad5714f737be..6efbc9275aec 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -495,7 +495,10 @@ static int batadv_netlink_set_mesh(struct sk_buff *skb, struct genl_info *info) attr = info->attrs[BATADV_ATTR_FRAGMENTATION_ENABLED]; atomic_set(&bat_priv->fragmentation, !!nla_get_u8(attr)); + + rtnl_lock(); batadv_update_min_mtu(bat_priv->soft_iface); + rtnl_unlock(); } if (info->attrs[BATADV_ATTR_GW_BANDWIDTH_DOWN]) {