Skip to content

Commit

Permalink
Merge pull request #141 from openwrtdiy/openwrt-23.05
Browse files Browse the repository at this point in the history
Synchronize official source code
  • Loading branch information
openwrtdiy authored Nov 16, 2024
2 parents 81b7b6d + cd9998e commit 81dc513
Show file tree
Hide file tree
Showing 78 changed files with 622 additions and 288 deletions.
4 changes: 2 additions & 2 deletions include/kernel-5.15
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LINUX_VERSION-5.15 = .167
LINUX_KERNEL_HASH-5.15.167 = b1751f18ece3df08d502dd87a9ab1a317dc0f9486355bf8ee62ba6af0b35da30
LINUX_VERSION-5.15 = .171
LINUX_KERNEL_HASH-5.15.171 = 2953e064d8123c4c22c4fd48011378d73c8b99a3bf3d989e33f4f5c8f82f2a3b
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
From e0f83d268974dab0361d11904dfc9acec53f96a6 Mon Sep 17 00:00:00 2001
From: Eric Dumazet <[email protected]>
Date: Fri, 11 Oct 2024 17:12:17 +0000
Subject: [PATCH] genetlink: hold RCU in genlmsg_mcast()

[ Upstream commit 56440d7ec28d60f8da3bfa09062b3368ff9b16db ]

While running net selftests with CONFIG_PROVE_RCU_LIST=y I saw
one lockdep splat [1].

genlmsg_mcast() uses for_each_net_rcu(), and must therefore hold RCU.

Instead of letting all callers guard genlmsg_multicast_allns()
with a rcu_read_lock()/rcu_read_unlock() pair, do it in genlmsg_mcast().

This also means the @flags parameter is useless, we need to always use
GFP_ATOMIC.

[1]
[10882.424136] =============================
[10882.424166] WARNING: suspicious RCU usage
[10882.424309] 6.12.0-rc2-virtme #1156 Not tainted
[10882.424400] -----------------------------
[10882.424423] net/netlink/genetlink.c:1940 RCU-list traversed in non-reader section!!
[10882.424469]
other info that might help us debug this:

[10882.424500]
rcu_scheduler_active = 2, debug_locks = 1
[10882.424744] 2 locks held by ip/15677:
[10882.424791] #0: ffffffffb6b491b0 (cb_lock){++++}-{3:3}, at: genl_rcv (net/netlink/genetlink.c:1219)
[10882.426334] #1: ffffffffb6b49248 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg (net/netlink/genetlink.c:61 net/netlink/genetlink.c:57 net/netlink/genetlink.c:1209)
[10882.426465]
stack backtrace:
[10882.426805] CPU: 14 UID: 0 PID: 15677 Comm: ip Not tainted 6.12.0-rc2-virtme #1156
[10882.426919] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[10882.427046] Call Trace:
[10882.427131] <TASK>
[10882.427244] dump_stack_lvl (lib/dump_stack.c:123)
[10882.427335] lockdep_rcu_suspicious (kernel/locking/lockdep.c:6822)
[10882.427387] genlmsg_multicast_allns (net/netlink/genetlink.c:1940 (discriminator 7) net/netlink/genetlink.c:1977 (discriminator 7))
[10882.427436] l2tp_tunnel_notify.constprop.0 (net/l2tp/l2tp_netlink.c:119) l2tp_netlink
[10882.427683] l2tp_nl_cmd_tunnel_create (net/l2tp/l2tp_netlink.c:253) l2tp_netlink
[10882.427748] genl_family_rcv_msg_doit (net/netlink/genetlink.c:1115)
[10882.427834] genl_rcv_msg (net/netlink/genetlink.c:1195 net/netlink/genetlink.c:1210)
[10882.427877] ? __pfx_l2tp_nl_cmd_tunnel_create (net/l2tp/l2tp_netlink.c:186) l2tp_netlink
[10882.427927] ? __pfx_genl_rcv_msg (net/netlink/genetlink.c:1201)
[10882.427959] netlink_rcv_skb (net/netlink/af_netlink.c:2551)
[10882.428069] genl_rcv (net/netlink/genetlink.c:1220)
[10882.428095] netlink_unicast (net/netlink/af_netlink.c:1332 net/netlink/af_netlink.c:1357)
[10882.428140] netlink_sendmsg (net/netlink/af_netlink.c:1901)
[10882.428210] ____sys_sendmsg (net/socket.c:729 (discriminator 1) net/socket.c:744 (discriminator 1) net/socket.c:2607 (discriminator 1))

Fixes: 33f72e6f0c67 ("l2tp : multicast notification to the registered listeners")
Signed-off-by: Eric Dumazet <[email protected]>
Cc: James Chapman <[email protected]>
Cc: Tom Parkin <[email protected]>
Cc: Johannes Berg <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/target/target_core_user.c | 2 +-
include/net/genetlink.h | 3 +--
net/l2tp/l2tp_netlink.c | 4 ++--
net/netlink/genetlink.c | 28 ++++++++++++++--------------
net/wireless/nl80211.c | 8 ++------
5 files changed, 20 insertions(+), 25 deletions(-)

--- a/backport-include/net/genetlink.h
+++ b/backport-include/net/genetlink.h
@@ -150,7 +150,7 @@ int genlmsg_multicast(const struct genl_
#define genlmsg_multicast_allns LINUX_BACKPORT(genlmsg_multicast_allns)
int backport_genlmsg_multicast_allns(const struct genl_family *family,
struct sk_buff *skb, u32 portid,
- unsigned int group, gfp_t flags);
+ unsigned int group);

#define genl_family_attrbuf LINUX_BACKPORT(genl_family_attrbuf)
static inline struct nlattr **genl_family_attrbuf(struct genl_family *family)
--- a/compat/backport-genetlink.c
+++ b/compat/backport-genetlink.c
@@ -198,23 +198,23 @@ int genlmsg_multicast(const struct genl_
}
EXPORT_SYMBOL_GPL(genlmsg_multicast);

-static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group,
- gfp_t flags)
+static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group)
{
struct sk_buff *tmp;
struct net *net, *prev = NULL;
bool delivered = false;
int err;

+ rcu_read_lock();
for_each_net_rcu(net) {
if (prev) {
- tmp = skb_clone(skb, flags);
+ tmp = skb_clone(skb, GFP_ATOMIC);
if (!tmp) {
err = -ENOMEM;
goto error;
}
err = nlmsg_multicast(prev->genl_sock, tmp,
- portid, group, flags);
+ portid, group, GFP_ATOMIC);
if (!err)
delivered = true;
else if (err != -ESRCH)
@@ -223,25 +223,29 @@ static int genlmsg_mcast(struct sk_buff

prev = net;
}
+ err = nlmsg_multicast(prev->genl_sock, skb, portid, group, GFP_ATOMIC);
+
+ rcu_read_unlock();

- err = nlmsg_multicast(prev->genl_sock, skb, portid, group, flags);
if (!err)
delivered = true;
else if (err != -ESRCH)
return err;
return delivered ? 0 : -ESRCH;
error:
+ rcu_read_unlock();
+
kfree_skb(skb);
return err;
}

int backport_genlmsg_multicast_allns(const struct genl_family *family,
struct sk_buff *skb, u32 portid,
- unsigned int group, gfp_t flags)
+ unsigned int group)
{
group = __backport_genl_group(family, group);
if (group == INVALID_GROUP)
return -EINVAL;
- return genlmsg_mcast(skb, portid, group, flags);
+ return genlmsg_mcast(skb, portid, group);
}
EXPORT_SYMBOL_GPL(backport_genlmsg_multicast_allns);
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -17627,10 +17627,8 @@ void nl80211_common_reg_change_event(enu

genlmsg_end(msg, hdr);

- rcu_read_lock();
genlmsg_multicast_allns(&nl80211_fam, msg, 0,
- NL80211_MCGRP_REGULATORY, GFP_ATOMIC);
- rcu_read_unlock();
+ NL80211_MCGRP_REGULATORY);

return;

@@ -18248,10 +18246,8 @@ void nl80211_send_beacon_hint_event(stru

genlmsg_end(msg, hdr);

- rcu_read_lock();
genlmsg_multicast_allns(&nl80211_fam, msg, 0,
- NL80211_MCGRP_REGULATORY, GFP_ATOMIC);
- rcu_read_unlock();
+ NL80211_MCGRP_REGULATORY);

return;

Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Signed-off-by: Johannes Berg <[email protected]>
void cfg80211_autodisconnect_wk(struct work_struct *work);
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -18024,7 +18024,8 @@ void nl80211_send_roamed(struct cfg80211
@@ -18022,7 +18022,8 @@ void nl80211_send_roamed(struct cfg80211
}

void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev,
Expand All @@ -107,7 +107,7 @@ Signed-off-by: Johannes Berg <[email protected]>
{
struct sk_buff *msg;
void *hdr;
@@ -18044,6 +18045,11 @@ void nl80211_send_port_authorized(struct
@@ -18042,6 +18043,11 @@ void nl80211_send_port_authorized(struct
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid))
goto nla_put_failure;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Signed-off-by: Johannes Berg <[email protected]>
/* use driver's channel switch callback */
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -19085,7 +19085,7 @@ static void nl80211_ch_switch_notify(str
@@ -19081,7 +19081,7 @@ static void nl80211_ch_switch_notify(str
struct cfg80211_chan_def *chandef,
gfp_t gfp,
enum nl80211_commands notif,
Expand All @@ -141,7 +141,7 @@ Signed-off-by: Johannes Berg <[email protected]>
{
struct wireless_dev *wdev = netdev->ieee80211_ptr;
struct sk_buff *msg;
@@ -19119,6 +19119,9 @@ static void nl80211_ch_switch_notify(str
@@ -19115,6 +19115,9 @@ static void nl80211_ch_switch_notify(str
goto nla_put_failure;
}

Expand All @@ -151,7 +151,7 @@ Signed-off-by: Johannes Berg <[email protected]>
genlmsg_end(msg, hdr);

genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
@@ -19131,7 +19134,7 @@ static void nl80211_ch_switch_notify(str
@@ -19127,7 +19130,7 @@ static void nl80211_ch_switch_notify(str

void cfg80211_ch_switch_notify(struct net_device *dev,
struct cfg80211_chan_def *chandef,
Expand All @@ -160,7 +160,7 @@ Signed-off-by: Johannes Berg <[email protected]>
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
@@ -19140,7 +19143,7 @@ void cfg80211_ch_switch_notify(struct ne
@@ -19136,7 +19139,7 @@ void cfg80211_ch_switch_notify(struct ne
ASSERT_WDEV_LOCK(wdev);
WARN_INVALID_LINK_ID(wdev, link_id);

Expand All @@ -169,7 +169,7 @@ Signed-off-by: Johannes Berg <[email protected]>

switch (wdev->iftype) {
case NL80211_IFTYPE_STATION:
@@ -19168,14 +19171,15 @@ void cfg80211_ch_switch_notify(struct ne
@@ -19164,14 +19167,15 @@ void cfg80211_ch_switch_notify(struct ne
cfg80211_sched_dfs_chan_update(rdev);

nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL,
Expand All @@ -187,7 +187,7 @@ Signed-off-by: Johannes Berg <[email protected]>
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
@@ -19184,11 +19188,13 @@ void cfg80211_ch_switch_started_notify(s
@@ -19180,11 +19184,13 @@ void cfg80211_ch_switch_started_notify(s
ASSERT_WDEV_LOCK(wdev);
WARN_INVALID_LINK_ID(wdev, link_id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ SVN-Revision: 35130
EXPORT_SYMBOL(xfrm_parse_spi);
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4201,14 +4201,16 @@ static bool tcp_parse_aligned_timestamp(
@@ -4228,14 +4228,16 @@ static bool tcp_parse_aligned_timestamp(
{
const __be32 *ptr = (const __be32 *)(th + 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell <[email protected]>

--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -698,7 +698,7 @@ MODULE_DEVICE_TABLE(spi, spidev_spi_ids)
@@ -699,7 +699,7 @@ MODULE_DEVICE_TABLE(spi, spidev_spi_ids)
*/
static int spidev_of_check(struct device *dev)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Avoids the 0x40000 cycles of warmup again if firmware has already used it

--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -106,8 +106,10 @@ static int bcm2835_rng_init(struct hwrng
@@ -108,8 +108,10 @@ static int bcm2835_rng_init(struct hwrng
}

/* set warm-up count & enable */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ board_bcm2835: Remove coherent dma pool increase - API has gone

- ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0),
+ ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
bcm2835_mbox_irq, 0, dev_name(dev), mbox);
bcm2835_mbox_irq, IRQF_NO_SUSPEND, dev_name(dev),
mbox);
if (ret) {
dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n",
@@ -194,7 +197,18 @@ static struct platform_driver bcm2835_mb
@@ -195,7 +198,18 @@ static struct platform_driver bcm2835_mb
},
.probe = bcm2835_mbox_probe,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Signed-off-by: Jonathan Bell <[email protected]>

--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1633,6 +1633,109 @@ command_cleanup:
@@ -1642,6 +1642,109 @@ command_cleanup:
}

/*
Expand Down Expand Up @@ -125,7 +125,7 @@ Signed-off-by: Jonathan Bell <[email protected]>
* non-error returns are a promise to giveback() the urb later
* we drop ownership so next owner (or urb unlink) can get it
*/
@@ -5474,6 +5577,7 @@ static const struct hc_driver xhci_hc_dr
@@ -5488,6 +5591,7 @@ static const struct hc_driver xhci_hc_dr
.endpoint_reset = xhci_endpoint_reset,
.check_bandwidth = xhci_check_bandwidth,
.reset_bandwidth = xhci_reset_bandwidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell <[email protected]>
#define USB_VENDOR_ID_BELKIN 0x050d
#define USB_DEVICE_ID_FLIP_KVM 0x3201

@@ -1332,6 +1335,9 @@
@@ -1337,6 +1340,9 @@
#define USB_VENDOR_ID_XAT 0x2505
#define USB_DEVICE_ID_XAT_CSR 0x0220

Expand Down
Loading

0 comments on commit 81dc513

Please sign in to comment.