wifi: rtw88: phy: fix warning of possible buffer overflow
Subsystems (11)
Sasha Levin
maintainerPATCH 1/46 wifi: rtw88: phy: fix warning of possible buffer overflow
From: Zong-Zhe Yang <[email protected]>
[ Upstream commit 86331c7e0cd819bf0c1d0dcf895e0c90b0aa9a6f ]
reported by smatch
phy.c:854 rtw_phy_linear_2_db() error: buffer overflow 'db_invert_table[i]' 8 <= 8 (assuming for loop doesn't break)
However, it seems to be a false alarm because we prevent it originally via
if (linear >= db_invert_table[11][7])
return 96; /* maximum 96 dB */Still, we adjust the code to be more readable and avoid smatch warning.
--- drivers/net/wireless/realtek/rtw88/phy.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/net/wireless/realtek/rtw88/phy.c +8 -13
@@ -751,23 +751,18 @@ static u8 rtw_phy_linear_2_db(u64 linear)u8 j;u32 dB; -if (linear >= db_invert_table[11 ][7 ]) -return 96 ;/* maximum 96 dB */ -for (i =0 ; i <12 ; i++) { -if (i <=2 && (linear <<FRAC_BITS ) <= db_invert_table[i][7 ]) -break ; -else if (i >2 && linear <= db_invert_table[i][7 ]) -break ; +for (j =0 ; j <8 ; j++) { +if (i <=2 && (linear <<FRAC_BITS ) <= db_invert_table[i][j]) + goto cnt; +else if (i >2 && linear <= db_invert_table[i][j]) + goto cnt; + } } -for (j =0 ; j <8 ; j++) { -if (i <=2 && (linear <<FRAC_BITS ) <= db_invert_table[i][j]) -break ; -else if (i >2 && linear <= db_invert_table[i][j]) -break ; - } +return 96 ;/* maximum 96 dB */ +cnt:if (j ==0 && i ==0 ) goto end;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/46 wifi: brcmfmac: fix invalid address access when enabling SCAN log level
From: Wright Feng <[email protected]>
[ Upstream commit aa666b68e73fc06d83c070d96180b9010cf5a960 ]
The variable i is changed when setting random MAC address and causes invalid address access when printing the value of pi->reqs[i]->reqid.
We replace reqs index with ri to fix the issue.
[ 136.726473] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ 136.737365] Mem abort info: [ 136.740172] ESR = 0x96000004 [ 136.743359] Exception class = DABT (current EL), IL = 32 bits [ 136.749294] SET = 0, FnV = 0 [ 136.752481] EA = 0, S1PTW = 0 [ 136.755635] Data abort info: [ 136.758514] ISV = 0, ISS = 0x00000004 [ 136.762487] CM = 0, WnR = 0 [ 136.765522] user pgtable: 4k pages, 48-bit VAs, pgdp = 000000005c4e2577 [ 136.772265] [0000000000000000] pgd=0000000000000000 [ 136.777160] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 136.782732] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) compat(O) [ 136.789788] Process wificond (pid: 3175, stack limit = 0x00000000053048fb) [ 136.796664] CPU: 3 PID: 3175 Comm: wificond Tainted: G O 4.19.42-00001-g531a5f5 #1 [ 136.805532] Hardware name: Freescale i.MX8MQ EVK (DT) [ 136.810584] pstate: 60400005 (nZCv daif +PAN -UAO) [ 136.815429] pc : brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.821811] lr : brcmf_pno_config_sched_scans+0x67c/0xa80 [brcmfmac] [ 136.828162] sp : ffff00000e9a3880 [ 136.831475] x29: ffff00000e9a3890 x28: ffff800020543400 [ 136.836786] x27: ffff8000b1008880 x26: ffff0000012bf6a0 [ 136.842098] x25: ffff80002054345c x24: ffff800088d22400 [ 136.847409] x23: ffff0000012bf638 x22: ffff0000012bf6d8 [ 136.852721] x21: ffff8000aced8fc0 x20: ffff8000ac164400 [ 136.858032] x19: ffff00000e9a3946 x18: 0000000000000000 [ 136.863343] x17: 0000000000000000 x16: 0000000000000000 [ 136.868655] x15: ffff0000093f3b37 x14: 0000000000000050 [ 136.873966] x13: 0000000000003135 x12: 0000000000000000 [ 136.879277] x11: 0000000000000000 x10: ffff000009a61888 [ 136.884589] x9 : 000000000000000f x8 : 0000000000000008 [ 136.889900] x7 : 303a32303d726464 x6 : ffff00000a1f957d [ 136.895211] x5 : 0000000000000000 x4 : ffff00000e9a3942 [ 136.900523] x3 : 0000000000000000 x2 : ffff0000012cead8 [ 136.905834] x1 : ffff0000012bf6d8 x0 : 0000000000000000 [ 136.911146] Call trace: [ 136.913623] brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.919658] brcmf_pno_start_sched_scan+0xa4/0x118 [brcmfmac] [ 136.925430] brcmf_cfg80211_sched_scan_start+0x80/0xe0 [brcmfmac] [ 136.931636] nl80211_start_sched_scan+0x140/0x308 [cfg80211] [ 136.937298] genl_rcv_msg+0x358/0x3f4 [ 136.940960] netlink_rcv_skb+0xb4/0x118 [ 136.944795] genl_rcv+0x34/0x48 [ 136.947935] netlink_unicast+0x264/0x300 [ 136.951856] netlink_sendmsg+0x2e4/0x33c [ 136.955781] __sys_sendto+0x120/0x19c
--- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +6 -6
@@ -158,12 +158,12 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi)struct brcmf_pno_macaddr_le pfn_mac;u8 *mac_addr =NULL ;u8 *mac_mask =NULL ; -int err, i; +int err, i, ri; -for (i =0 ; i < pi->n_reqs; i++) -if (pi->reqs[i]->flags &NL80211_SCAN_FLAG_RANDOM_ADDR ) { - mac_addr = pi->reqs[i]->mac_addr; - mac_mask = pi->reqs[i]->mac_addr_mask; +for (ri =0 ; ri < pi->n_reqs; ri++) +if (pi->reqs[ri]->flags &NL80211_SCAN_FLAG_RANDOM_ADDR ) { + mac_addr = pi->reqs[ri]->mac_addr; + mac_mask = pi->reqs[ri]->mac_addr_mask;break ; }
@@ -185,7 +185,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) pfn_mac.mac[0 ] |=0x02 ;brcmf_dbg (SCAN ,"enabling random mac: reqid=%llu mac=%pM\n" , - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err =brcmf_fil_iovar_data_set (ifp,"pfn_macaddr" , &pfn_mac,sizeof (pfn_mac));if (err)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/46 bpftool: Clear errno after libcap's checks
In reply to Sasha LevinFrom: Quentin Monnet <[email protected]>
[ Upstream commit cea558855c39b7f1f02ff50dcf701ca6596bc964 ]
When bpftool is linked against libcap, the library runs a "constructor" function to compute the number of capabilities of the running kernel [0], at the beginning of the execution of the program. As part of this, it performs multiple calls to prctl(). Some of these may fail, and set errno to a non-zero value:
# strace -e prctl ./bpftool version
prctl(PR_CAPBSET_READ, CAP_MAC_OVERRIDE) = 1
prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, CAP_CHECKPOINT_RESTORE) = 1
prctl(PR_CAPBSET_READ, 0x2c /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x2a /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x29 /* CAP_??? */) = -1 EINVAL (Invalid argument)
** fprintf added at the top of main(): we have errno == 1
./bpftool v7.0.0
using libbpf v1.0
features: libbfd, libbpf_strict, skeletons
+++ exited with 0 +++This has been addressed in libcap 2.63 [1], but until this version is available everywhere, we can fix it on bpftool side.
Let's clean errno at the beginning of the main() function, to make sure that these checks do not interfere with the batch mode, where we error out if errno is set after a bpftool command.
[0] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/tree/libcap/cap_alloc.c?h=libcap-2.65#n20
[1] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=f25a1b7e69f7b33e6afb58b3e38f3450b7d2d9a0
--- tools/bpf/bpftool/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
tools/bpf/bpftool/main.c +10 -0
@@ -404,6 +404,16 @@ int main(int argc, char **argv)setlinebuf (stdout); +#ifdef USE_LIBCAP +/* Libcap < 2.63 hooks before main() to compute the number of +* capabilities of the running kernel, and doing so it calls prctl() +* which may fail and set errno to non-zero. +* Let's reset errno to make sure this does not interfere with the +* batch mode. +*/ + errno =0 ; +#endif + last_do_help = do_help; pretty_output = false; json_output = false;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/46 ice: set tx_tstamps when creating new Tx rings via ethtool
In reply to Sasha LevinFrom: Jacob Keller <[email protected]>
[ Upstream commit b3b173745c8cab1e24d6821488b60abed3acb24d ]
When the user changes the number of queues via ethtool, the driver allocates new rings. This allocation did not initialize tx_tstamps. This results in the tx_tstamps field being zero (due to kcalloc allocation), and would result in a NULL pointer dereference when attempting a transmit timestamp on the new ring.
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -0
@@ -2788,6 +2788,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) tx_rings[i].count = new_tx_cnt; tx_rings[i].desc =NULL ; tx_rings[i].tx_buf =NULL ; + tx_rings[i].tx_tstamps = &pf->ptp.port.tx; err =ice_setup_tx_ring (&tx_rings[i]);if (err) {while (i--)
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Sasha Levin
maintainerPATCH 5/46 net: ethernet: ti: davinci_mdio: Add workaround for errata i2329
In reply to Sasha LevinFrom: Ravi Gunasekaran <[email protected]>
[ Upstream commit d04807b80691c6041ca8e3dcf1870d1bf1082c22 ]
On the CPSW and ICSS peripherals, there is a possibility that the MDIO interface returns corrupt data on MDIO reads or writes incorrect data on MDIO writes. There is also a possibility for the MDIO interface to become unavailable until the next peripheral reset.
The workaround is to configure the MDIO in manual mode and disable the MDIO state machine and emulate the MDIO protocol by reading and writing appropriate fields in MDIO_MANUAL_IF_REG register of the MDIO controller to manipulate the MDIO clock and data pins.
More details about the errata i2329 and the workaround is available in:
https://www.ti.com/lit/er/sprz487a/sprz487a.pdf
Add implementation to disable MDIO state machine, configure MDIO in manual mode and achieve MDIO read and writes via MDIO Bitbanging
--- drivers/net/ethernet/ti/davinci_mdio.c | 242 +++++++++++++++++++++++-- 1 file changed, 231 insertions(+), 11 deletions(-)
drivers/net/ethernet/ti/davinci_mdio.c +231 -11
@@ -26,6 +26,8 @@#include <linux/of_device.h> #include <linux/of_mdio.h> #include <linux/pinctrl/consumer.h> +#include <linux/mdio-bitbang.h> +#include <linux/sys_soc.h> /* * This timeout definition is a worst-case ultra defensive measure against
@@ -41,6 +43,7 @@struct davinci_mdio_of_param {int autosuspend_delay_ms; +bool manual_mode; };struct davinci_mdio_regs {
@@ -49,6 +52,15 @@ struct davinci_mdio_regs {#define CONTROL_IDLE BIT(31)#define CONTROL_ENABLE BIT(30)#define CONTROL_MAX_DIV (0xffff) +#define CONTROL_CLKDIV GENMASK(15, 0) + +#define MDIO_MAN_MDCLK_O BIT(2) +#define MDIO_MAN_OE BIT(1) +#define MDIO_MAN_PIN BIT(0) +#define MDIO_MANUALMODE BIT(31) + +#define MDIO_PIN 0 +u32 alive;u32 link;
@@ -59,7 +71,9 @@ struct davinci_mdio_regs {u32 userintmasked;u32 userintmaskset;u32 userintmaskclr; -u32 __reserved_1[20 ]; +u32 manualif; +u32 poll; +u32 __reserved_1[18 ];struct {u32 access;
@@ -79,6 +93,7 @@ static const struct mdio_platform_data default_pdata = {struct davinci_mdio_data {struct mdio_platform_data pdata; +struct mdiobb_ctrl bb_ctrl;struct davinci_mdio_regs __iomem *regs;struct clk *clk;struct device *dev;
@@ -90,6 +105,7 @@ struct davinci_mdio_data {*/ bool skip_scan;u32 clk_div; +bool manual_mode; };static void davinci_mdio_init_clk (struct davinci_mdio_data *data)
@@ -128,9 +144,122 @@ static void davinci_mdio_enable(struct davinci_mdio_data *data)writel (data->clk_div |CONTROL_ENABLE , &data->regs->control); } -static int davinci_mdio_reset (struct mii_bus *bus) +static void davinci_mdio_disable (struct davinci_mdio_data *data) +{ +u32 reg; + +/* Disable MDIO state machine */ + reg =readl (&data->regs->control); + + reg &= ~CONTROL_CLKDIV ; + reg |= data->clk_div; + + reg &= ~CONTROL_ENABLE ; +writel (reg, &data->regs->control); +} + +static void davinci_mdio_enable_manual_mode (struct davinci_mdio_data *data) +{ +u32 reg; +/* set manual mode */ + reg =readl (&data->regs->poll); + reg |=MDIO_MANUALMODE ; +writel (reg, &data->regs->poll); +} + +static void davinci_set_mdc (struct mdiobb_ctrl *ctrl,int level) +{ +struct davinci_mdio_data *data; +u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg =readl (&data->regs->manualif); + +if (level) + reg |=MDIO_MAN_MDCLK_O ; +else + reg &= ~MDIO_MAN_MDCLK_O ; + +writel (reg, &data->regs->manualif); +} + +static void davinci_set_mdio_dir (struct mdiobb_ctrl *ctrl,int output) +{ +struct davinci_mdio_data *data; +u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg =readl (&data->regs->manualif); + +if (output) + reg |=MDIO_MAN_OE ; +else + reg &= ~MDIO_MAN_OE ; + +writel (reg, &data->regs->manualif); +} + +static void davinci_set_mdio_data (struct mdiobb_ctrl *ctrl,int value) +{ +struct davinci_mdio_data *data; +u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg =readl (&data->regs->manualif); + +if (value) + reg |=MDIO_MAN_PIN ; +else + reg &= ~MDIO_MAN_PIN ; + +writel (reg, &data->regs->manualif); +} + +static int davinci_get_mdio_data (struct mdiobb_ctrl *ctrl) +{ +struct davinci_mdio_data *data; +unsigned long reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg =readl (&data->regs->manualif); +return test_bit (MDIO_PIN , ®); +} + +static int davinci_mdiobb_read (struct mii_bus *bus,int phy,int reg) +{ +int ret; + + ret =pm_runtime_resume_and_get (bus->parent); +if (ret <0 ) +return ret; + + ret =mdiobb_read (bus, phy, reg); + +pm_runtime_mark_last_busy (bus->parent); +pm_runtime_put_autosuspend (bus->parent); + +return ret; +} + +static int davinci_mdiobb_write (struct mii_bus *bus,int phy,int reg, +u16 val) +{ +int ret; + + ret =pm_runtime_resume_and_get (bus->parent); +if (ret <0 ) +return ret; + + ret =mdiobb_write (bus, phy, reg, val); + +pm_runtime_mark_last_busy (bus->parent); +pm_runtime_put_autosuspend (bus->parent); + +return ret; +} + +static int davinci_mdio_common_reset (struct davinci_mdio_data *data) { -struct davinci_mdio_data *data = bus->priv;u32 phy_mask, ver;int ret;
@@ -140,6 +269,11 @@ static int davinci_mdio_reset(struct mii_bus *bus)return ret; } +if (data->manual_mode) { +davinci_mdio_disable (data); +davinci_mdio_enable_manual_mode (data); + } +/* wait for scan logic to settle */ msleep (PHY_MAX_ADDR * data->access_time);
@@ -173,6 +307,23 @@ static int davinci_mdio_reset(struct mii_bus *bus)return 0 ; } +static int davinci_mdio_reset (struct mii_bus *bus) +{ +struct davinci_mdio_data *data = bus->priv; + +return davinci_mdio_common_reset (data); +} + +static int davinci_mdiobb_reset (struct mii_bus *bus) +{ +struct mdiobb_ctrl *ctrl = bus->priv; +struct davinci_mdio_data *data; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + +return davinci_mdio_common_reset (data); +} +/* wait until hardware is ready for another user access */ static inline int wait_for_user_access (struct davinci_mdio_data *data) {
@@ -324,6 +475,28 @@ static int davinci_mdio_probe_dt(struct mdio_platform_data *data,return 0 ; } +struct k3_mdio_soc_data { +bool manual_mode; +}; + +static const struct k3_mdio_soc_data am65_mdio_soc_data = { + .manual_mode = true, +}; + +static const struct soc_device_attribute k3_mdio_socinfo[] = { + { .family ="AM62X" , .revision ="SR1.0" , .data = &am65_mdio_soc_data }, + { .family ="AM64X" , .revision ="SR1.0" , .data = &am65_mdio_soc_data }, + { .family ="AM64X" , .revision ="SR2.0" , .data = &am65_mdio_soc_data }, + { .family ="AM65X" , .revision ="SR1.0" , .data = &am65_mdio_soc_data }, + { .family ="AM65X" , .revision ="SR2.0" , .data = &am65_mdio_soc_data }, + { .family ="J7200" , .revision ="SR1.0" , .data = &am65_mdio_soc_data }, + { .family ="J7200" , .revision ="SR2.0" , .data = &am65_mdio_soc_data }, + { .family ="J721E" , .revision ="SR1.0" , .data = &am65_mdio_soc_data }, + { .family ="J721E" , .revision ="SR2.0" , .data = &am65_mdio_soc_data }, + { .family ="J721S2" , .revision ="SR1.0" , .data = &am65_mdio_soc_data}, + {/* sentinel */ }, +}; +#if IS_ENABLED (CONFIG_OF )static const struct davinci_mdio_of_param of_cpsw_mdio_data = { .autosuspend_delay_ms = 100,
@@ -337,6 +510,14 @@ static const struct of_device_id davinci_mdio_of_mtable[] = {MODULE_DEVICE_TABLE (of, davinci_mdio_of_mtable);#endif +static const struct mdiobb_ops davinci_mdiobb_ops = { + .owner =THIS_MODULE , + .set_mdc = davinci_set_mdc, + .set_mdio_dir = davinci_set_mdio_dir, + .set_mdio_data = davinci_set_mdio_data, + .get_mdio_data = davinci_get_mdio_data, +}; +static int davinci_mdio_probe (struct platform_device *pdev) {struct mdio_platform_data *pdata =dev_get_platdata (&pdev->dev);
@@ -351,7 +532,26 @@ static int davinci_mdio_probe(struct platform_device *pdev)if (!data)return -ENOMEM ; - data->bus =devm_mdiobus_alloc (dev); + data->manual_mode = false; + data->bb_ctrl.ops = &davinci_mdiobb_ops; + +if (IS_ENABLED (CONFIG_OF ) && dev->of_node) { +const struct soc_device_attribute *soc_match_data; + + soc_match_data =soc_device_match (k3_mdio_socinfo); +if (soc_match_data && soc_match_data->data) { +const struct k3_mdio_soc_data *socdata = + soc_match_data->data; + + data->manual_mode = socdata->manual_mode; + } + } + +if (data->manual_mode) + data->bus =alloc_mdio_bitbang (&data->bb_ctrl); +else + data->bus =devm_mdiobus_alloc (dev); +if (!data->bus) {dev_err (dev,"failed to alloc mii bus\n" );return -ENOMEM ;
@@ -377,11 +577,20 @@ static int davinci_mdio_probe(struct platform_device *pdev) } data->bus->name =dev_name (dev); - data->bus->read = davinci_mdio_read; - data->bus->write = davinci_mdio_write; - data->bus->reset = davinci_mdio_reset; + +if (data->manual_mode) { + data->bus->read = davinci_mdiobb_read; + data->bus->write = davinci_mdiobb_write; + data->bus->reset = davinci_mdiobb_reset; + +dev_info (dev,"Configuring MDIO in manual mode\n" ); + }else { + data->bus->read = davinci_mdio_read; + data->bus->write = davinci_mdio_write; + data->bus->reset = davinci_mdio_reset; + data->bus->priv = data; + } data->bus->parent = dev; - data->bus->priv = data; data->clk =devm_clk_get (dev,"fck" );if (IS_ERR (data->clk)) {
@@ -439,9 +648,13 @@ static int davinci_mdio_remove(struct platform_device *pdev) {struct davinci_mdio_data *data =platform_get_drvdata (pdev); -if (data->bus) +if (data->bus) {mdiobus_unregister (data->bus); +if (data->manual_mode) +free_mdio_bitbang (data->bus); + } +pm_runtime_dont_use_autosuspend (&pdev->dev);pm_runtime_disable (&pdev->dev);
@@ -458,7 +671,9 @@ static int davinci_mdio_runtime_suspend(struct device *dev) ctrl =readl (&data->regs->control); ctrl &= ~CONTROL_ENABLE ;writel (ctrl, &data->regs->control); -wait_for_idle (data); + +if (!data->manual_mode) +wait_for_idle (data);return 0 ; }
@@ -467,7 +682,12 @@ static int davinci_mdio_runtime_resume(struct device *dev) {struct davinci_mdio_data *data =dev_get_drvdata (dev); -davinci_mdio_enable (data); +if (data->manual_mode) { +davinci_mdio_disable (data); +davinci_mdio_enable_manual_mode (data); + }else { +davinci_mdio_enable (data); + }return 0 ; }#endif
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/46 openvswitch: Fix double reporting of drops in dropwatch
In reply to Sasha LevinFrom: Mike Pattrick <[email protected]>
[ Upstream commit 1100248a5c5ccd57059eb8d02ec077e839a23826 ]
Frames sent to userspace can be reported as dropped in ovs_dp_process_packet, however, if they are dropped in the netlink code then netlink_attachskb will report the same frame as dropped.
This patch checks for error codes which indicate that the frame has already been freed.
--- net/openvswitch/datapath.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
net/openvswitch/datapath.c +10 -3
@@ -251,10 +251,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) upcall.mru =OVS_CB (skb)->mru; error =ovs_dp_upcall (dp, skb, key, &upcall,0 ); -if (unlikely (error)) -kfree_skb (skb); -else +switch (error) { +case 0 : +case -EAGAIN : +case -ERESTARTSYS : +case -EINTR :consume_skb (skb); +break ; +default : +kfree_skb (skb); +break ; + } stats_counter = &stats->n_missed; goto out; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 7/46 openvswitch: Fix overreporting of drops in dropwatch
In reply to Sasha LevinFrom: Mike Pattrick <[email protected]>
[ Upstream commit c21ab2afa2c64896a7f0e3cbc6845ec63dcfad2e ]
Currently queue_userspace_packet will call kfree_skb for all frames, whether or not an error occurred. This can result in a single dropped frame being reported as multiple drops in dropwatch. This functions caller may also call kfree_skb in case of an error. This patch will consume the skbs instead and allow caller's to use kfree_skb.
--- net/openvswitch/datapath.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/openvswitch/datapath.c +3 -2
@@ -557,8 +557,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, out:if (err)skb_tx_error (skb); -kfree_skb (user_skb); -kfree_skb (nskb); +consume_skb (user_skb); +consume_skb (nskb); +return err; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/46 tcp: annotate data-race around tcp_md5sig_pool_populated
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit aacd467c0a576e5e44d2de4205855dc0fe43f6fb ]
tcp_md5sig_pool_populated can be read while another thread changes its value.
The race has no consequence because allocations are protected with tcp_md5sig_mutex.
This patch adds READ_ONCE() and WRITE_ONCE() to document the race and silence KCSAN.
--- net/ipv4/tcp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/ipv4/tcp.c +10 -4
@@ -4329,12 +4329,16 @@ static void __tcp_alloc_md5sig_pool(void)* to memory. See smp_rmb() in tcp_get_md5sig_pool() */ smp_wmb (); - tcp_md5sig_pool_populated = true; +/* Paired with READ_ONCE() from tcp_alloc_md5sig_pool() +* and tcp_get_md5sig_pool(). +*/ +WRITE_ONCE (tcp_md5sig_pool_populated, true); }bool tcp_alloc_md5sig_pool (void ) { -if (unlikely (!tcp_md5sig_pool_populated)) { +/* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ +if (unlikely (!READ_ONCE (tcp_md5sig_pool_populated))) {mutex_lock (&tcp_md5sig_mutex);if (!tcp_md5sig_pool_populated) {
@@ -4345,7 +4349,8 @@ bool tcp_alloc_md5sig_pool(void)mutex_unlock (&tcp_md5sig_mutex); } -return tcp_md5sig_pool_populated; +/* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ +return READ_ONCE (tcp_md5sig_pool_populated); }EXPORT_SYMBOL (tcp_alloc_md5sig_pool);
@@ -4361,7 +4366,8 @@ struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) {local_bh_disable (); -if (tcp_md5sig_pool_populated) { +/* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ +if (READ_ONCE (tcp_md5sig_pool_populated)) {/* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */ smp_rmb ();return this_cpu_ptr (&tcp_md5sig_pool);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 9/46 micrel: ksz8851: fixes struct pointer issue
In reply to Sasha LevinFrom: Jerry Ray <[email protected]>
[ Upstream commit fef5de753ff01887cfa50990532c3890fccb9338 ]
Issue found during code review. This bug has no impact as long as the ks8851_net structure is the first element of the ks8851_net_spi structure. As long as the offset to the ks8851_net struct is zero, the container_of() macro is subtracting 0 and therefore no damage done. But if the ks8851_net_spi struct is ever modified such that the ks8851_net struct within it is no longer the first element of the struct, then the bug would manifest itself and cause problems.
struct ks8851_net is contained within ks8851_net_spi. ks is contained within kss.
kss is the priv_data of the netdev structure.
--- drivers/net/ethernet/micrel/ks8851_spi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/micrel/ks8851_spi.c +2 -3
@@ -413,7 +413,8 @@ static int ks8851_probe_spi(struct spi_device *spi) spi->bits_per_word =8 ; - ks =netdev_priv (netdev); + kss =netdev_priv (netdev); + ks = &kss->ks8851; ks->lock = ks8851_lock_spi; ks->unlock = ks8851_unlock_spi;
@@ -433,8 +434,6 @@ static int ks8851_probe_spi(struct spi_device *spi) IRQ_RXPSI) /* RX process stop */ ks->rc_ier = STD_IRQ; - kss =to_ks8851_spi (ks); - kss->spidev = spi;mutex_init (&kss->lock);INIT_WORK (&kss->tx_work, ks8851_tx_work);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/46 genetlink: hold read cb_lock during iteration of genl_fam_idr in genl_bind()
In reply to Sasha LevinFrom: Jiri Pirko <[email protected]>
[ Upstream commit 8f1948bdcf2fb50e9092c0950c3c9ac591382101 ]
In genl_bind(), currently genl_lock and write cb_lock are taken for iteration of genl_fam_idr and processing of static values stored in struct genl_family. Take just read cb_lock for this task as it is sufficient to guard the idr and the struct against concurrent genl_register/unregister_family() calls.
This will allow to run genl command processing in genl_rcv() and mnl_socket_setsockopt(.., NETLINK_ADD_MEMBERSHIP, ..) in parallel.
--- net/netlink/genetlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netlink/genetlink.c +2 -2
@@ -1362,7 +1362,7 @@ static int genl_bind(struct net *net, int group)unsigned int id;int ret =0 ; -genl_lock_all (); +down_read (&cb_lock);idr_for_each_entry (&genl_fam_idr, family, id) {const struct genl_multicast_group *grp;
@@ -1383,7 +1383,7 @@ static int genl_bind(struct net *net, int group)break ; } -genl_unlock_all (); +up_read (&cb_lock);return ret; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 11/46 x86/mce: Retrieve poison range from hardware
In reply to Sasha LevinFrom: Jane Chu <[email protected]>
[ Upstream commit f9781bb18ed828e7b83b7bac4a4ad7cd497ee7d7 ]
When memory poison consumption machine checks fire, MCE notifier handlers like nfit_handle_mce() record the impacted physical address range which is reported by the hardware in the MCi_MISC MSR. The error information includes data about blast radius, i.e. how many cachelines did the hardware determine are impacted. A recent change
7917f9cdb503 ("acpi/nfit: rely on mce->misc to determine poison granularity")
updated nfit_handle_mce() to stop hard coding the blast radius value of 1 cacheline, and instead rely on the blast radius reported in 'struct mce' which can be up to 4K (64 cachelines).
It turns out that apei_mce_report_mem_error() had a similar problem in that it hard coded a blast radius of 4K rather than reading the blast radius from the error information. Fix apei_mce_report_mem_error() to convey the proper poison granularity.
--- arch/x86/kernel/cpu/mce/apei.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mce/apei.c +12 -1
@@ -29,15 +29,26 @@void apei_mce_report_mem_error (int severity,struct cper_sec_mem_err *mem_err) {struct mce m; +int lsb;if (!(mem_err->validation_bits &CPER_MEM_VALID_PA ))return ; +/* +* Even if the ->validation_bits are set for address mask, +* to be extra safe, check and reject an error radius '0', +* and fall back to the default page size. +*/ +if (mem_err->validation_bits &CPER_MEM_VALID_PA_MASK ) + lsb =find_first_bit ((void *)&mem_err->physical_addr_mask,PAGE_SHIFT ); +else + lsb =PAGE_SHIFT ; +mce_setup (&m); m.bank =-1 ;/* Fake a memory read error with unknown channel */ m.status =MCI_STATUS_VAL |MCI_STATUS_EN |MCI_STATUS_ADDRV |MCI_STATUS_MISCV |0x9f ; - m.misc = (MCI_MISC_ADDR_PHYS <<6 ) |PAGE_SHIFT ; + m.misc = (MCI_MISC_ADDR_PHYS <<6 ) | lsb;if (severity >=GHES_SEV_RECOVERABLE ) m.status |=MCI_STATUS_UC ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 12/46 wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg()
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit b383e8abed41cc6ff1a3b34de75df9397fa4878c ]
syzbot is reporting uninit value at ath9k_htc_rx_msg() [1], for ioctl(USB_RAW_IOCTL_EP_WRITE) can call ath9k_hif_usb_rx_stream() with pkt_len = 0 but ath9k_hif_usb_rx_stream() uses __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC) based on an assumption that pkt_len is valid. As a result, ath9k_hif_usb_rx_stream() allocates skb with uninitialized memory and ath9k_htc_rx_msg() is reading from uninitialized memory.
Since bytes accessed by ath9k_htc_rx_msg() is not known until ath9k_htc_rx_msg() is called, it would be difficult to check minimal valid pkt_len at "if (pkt_len > 2 * MAX_RX_BUF_SIZE) {" line in ath9k_hif_usb_rx_stream().
We have two choices. One is to workaround by adding __GFP_ZERO so that ath9k_htc_rx_msg() sees 0 if pkt_len is invalid. The other is to let ath9k_htc_rx_msg() validate pkt_len before accessing. This patch chose the latter.
Note that I'm not sure threshold condition is correct, for I can't find details on possible packet length used by this protocol.
--- drivers/net/wireless/ath/ath9k/htc_hst.c | 43 +++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath9k/htc_hst.c +28 -15
@@ -364,33 +364,27 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, }static void ath9k_htc_fw_panic_report (struct htc_target *htc_handle, -struct sk_buff *skb) +struct sk_buff *skb,u32 len) {uint32_t *pattern = (uint32_t *)skb->data; -switch (*pattern) { -case 0x33221199 : - { +if (*pattern ==0x33221199 && len >=sizeof (struct htc_panic_bad_vaddr )) {struct htc_panic_bad_vaddr *htc_panic; htc_panic = (struct htc_panic_bad_vaddr *) skb->data;dev_err (htc_handle->dev,"ath: firmware panic! " "exccause: 0x%08x; pc: 0x%08x; badvaddr: 0x%08x.\n" , htc_panic->exccause, htc_panic->pc, htc_panic->badvaddr); -break ; - } -case 0x33221299 : - { +return ; + } +if (*pattern ==0x33221299 ) {struct htc_panic_bad_epid *htc_panic; htc_panic = (struct htc_panic_bad_epid *) skb->data;dev_err (htc_handle->dev,"ath: firmware panic! " "bad epid: 0x%08x\n" , htc_panic->epid); -break ; - } -default : -dev_err (htc_handle->dev,"ath: unknown panic pattern!\n" ); -break ; +return ; } +dev_err (htc_handle->dev,"ath: unknown panic pattern!\n" ); }/*
@@ -411,16 +405,26 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,if (!htc_handle || !skb)return ; +/* A valid message requires len >= 8. +* +* sizeof(struct htc_frame_hdr) == 8 +* sizeof(struct htc_ready_msg) == 8 +* sizeof(struct htc_panic_bad_vaddr) == 16 +* sizeof(struct htc_panic_bad_epid) == 8 +*/ +if (unlikely (len <sizeof (struct htc_frame_hdr ))) + goto invalid; htc_hdr = (struct htc_frame_hdr *) skb->data; epid = htc_hdr->endpoint_id;if (epid ==0x99 ) { -ath9k_htc_fw_panic_report (htc_handle, skb); +ath9k_htc_fw_panic_report (htc_handle, skb, len);kfree_skb (skb);return ; }if (epid <0 || epid >=ENDPOINT_MAX ) { +invalid:if (pipe_id !=USB_REG_IN_PIPE )dev_kfree_skb_any (skb);else
@@ -432,21 +436,30 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,/* Handle trailer */ if (htc_hdr->flags &HTC_FLAGS_RECV_TRAILER ) { -if (be32_to_cpu (*(__be32 *) skb->data) ==0x00C60000 ) +if (be32_to_cpu (*(__be32 *) skb->data) ==0x00C60000 ) {/* Move past the Watchdog pattern */ htc_hdr = (struct htc_frame_hdr *)(skb->data +4 ); + len -=4 ; + } }/* Get the message ID */ +if (unlikely (len <sizeof (struct htc_frame_hdr ) +sizeof (__be16))) + goto invalid; msg_id = (__be16 *) ((void *) htc_hdr +sizeof (struct htc_frame_hdr ));/* Now process HTC messages */ switch (be16_to_cpu (*msg_id)) {case HTC_MSG_READY_ID : +if (unlikely (len <sizeof (struct htc_ready_msg ))) + goto invalid;htc_process_target_rdy (htc_handle, htc_hdr);break ;case HTC_MSG_CONNECT_SERVICE_RESPONSE_ID : +if (unlikely (len <sizeof (struct htc_frame_hdr ) + +sizeof (struct htc_conn_svc_rspmsg ))) + goto invalid;htc_process_conn_rsp (htc_handle, htc_hdr);break ;default :
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 13/46 thunderbolt: Add back Intel Falcon Ridge end-to-end flow control workaround
In reply to Sasha LevinFrom: Mika Westerberg <[email protected]>
[ Upstream commit 54669e2f17cb5a4c41ade89427f074dc22cecb17 ]
As we are now enabling full end-to-end flow control to the Thunderbolt networking driver, in order for it to work properly on second generation Thunderbolt hardware (Falcon Ridge), we need to add back the workaround that was removed with commit 53f13319d131 ("thunderbolt: Get rid of E2E workaround"). However, this time we only apply it for Falcon Ridge controllers as a form of an additional quirk. For non-Falcon Ridge this does nothing.
While there fix a typo 'reqister' -> 'register' in the comment.
--- drivers/thunderbolt/nhi.c | 49 +++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-)
drivers/thunderbolt/nhi.c +42 -7
@@ -25,7 +25,11 @@#define RING_TYPE (ring) ((ring)->is_tx ? "TX ring" : "RX ring")#define RING_FIRST_USABLE_HOPID 1 - +/* +* Used with QUIRK_E2E to specify an unused HopID the Rx credits are +* transferred. +*/ +#define RING_E2E_RESERVED_HOPID RING_FIRST_USABLE_HOPID/* * Minimal number of vectors when we use MSI-X. Two for control channel * Rx/Tx and the rest four are for cross domain DMA paths.
@@ -35,7 +39,9 @@#define NHI_MAILBOX_TIMEOUT 500/* ms */ +/* Host interface quirks */ #define QUIRK_AUTO_CLEAR_INT BIT(0) +#define QUIRK_E2E BIT(1)static int ring_interrupt_index (struct tb_ring *ring) {
@@ -455,8 +461,18 @@ static void ring_release_msix(struct tb_ring *ring)static int nhi_alloc_hop (struct tb_nhi *nhi,struct tb_ring *ring) { +unsigned int start_hop =RING_FIRST_USABLE_HOPID ;int ret =0 ; +if (nhi->quirks &QUIRK_E2E ) { + start_hop =RING_FIRST_USABLE_HOPID +1 ; +if (ring->flags &RING_FLAG_E2E && !ring->is_tx) { +dev_dbg (&nhi->pdev->dev,"quirking E2E TX HopID %u -> %u\n" , + ring->e2e_tx_hop,RING_E2E_RESERVED_HOPID ); + ring->e2e_tx_hop =RING_E2E_RESERVED_HOPID ; + } + } +spin_lock_irq (&nhi->lock);if (ring->hop <0 ) {
@@ -466,7 +482,7 @@ static int nhi_alloc_hop(struct tb_nhi *nhi, struct tb_ring *ring)* Automatically allocate HopID from the non-reserved * range 1 .. hop_count - 1. */ -for (i =RING_FIRST_USABLE_HOPID ; i < nhi->hop_count; i++) { +for (i = start_hop; i < nhi->hop_count; i++) {if (ring->is_tx) {if (!nhi->tx_rings[i]) { ring->hop = i;
@@ -481,6 +497,11 @@ static int nhi_alloc_hop(struct tb_nhi *nhi, struct tb_ring *ring) } } +if (ring->hop >0 && ring->hop < start_hop) { +dev_warn (&nhi->pdev->dev,"invalid hop: %d\n" , ring->hop); + ret = -EINVAL ; + goto err_unlock; + }if (ring->hop <0 || ring->hop >= nhi->hop_count) {dev_warn (&nhi->pdev->dev,"invalid hop: %d\n" , ring->hop); ret = -EINVAL ;
@@ -1094,12 +1115,26 @@ static void nhi_shutdown(struct tb_nhi *nhi)static void nhi_check_quirks (struct tb_nhi *nhi) { -/* -* Intel hardware supports auto clear of the interrupt status -* reqister right after interrupt is being issued. -*/ -if (nhi->pdev->vendor ==PCI_VENDOR_ID_INTEL ) +if (nhi->pdev->vendor ==PCI_VENDOR_ID_INTEL ) { +/* +* Intel hardware supports auto clear of the interrupt +* status register right after interrupt is being +* issued. +*/ nhi->quirks |=QUIRK_AUTO_CLEAR_INT ; + +switch (nhi->pdev->device) { +case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI : +case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI : +/* +* Falcon Ridge controller needs the end-to-end +* flow control workaround to avoid losing Rx +* packets when RING_FLAG_E2E is set. +*/ + nhi->quirks |=QUIRK_E2E ; +break ; + } + } }static int nhi_init_msi (struct tb_nhi *nhi)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 14/46 xfrm: Update ipcomp_scratches with NULL when freed
In reply to Sasha LevinFrom: Khalid Masum <[email protected]>
[ Upstream commit 8a04d2fc700f717104bfb95b0f6694e448a4537f ]
Currently if ipcomp_alloc_scratches() fails to allocate memory ipcomp_scratches holds obsolete address. So when we try to free the percpu scratches using ipcomp_free_scratches() it tries to vfree non existent vm area. Described below:
static void * __percpu *ipcomp_alloc_scratches(void)
{
...
scratches = alloc_percpu(void *);
if (!scratches)
return NULL;
ipcomp_scratches does not know about this allocation failure.
Therefore holding the old obsolete address.
...
}So when we free,
static void ipcomp_free_scratches(void)
{
...
scratches = ipcomp_scratches;Assigning obsolete address from ipcomp_scratches
if (!scratches)
return;
for_each_possible_cpu(i)
vfree(*per_cpu_ptr(scratches, i));
Trying to free non existent page, causing warning: trying to vfree
existent vm area.
...
}Fix this breakage by updating ipcomp_scrtches with NULL when scratches is freed
--- net/xfrm/xfrm_ipcomp.c | 1 + 1 file changed, 1 insertion(+)
net/xfrm/xfrm_ipcomp.c +1 -0
@@ -203,6 +203,7 @@ static void ipcomp_free_scratches(void)vfree (*per_cpu_ptr (scratches, i));free_percpu (scratches); + ipcomp_scratches =NULL ; }static void *__percpu *ipcomp_alloc_scratches (void )
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 15/46 net: broadcom: Fix return type for implementation of
In reply to Sasha LevinFrom: GUO Zihua <[email protected]>
[ Upstream commit 12f7bd252221d4f9e000e20530e50129241e3a67 ]
Since Linux now supports CFI, it will be a good idea to fix mismatched return type for implementation of hooks. Otherwise this might get cought out by CFI and cause a panic.
bcm4908_enet_start_xmit() would return either NETDEV_TX_BUSY or NETDEV_TX_OK, so change the return type to netdev_tx_t directly.
--- drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bcm4908_enet.c +1 -1
@@ -507,7 +507,7 @@ static int bcm4908_enet_stop(struct net_device *netdev)return 0 ; } -static int bcm4908_enet_start_xmit (struct sk_buff *skb,struct net_device *netdev) +static netdev_tx_t bcm4908_enet_start_xmit (struct sk_buff *skb,struct net_device *netdev) {struct bcm4908_enet *enet =netdev_priv (netdev);struct bcm4908_enet_dma_ring *ring = &enet->tx_ring;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 16/46 net: xscale: Fix return type for implementation of ndo_start_xmit
In reply to Sasha LevinFrom: GUO Zihua <[email protected]>
[ Upstream commit 0dbaf0fa62329d9fe452d9041a707a33f6274f1f ]
Since Linux now supports CFI, it will be a good idea to fix mismatched return type for implementation of hooks. Otherwise this might get cought out by CFI and cause a panic.
eth_xmit() would return either NETDEV_TX_BUSY or NETDEV_TX_OK, so change the return type to netdev_tx_t directly.
--- drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xscale/ixp4xx_eth.c +1 -1
@@ -829,7 +829,7 @@ static void eth_txdone_irq(void *unused) } } -static int eth_xmit (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t eth_xmit (struct sk_buff *skb,struct net_device *dev) {struct port *port =netdev_priv (dev);unsigned int txreadyq = port->plat->txreadyq;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 17/46 net: lantiq_etop: Fix return type for implementation of ndo_start_xmit
In reply to Sasha LevinFrom: GUO Zihua <[email protected]>
[ Upstream commit c8ef3c94bda0e21123202d057d4a299698fa0ed9 ]
Since Linux now supports CFI, it will be a good idea to fix mismatched return type for implementation of hooks. Otherwise this might get cought out by CFI and cause a panic.
ltq_etop_tx() would return either NETDEV_TX_BUSY or NETDEV_TX_OK, so change the return type to netdev_tx_t directly.
--- drivers/net/ethernet/lantiq_etop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/lantiq_etop.c +1 -1
@@ -451,7 +451,7 @@ ltq_etop_stop(struct net_device *dev)return 0 ; } -static int +static netdev_tx_t ltq_etop_tx (struct sk_buff *skb,struct net_device *dev) {int queue =skb_get_queue_mapping (skb);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 18/46 net: ftmac100: fix endianness-related issues from 'sparse'
In reply to Sasha LevinFrom: Sergei Antonov <[email protected]>
[ Upstream commit 9df696b3b3a4c96c3219eb87c7bf03fb50e490b8 ]
Sparse found a number of endianness-related issues of these kinds:
.../ftmac100.c:192:32: warning: restricted __le32 degrades to integer
.../ftmac100.c:208:23: warning: incorrect type in assignment (different base types).../ftmac100.c:208:23: expected unsigned int rxdes0.../ftmac100.c:208:23: got restricted __le32 [usertype]
.../ftmac100.c:249:23: warning: invalid assignment: &=.../ftmac100.c:249:23: left side has type unsigned int.../ftmac100.c:249:23: right side has type restricted __le32
.../ftmac100.c:527:16: warning: cast to restricted __le32
Change type of some fields from 'unsigned int' to '__le32' to fix it.
--- drivers/net/ethernet/faraday/ftmac100.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/faraday/ftmac100.h +6 -6
@@ -122,9 +122,9 @@* Transmit descriptor, aligned to 16 bytes */ struct ftmac100_txdes { -unsigned int txdes0; -unsigned int txdes1; -unsigned int txdes2;/* TXBUF_BADR */ +__le32 txdes0; +__le32 txdes1; +__le32 txdes2;/* TXBUF_BADR */ unsigned int txdes3;/* not used by HW */ } __attribute__ ((aligned (16 )));
@@ -143,9 +143,9 @@ struct ftmac100_txdes {* Receive descriptor, aligned to 16 bytes */ struct ftmac100_rxdes { -unsigned int rxdes0; -unsigned int rxdes1; -unsigned int rxdes2;/* RXBUF_BADR */ +__le32 rxdes0; +__le32 rxdes1; +__le32 rxdes2;/* RXBUF_BADR */ unsigned int rxdes3;/* not used by HW */ } __attribute__ ((aligned (16 )));
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 19/46 iavf: Fix race between iavf_close and iavf_reset_task
In reply to Sasha LevinFrom: Michal Jaron <[email protected]>
[ Upstream commit 11c12adcbc1598d91e73ab6ddfa41d25a01478ed ]
During stress tests with adding VF to namespace and changing vf's trust there was a race between iavf_reset_task and iavf_close. Sometimes when IAVF_FLAG_AQ_DISABLE_QUEUES from iavf_close was sent to PF after reset and before IAVF_AQ_GET_CONFIG was sent then PF returns error IAVF_NOT_SUPPORTED to disable queues request and following requests. There is need to get_config before other aq_required will be send but iavf_close clears all flags, if get_config was not sent before iavf_close, then it will not be send at all.
In case when IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS was sent before IAVF_FLAG_AQ_DISABLE_QUEUES then there was rtnl_lock deadlock between iavf_close and iavf_adminq_task until iavf_close timeouts and disable queues was sent after iavf_close ends.
There was also a problem with sending delete/add filters. Sometimes when filters was not yet added to PF and in iavf_close all filters was set to remove there might be a try to remove nonexistent filters on PF.
Add aq_required_tmp to save aq_required flags and send them after disable_queues will be handled. Clear flags given to iavf_down different than IAVF_FLAG_AQ_GET_CONFIG as this flag is necessary to sent other aq_required. Remove some flags that we don't want to send as we are in iavf_close and we want to disable interface. Remove filters which was not yet sent and send del filters flags only when there are filters to remove.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 177 ++++++++++++++++---- 1 file changed, 141 insertions(+), 36 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +141 -36
@@ -1012,66 +1012,138 @@ static void iavf_up_complete(struct iavf_adapter *adapter) }/** -* iavf_down - Shutdown the connection processing +* iavf_clear_mac_vlan_filters - Remove mac and vlan filters not sent to PF +* yet and mark other to be removed. * @adapter: board private structure -* -* Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock. **/ -void iavf_down (struct iavf_adapter *adapter) +static void iavf_clear_mac_vlan_filters (struct iavf_adapter *adapter) { -struct net_device *netdev = adapter->netdev; -struct iavf_vlan_filter *vlf; -struct iavf_cloud_filter *cf; -struct iavf_fdir_fltr *fdir; -struct iavf_mac_filter *f; -struct iavf_adv_rss *rss; - -if (adapter->state <= __IAVF_DOWN_PENDING) -return ; - -netif_carrier_off (netdev); -netif_tx_disable (netdev); - adapter->link_up = false; -iavf_napi_disable_all (adapter); -iavf_irq_disable (adapter); +struct iavf_vlan_filter *vlf, *vlftmp; +struct iavf_mac_filter *f, *ftmp;spin_lock_bh (&adapter->mac_vlan_list_lock); -/* clear the sync flag on all filters */ __dev_uc_unsync (adapter->netdev,NULL );__dev_mc_unsync (adapter->netdev,NULL );/* remove all MAC filters */ -list_for_each_entry (f, &adapter->mac_filter_list, list) { - f->remove = true; +list_for_each_entry_safe (f, ftmp, &adapter->mac_filter_list, + list) { +if (f->add) { +list_del (&f->list); +kfree (f); + }else { + f->remove = true; + } }/* remove all VLAN filters */ -list_for_each_entry (vlf, &adapter->vlan_filter_list, list) { - vlf->remove = true; +list_for_each_entry_safe (vlf, vlftmp, &adapter->vlan_filter_list, + list) { +if (vlf->add) { +list_del (&vlf->list); +kfree (vlf); + }else { + vlf->remove = true; + } } -spin_unlock_bh (&adapter->mac_vlan_list_lock); +} + +/** +* iavf_clear_cloud_filters - Remove cloud filters not sent to PF yet and +* mark other to be removed. +* @adapter: board private structure +**/ +static void iavf_clear_cloud_filters (struct iavf_adapter *adapter) +{ +struct iavf_cloud_filter *cf, *cftmp;/* remove all cloud filters */ spin_lock_bh (&adapter->cloud_filter_list_lock); -list_for_each_entry (cf, &adapter->cloud_filter_list, list) { - cf->del = true; +list_for_each_entry_safe (cf, cftmp, &adapter->cloud_filter_list, + list) { +if (cf->add) { +list_del (&cf->list); +kfree (cf); + adapter->num_cloud_filters--; + }else { + cf->del = true; + } }spin_unlock_bh (&adapter->cloud_filter_list_lock); +} + +/** +* iavf_clear_fdir_filters - Remove fdir filters not sent to PF yet and mark +* other to be removed. +* @adapter: board private structure +**/ +static void iavf_clear_fdir_filters (struct iavf_adapter *adapter) +{ +struct iavf_fdir_fltr *fdir, *fdirtmp;/* remove all Flow Director filters */ spin_lock_bh (&adapter->fdir_fltr_lock); -list_for_each_entry (fdir, &adapter->fdir_list_head, list) { - fdir->state =IAVF_FDIR_FLTR_DEL_REQUEST ; +list_for_each_entry_safe (fdir, fdirtmp, &adapter->fdir_list_head, + list) { +if (fdir->state ==IAVF_FDIR_FLTR_ADD_REQUEST ) { +list_del (&fdir->list); +kfree (fdir); + adapter->fdir_active_fltr--; + }else { + fdir->state =IAVF_FDIR_FLTR_DEL_REQUEST ; + } }spin_unlock_bh (&adapter->fdir_fltr_lock); +} + +/** +* iavf_clear_adv_rss_conf - Remove adv rss conf not sent to PF yet and mark +* other to be removed. +* @adapter: board private structure +**/ +static void iavf_clear_adv_rss_conf (struct iavf_adapter *adapter) +{ +struct iavf_adv_rss *rss, *rsstmp;/* remove all advance RSS configuration */ spin_lock_bh (&adapter->adv_rss_lock); -list_for_each_entry (rss, &adapter->adv_rss_list_head, list) - rss->state =IAVF_ADV_RSS_DEL_REQUEST ; +list_for_each_entry_safe (rss, rsstmp, &adapter->adv_rss_list_head, + list) { +if (rss->state ==IAVF_ADV_RSS_ADD_REQUEST ) { +list_del (&rss->list); +kfree (rss); + }else { + rss->state =IAVF_ADV_RSS_DEL_REQUEST ; + } + }spin_unlock_bh (&adapter->adv_rss_lock); +} + +/** +* iavf_down - Shutdown the connection processing +* @adapter: board private structure +* +* Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock. +**/ +void iavf_down (struct iavf_adapter *adapter) +{ +struct net_device *netdev = adapter->netdev; + +if (adapter->state <= __IAVF_DOWN_PENDING) +return ; + +netif_carrier_off (netdev); +netif_tx_disable (netdev); + adapter->link_up = false; +iavf_napi_disable_all (adapter); +iavf_irq_disable (adapter); + +iavf_clear_mac_vlan_filters (adapter); +iavf_clear_cloud_filters (adapter); +iavf_clear_fdir_filters (adapter); +iavf_clear_adv_rss_conf (adapter);if (!(adapter->flags &IAVF_FLAG_PF_COMMS_FAILED )) {/* cancel any current operation */
@@ -1080,11 +1152,16 @@ void iavf_down(struct iavf_adapter *adapter)* here for this to complete. The watchdog is still running * and it will take care of this. */ - adapter->aq_required =IAVF_FLAG_AQ_DEL_MAC_FILTER ; - adapter->aq_required |=IAVF_FLAG_AQ_DEL_VLAN_FILTER ; - adapter->aq_required |=IAVF_FLAG_AQ_DEL_CLOUD_FILTER ; - adapter->aq_required |=IAVF_FLAG_AQ_DEL_FDIR_FILTER ; - adapter->aq_required |=IAVF_FLAG_AQ_DEL_ADV_RSS_CFG ; +if (!list_empty (&adapter->mac_filter_list)) + adapter->aq_required |=IAVF_FLAG_AQ_DEL_MAC_FILTER ; +if (!list_empty (&adapter->vlan_filter_list)) + adapter->aq_required |=IAVF_FLAG_AQ_DEL_VLAN_FILTER ; +if (!list_empty (&adapter->cloud_filter_list)) + adapter->aq_required |=IAVF_FLAG_AQ_DEL_CLOUD_FILTER ; +if (!list_empty (&adapter->fdir_list_head)) + adapter->aq_required |=IAVF_FLAG_AQ_DEL_FDIR_FILTER ; +if (!list_empty (&adapter->adv_rss_list_head)) + adapter->aq_required |=IAVF_FLAG_AQ_DEL_ADV_RSS_CFG ; adapter->aq_required |=IAVF_FLAG_AQ_DISABLE_QUEUES ; }
@@ -3483,6 +3560,7 @@ static int iavf_open(struct net_device *netdev)static int iavf_close (struct net_device *netdev) {struct iavf_adapter *adapter =netdev_priv (netdev); +u64 aq_to_restore;int status;mutex_lock (&adapter->crit_lock);
@@ -3495,6 +3573,29 @@ static int iavf_close(struct net_device *netdev)set_bit (__IAVF_VSI_DOWN, adapter->vsi.state);if (CLIENT_ENABLED (adapter)) adapter->flags |=IAVF_FLAG_CLIENT_NEEDS_CLOSE ; +/* We cannot send IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS before +* IAVF_FLAG_AQ_DISABLE_QUEUES because in such case there is rtnl +* deadlock with adminq_task() until iavf_close timeouts. We must send +* IAVF_FLAG_AQ_GET_CONFIG before IAVF_FLAG_AQ_DISABLE_QUEUES to make +* disable queues possible for vf. Give only necessary flags to +* iavf_down and save other to set them right before iavf_close() +* returns, when IAVF_FLAG_AQ_DISABLE_QUEUES will be already sent and +* iavf will be in DOWN state. +*/ + aq_to_restore = adapter->aq_required; + adapter->aq_required &=IAVF_FLAG_AQ_GET_CONFIG ; + +/* Remove flags which we do not want to send after close or we want to +* send before disable queues. +*/ + aq_to_restore &= ~(IAVF_FLAG_AQ_GET_CONFIG | +IAVF_FLAG_AQ_ENABLE_QUEUES | +IAVF_FLAG_AQ_CONFIGURE_QUEUES | +IAVF_FLAG_AQ_ADD_VLAN_FILTER | +IAVF_FLAG_AQ_ADD_MAC_FILTER | +IAVF_FLAG_AQ_ADD_CLOUD_FILTER | +IAVF_FLAG_AQ_ADD_FDIR_FILTER | +IAVF_FLAG_AQ_ADD_ADV_RSS_CFG );iavf_down (adapter);iavf_change_state (adapter, __IAVF_DOWN_PENDING);
@@ -3518,6 +3619,10 @@ static int iavf_close(struct net_device *netdev) msecs_to_jiffies(500));if (!status)netdev_warn (netdev,"Device resources not yet released\n" ); + +mutex_lock (&adapter->crit_lock); + adapter->aq_required |= aq_to_restore; +mutex_unlock (&adapter->crit_lock);return 0 ; }
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Sasha Levin
maintainerPATCH 20/46 wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit()
In reply to Sasha LevinFrom: Alexander Coffin <[email protected]>
[ Upstream commit 3f42faf6db431e04bf942d2ebe3ae88975723478 ]
Quoted 1 line
ret =
brcmf_proto_tx_queue_data(drvr, ifp->ifidx, skb);
may be schedule, and then complete before the line
Quoted 1 line
ndev->stats.tx_bytes+=skb->len;
[ 46.912801] ================================================================== [ 46.920552] BUG: KASAN: use-after-free in brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac] [ 46.928673] Read of size 4 at addr ffffff803f5882e8 by task systemd-resolve/328 [ 46.935991] [ 46.937514] CPU: 1 PID: 328 Comm: systemd-resolve Tainted: G O 5.4.199-[REDACTED] #1 [ 46.947255] Hardware name: [REDACTED] [ 46.954568] Call trace: [ 46.957037] dump_backtrace+0x0/0x2b8 [ 46.960719] show_stack+0x24/0x30 [ 46.964052] dump_stack+0x128/0x194 [ 46.967557] print_address_description.isra.0+0x64/0x380 [ 46.972877] __kasan_report+0x1d4/0x240 [ 46.976723] kasan_report+0xc/0x18 [ 46.980138] __asan_report_load4_noabort+0x18/0x20 [ 46.985027] brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac] [ 46.990613] dev_hard_start_xmit+0x1bc/0xda0 [ 46.994894] sch_direct_xmit+0x198/0xd08 [ 46.998827] __qdisc_run+0x37c/0x1dc0 [ 47.002500] __dev_queue_xmit+0x1528/0x21f8 [ 47.006692] dev_queue_xmit+0x24/0x30 [ 47.010366] neigh_resolve_output+0x37c/0x678 [ 47.014734] ip_finish_output2+0x598/0x2458 [ 47.018927] __ip_finish_output+0x300/0x730 [ 47.023118] ip_output+0x2e0/0x430 [ 47.026530] ip_local_out+0x90/0x140 [ 47.030117] igmpv3_sendpack+0x14c/0x228 [ 47.034049] igmpv3_send_cr+0x384/0x6b8 [ 47.037895] igmp_ifc_timer_expire+0x4c/0x118 [ 47.042262] call_timer_fn+0x1cc/0xbe8 [ 47.046021] __run_timers+0x4d8/0xb28 [ 47.049693] run_timer_softirq+0x24/0x40 [ 47.053626] __do_softirq+0x2c0/0x117c [ 47.057387] irq_exit+0x2dc/0x388 [ 47.060715] __handle_domain_irq+0xb4/0x158 [ 47.064908] gic_handle_irq+0x58/0xb0 [ 47.068581] el0_irq_naked+0x50/0x5c [ 47.072162] [ 47.073665] Allocated by task 328: [ 47.077083] save_stack+0x24/0xb0 [ 47.080410] __kasan_kmalloc.isra.0+0xc0/0xe0 [ 47.084776] kasan_slab_alloc+0x14/0x20 [ 47.088622] kmem_cache_alloc+0x15c/0x468 [ 47.092643] __alloc_skb+0xa4/0x498 [ 47.096142] igmpv3_newpack+0x158/0xd78 [ 47.099987] add_grhead+0x210/0x288 [ 47.103485] add_grec+0x6b0/0xb70 [ 47.106811] igmpv3_send_cr+0x2e0/0x6b8 [ 47.110657] igmp_ifc_timer_expire+0x4c/0x118 [ 47.115027] call_timer_fn+0x1cc/0xbe8 [ 47.118785] __run_timers+0x4d8/0xb28 [ 47.122457] run_timer_softirq+0x24/0x40 [ 47.126389] __do_softirq+0x2c0/0x117c [ 47.130142] [ 47.131643] Freed by task 180: [ 47.134712] save_stack+0x24/0xb0 [ 47.138041] __kasan_slab_free+0x108/0x180 [ 47.142146] kasan_slab_free+0x10/0x18 [ 47.145904] slab_free_freelist_hook+0xa4/0x1b0 [ 47.150444] kmem_cache_free+0x8c/0x528 [ 47.154292] kfree_skbmem+0x94/0x108 [ 47.157880] consume_skb+0x10c/0x5a8 [ 47.161466] __dev_kfree_skb_any+0x88/0xa0 [ 47.165598] brcmu_pkt_buf_free_skb+0x44/0x68 [brcmutil] [ 47.171023] brcmf_txfinalize+0xec/0x190 [brcmfmac] [ 47.176016] brcmf_proto_bcdc_txcomplete+0x1c0/0x210 [brcmfmac] [ 47.182056] brcmf_sdio_sendfromq+0x8dc/0x1e80 [brcmfmac] [ 47.187568] brcmf_sdio_dpc+0xb48/0x2108 [brcmfmac] [ 47.192529] brcmf_sdio_dataworker+0xc8/0x238 [brcmfmac] [ 47.197859] process_one_work+0x7fc/0x1a80 [ 47.201965] worker_thread+0x31c/0xc40 [ 47.205726] kthread+0x2d8/0x370 [ 47.208967] ret_from_fork+0x10/0x18 [ 47.212546] [ 47.214051] The buggy address belongs to the object at ffffff803f588280 [ 47.214051] which belongs to the cache skbuff_head_cache of size 208 [ 47.227086] The buggy address is located 104 bytes inside of [ 47.227086] 208-byte region [ffffff803f588280, ffffff803f588350) [ 47.238814] The buggy address belongs to the page: [ 47.243618] page:ffffffff00dd6200 refcount:1 mapcount:0 mapping:ffffff804b6bf800 index:0xffffff803f589900 compound_mapcount: 0 [ 47.255007] flags: 0x10200(slab|head) [ 47.258689] raw: 0000000000010200 ffffffff00dfa980 0000000200000002 ffffff804b6bf800 [ 47.266439] raw: ffffff803f589900 0000000080190018 00000001ffffffff 0000000000000000 [ 47.274180] page dumped because: kasan: bad access detected [ 47.279752] [ 47.281251] Memory state around the buggy address: [ 47.286051] ffffff803f588180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 47.293277] ffffff803f588200: fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 47.300502] >ffffff803f588280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 47.307723] ^ [ 47.314343] ffffff803f588300: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc [ 47.321569] ffffff803f588380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb [ 47.328789] ==================================================================
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +2 -1
@@ -295,6 +295,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,struct brcmf_pub *drvr = ifp->drvr;struct ethhdr *eh;int head_delta; +unsigned int tx_bytes = skb->len;brcmf_dbg (DATA ,"Enter, bsscfgidx=%d\n" , ifp->bsscfgidx);
@@ -369,7 +370,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, ndev->stats.tx_dropped++; }else { ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; + ndev->stats.tx_bytes += tx_bytes; }/* Return ok: we always eat the packet */
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 21/46 Bluetooth: btintel: Mark Intel controller to support LE_STATES quirk
In reply to Sasha LevinFrom: Kiran K <[email protected]>
[ Upstream commit dd0a1794f4334ddbf9b7c5e7d642aaffff38c69b ]
HarrrisonPeak, CyclonePeak, SnowFieldPeak and SandyPeak controllers are marked to support HCI_QUIRK_LE_STATES.
--- drivers/bluetooth/btintel.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/bluetooth/btintel.c +8 -9
@@ -2274,15 +2274,20 @@ static int btintel_setup_combined(struct hci_dev *hdev) INTEL_ROM_LEGACY_NO_WBS_SUPPORT)) set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); +if (ver.hw_variant ==0x08 && ver.fw_variant ==0x22 ) +set_bit (HCI_QUIRK_VALID_LE_STATES , + &hdev->quirks); err =btintel_legacy_rom_setup (hdev, &ver);break ;case 0x0b :/* SfP */ -case 0x0c :/* WsP */ case 0x11 :/* JfP */ case 0x12 :/* ThP */ case 0x13 :/* HrP */ case 0x14 :/* CcP */ +set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); + fallthrough; +case 0x0c :/* WsP */ /* Apply the device specific HCI quirks * * All Legacy bootloader devices support WBS
@@ -2290,11 +2295,6 @@ static int btintel_setup_combined(struct hci_dev *hdev)set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); -/* Valid LE States quirk for JfP/ThP familiy */ -if (ver.hw_variant ==0x11 || ver.hw_variant ==0x12 ) -set_bit (HCI_QUIRK_VALID_LE_STATES , - &hdev->quirks); -/* Setup MSFT Extension support */ btintel_set_msft_opcode (hdev, ver.hw_variant);
@@ -2361,9 +2361,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)*/ set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); -/* Valid LE States quirk for JfP/ThP familiy */ -if (ver.hw_variant ==0x11 || ver.hw_variant ==0x12 ) -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); +/* Set Valid LE States quirk */ +set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks);/* Setup MSFT Extension support */ btintel_set_msft_opcode (hdev, ver.hw_variant);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 22/46 regulator: core: Prevent integer underflow
In reply to Sasha LevinFrom: Patrick Rudolph <[email protected]>
[ Upstream commit 8d8e16592022c9650df8aedfe6552ed478d7135b ]
By using a ratio of delay to poll_enabled_time that is not integer time_remaining underflows and does not exit the loop as expected. As delay could be derived from DT and poll_enabled_time is defined in the driver this can easily happen.
Use a signed iterator to make sure that the loop exits once the remaining time is negative.
--- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/core.c +1 -1
@@ -2636,7 +2636,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)* expired, return -ETIMEDOUT. */ if (rdev->desc->poll_enabled_time) { -unsigned int time_remaining = delay; +int time_remaining = delay;while (time_remaining >0 ) {_regulator_enable_delay (rdev->desc->poll_enabled_time);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 23/46 wifi: mt76: mt7921: reset msta->airtime_ac while clearing up hw value
In reply to Sasha LevinFrom: Sean Wang <[email protected]>
[ Upstream commit 1bf66dc31032ff5292f4d5b76436653f269fcfbd ]
We should reset mstat->airtime_ac along with clear up the entries in the hardware WLAN table for the Rx and Rx accumulative airtime. Otherwsie, the value msta->airtime_ac - [tx, rx]_last may be a negative and that is not the actual airtime the device took in the last run.
--- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -0
@@ -627,6 +627,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,mt7921_mac_wtbl_update (dev, msta->wcid.idx,MT_WTBL_UPDATE_ADM_COUNT_CLEAR ); +memset (msta->airtime_ac,0 ,sizeof (msta->airtime_ac));mt7921_mcu_sta_update (dev, sta, vif, true,MT76_STA_INFO_STATE_ASSOC );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 24/46 Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create()
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 2d2cb3066f2c90cd8ca540b36ba7a55e7f2406e0 ]
syzbot is reporting cancel_delayed_work() without INIT_DELAYED_WORK() at l2cap_chan_del() [1], for CONF_NOT_COMPLETE flag (which meant to prevent l2cap_chan_del() from calling cancel_delayed_work()) is cleared by timer which fires before l2cap_chan_del() is called by closing file descriptor created by socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_L2CAP).
l2cap_bredr_sig_cmd(L2CAP_CONF_REQ) and l2cap_bredr_sig_cmd(L2CAP_CONF_RSP) are calling l2cap_ertm_init(chan), and they call l2cap_chan_ready() (which clears CONF_NOT_COMPLETE flag) only when l2cap_ertm_init(chan) succeeded.
l2cap_sock_init() does not call l2cap_ertm_init(chan), and it instead sets CONF_NOT_COMPLETE flag by calling l2cap_chan_set_defaults(). However, when connect() is requested, "command 0x0409 tx timeout" happens after 2 seconds
from connect() request, and CONF_NOT_COMPLETE flag is cleared after 4
seconds from connect() request, for l2cap_conn_start() from l2cap_info_timeout() callback scheduled by
schedule_delayed_work(&conn->info_timer, L2CAP_INFO_TIMEOUT);
in l2cap_connect() is calling l2cap_chan_ready().
Fix this problem by initializing delayed works used by L2CAP_MODE_ERTM mode as soon as l2cap_chan_create() allocates a channel, like I did in commit be8597239379f0f5 ("Bluetooth: initialize skb_queue_head at l2cap_chan_create()").
--- net/bluetooth/l2cap_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/bluetooth/l2cap_core.c +6 -4
@@ -61,6 +61,9 @@ static void l2cap_send_disconn_req(struct l2cap_chan *chan, int err);static void l2cap_tx (struct l2cap_chan *chan,struct l2cap_ctrl *control,struct sk_buff_head *skbs,u8 event); +static void l2cap_retrans_timeout (struct work_struct *work); +static void l2cap_monitor_timeout (struct work_struct *work); +static void l2cap_ack_timeout (struct work_struct *work);static inline u8 bdaddr_type (u8 link_type,u8 bdaddr_type) {
@@ -476,6 +479,9 @@ struct l2cap_chan *l2cap_chan_create(void)write_unlock (&chan_list_lock);INIT_DELAYED_WORK (&chan->chan_timer, l2cap_chan_timeout); +INIT_DELAYED_WORK (&chan->retrans_timer, l2cap_retrans_timeout); +INIT_DELAYED_WORK (&chan->monitor_timer, l2cap_monitor_timeout); +INIT_DELAYED_WORK (&chan->ack_timer, l2cap_ack_timeout); chan->state =BT_OPEN ;
@@ -3320,10 +3326,6 @@ int l2cap_ertm_init(struct l2cap_chan *chan) chan->rx_state =L2CAP_RX_STATE_RECV ; chan->tx_state =L2CAP_TX_STATE_XMIT ; -INIT_DELAYED_WORK (&chan->retrans_timer, l2cap_retrans_timeout); -INIT_DELAYED_WORK (&chan->monitor_timer, l2cap_monitor_timeout); -INIT_DELAYED_WORK (&chan->ack_timer, l2cap_ack_timeout); -skb_queue_head_init (&chan->srej_q); err =l2cap_seq_list_init (&chan->srej_list, chan->tx_win);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 25/46 net: davicom: Fix return type of dm9000_start_xmit
In reply to Sasha LevinFrom: Nathan Huckleberry <[email protected]>
[ Upstream commit 0191580b000d50089a0b351f7cdbec4866e3d0d2 ]
The ndo_start_xmit field in net_device_ops is expected to be of type netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev).
The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition.
The return type of dm9000_start_xmit should be changed from int to netdev_tx_t.
--- drivers/net/ethernet/davicom/dm9000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/davicom/dm9000.c +1 -1
@@ -1012,7 +1012,7 @@ static void dm9000_send_packet(struct net_device *dev,* Hardware start transmission. * Send a packet to media from the upper layer. */ -static int +static netdev_tx_t dm9000_start_xmit (struct sk_buff *skb,struct net_device *dev) {unsigned long flags;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 26/46 net: ethernet: ti: davinci_emac: Fix return type of emac_dev_xmit
In reply to Sasha LevinFrom: Nathan Huckleberry <[email protected]>
[ Upstream commit 5972ca946098487c5155fe13654743f9010f5ed5 ]
The ndo_start_xmit field in net_device_ops is expected to be of type netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev).
The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition.
The return type of emac_dev_xmit should be changed from int to netdev_tx_t.
--- drivers/net/ethernet/ti/davinci_emac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/davinci_emac.c +1 -1
@@ -950,7 +950,7 @@ static void emac_tx_handler(void *token, int len, int status)* * Returns success(NETDEV_TX_OK) or error code (typically out of desc's) */ -static int emac_dev_xmit (struct sk_buff *skb,struct net_device *ndev) +static netdev_tx_t emac_dev_xmit (struct sk_buff *skb,struct net_device *ndev) {struct device *emac_dev = &ndev->dev;int ret_code;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 27/46 net: ethernet: litex: Fix return type of liteeth_start_xmit
In reply to Sasha LevinFrom: Nathan Huckleberry <[email protected]>
[ Upstream commit 40662333dd7c64664247a6138bc33f3974e3a331 ]
The ndo_start_xmit field in net_device_ops is expected to be of type netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev).
The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition.
The return type of liteeth_start_xmit should be changed from int to netdev_tx_t.
--- drivers/net/ethernet/litex/litex_liteeth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/litex/litex_liteeth.c +2 -1
@@ -152,7 +152,8 @@ static int liteeth_stop(struct net_device *netdev)return 0 ; } -static int liteeth_start_xmit (struct sk_buff *skb,struct net_device *netdev) +static netdev_tx_t liteeth_start_xmit (struct sk_buff *skb, +struct net_device *netdev) {struct liteeth *priv =netdev_priv (netdev);void __iomem *txbuffer;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 28/46 net: korina: Fix return type of korina_send_packet
In reply to Sasha LevinFrom: Nathan Huckleberry <[email protected]>
[ Upstream commit 106c67ce46f3c82dd276e983668a91d6ed631173 ]
The ndo_start_xmit field in net_device_ops is expected to be of type netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev).
The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition.
The return type of korina_send_packet should be changed from int to netdev_tx_t.
--- drivers/net/ethernet/korina.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/korina.c +2 -1
@@ -416,7 +416,8 @@ static void korina_abort_rx(struct net_device *dev) }/* transmit packet */ -static int korina_send_packet (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t korina_send_packet (struct sk_buff *skb, +struct net_device *dev) {struct korina_private *lp =netdev_priv (dev);u32 chain_prev, chain_next;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 29/46 net: wwan: iosm: Fix return type of ipc_wwan_link_transmit
In reply to Sasha LevinFrom: Nathan Huckleberry <[email protected]>
[ Upstream commit 0c9441c430104dcf2cd066aae74dbeefb9f9e1bf ]
The ndo_start_xmit field in net_device_ops is expected to be of type netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev).
The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition.
The return type of ipc_wwan_link_transmit should be changed from int to netdev_tx_t.
--- drivers/net/wwan/iosm/iosm_ipc_wwan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wwan/iosm/iosm_ipc_wwan.c +2 -2
@@ -102,8 +102,8 @@ static int ipc_wwan_link_stop(struct net_device *netdev) }/* Transmit a packet */ -static int ipc_wwan_link_transmit (struct sk_buff *skb, -struct net_device *netdev) +static netdev_tx_t ipc_wwan_link_transmit (struct sk_buff *skb, +struct net_device *netdev) {struct iosm_netdev_priv *priv =wwan_netdev_drvpriv (netdev);struct iosm_wwan *ipc_wwan = priv->ipc_wwan;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 30/46 net: sfp: re-implement soft state polling setup
In reply to Sasha LevinFrom: "Russell King (Oracle)" <[email protected]>
[ Upstream commit 8475c4b70b040f9d8cbc308100f2c4d865f810b3 ]
Re-implement the decision making for soft state polling. Instead of generating the soft state mask in sfp_soft_start_poll() by looking at which GPIOs are available, record their availability in sfp_sm_mod_probe() in sfp->state_hw_mask.
This will then allow us to clear bits in sfp->state_hw_mask in module specific quirks when the hardware signals should not be used, thereby allowing us to switch to using the software state polling.
--- drivers/net/phy/sfp.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-)
drivers/net/phy/sfp.c +26 -12
@@ -234,6 +234,7 @@ struct sfp {bool need_poll;struct mutex st_mutex;/* Protects state */ +unsigned int state_hw_mask;unsigned int state_soft_mask;unsigned int state;struct delayed_work poll;
@@ -499,17 +500,18 @@ static void sfp_soft_set_state(struct sfp *sfp, unsigned int state)static void sfp_soft_start_poll (struct sfp *sfp) {const struct sfp_eeprom_id *id = &sfp->id; +unsigned int mask =0 ; sfp->state_soft_mask =0 ; -if (id->ext.enhopts &SFP_ENHOPTS_SOFT_TX_DISABLE && - !sfp->gpio[GPIO_TX_DISABLE ]) - sfp->state_soft_mask |=SFP_F_TX_DISABLE ; -if (id->ext.enhopts &SFP_ENHOPTS_SOFT_TX_FAULT && - !sfp->gpio[GPIO_TX_FAULT ]) - sfp->state_soft_mask |=SFP_F_TX_FAULT ; -if (id->ext.enhopts &SFP_ENHOPTS_SOFT_RX_LOS && - !sfp->gpio[GPIO_LOS ]) - sfp->state_soft_mask |=SFP_F_LOS ; +if (id->ext.enhopts &SFP_ENHOPTS_SOFT_TX_DISABLE ) + mask |=SFP_F_TX_DISABLE ; +if (id->ext.enhopts &SFP_ENHOPTS_SOFT_TX_FAULT ) + mask |=SFP_F_TX_FAULT ; +if (id->ext.enhopts &SFP_ENHOPTS_SOFT_RX_LOS ) + mask |=SFP_F_LOS ; + +// Poll the soft state for hardware pins we want to ignore + sfp->state_soft_mask = ~sfp->state_hw_mask & mask;if (sfp->state_soft_mask & (SFP_F_LOS |SFP_F_TX_FAULT ) && !sfp->need_poll)
@@ -523,10 +525,11 @@ static void sfp_soft_stop_poll(struct sfp *sfp)static unsigned int sfp_get_state (struct sfp *sfp) { -unsigned int state = sfp->get_state (sfp); +unsigned int soft = sfp->state_soft_mask & (SFP_F_LOS |SFP_F_TX_FAULT ); +unsigned int state; -if (state &SFP_F_PRESENT && - sfp->state_soft_mask & (SFP_F_LOS |SFP_F_TX_FAULT )) + state = sfp->get_state (sfp) & sfp->state_hw_mask; +if (state &SFP_F_PRESENT && soft) state |=sfp_soft_get_state (sfp);return state;
@@ -1940,6 +1943,15 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)if (ret <0 )return ret; +/* Initialise state bits to use from hardware */ + sfp->state_hw_mask =SFP_F_PRESENT ; +if (sfp->gpio[GPIO_TX_DISABLE ]) + sfp->state_hw_mask |=SFP_F_TX_DISABLE ; +if (sfp->gpio[GPIO_TX_FAULT ]) + sfp->state_hw_mask |=SFP_F_TX_FAULT ; +if (sfp->gpio[GPIO_LOS ]) + sfp->state_hw_mask |=SFP_F_LOS ; +if (!memcmp (id.base.vendor_name,"ALCATELLUCENT " ,16 ) && !memcmp (id.base.vendor_pn,"3FE46541AA " ,16 )) sfp->module_t_start_up =T_START_UP_BAD_GPON ;
@@ -2565,6 +2577,8 @@ static int sfp_probe(struct platform_device *pdev)return PTR_ERR (sfp->gpio[i]); } + sfp->state_hw_mask =SFP_F_PRESENT ; + sfp->get_state = sfp_gpio_get_state; sfp->set_state = sfp_gpio_set_state;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 31/46 net: sfp: move quirk handling into sfp.c
In reply to Sasha LevinFrom: "Russell King (Oracle)" <[email protected]>
[ Upstream commit 23571c7b96437483d28a990c906cc81f5f66374e ]
We need to handle more quirks than just those which affect the link modes of the module. Move the quirk lookup into sfp.c, and pass the quirk to sfp-bus.c
--- drivers/net/phy/sfp-bus.c | 98 ++------------------------------------- drivers/net/phy/sfp.c | 94 ++++++++++++++++++++++++++++++++++++- drivers/net/phy/sfp.h | 9 +++- 3 files changed, 104 insertions(+), 97 deletions(-)
drivers/net/phy/sfp-bus.c +3 -95
@@ -10,12 +10,6 @@#include "sfp.h" -struct sfp_quirk { -const char *vendor; -const char *part; -void (*modes)(const struct sfp_eeprom_id *id,unsigned long *modes); -}; -/** * struct sfp_bus - internal representation of a sfp bus */
@@ -38,93 +32,6 @@ struct sfp_bus {bool started; }; -static void sfp_quirk_2500basex (const struct sfp_eeprom_id *id, -unsigned long *modes) -{ - phylink_set(modes, 2500baseX_Full); -} - -static void sfp_quirk_ubnt_uf_instant (const struct sfp_eeprom_id *id, -unsigned long *modes) -{ -/* Ubiquiti U-Fiber Instant module claims that support all transceiver -* types including 10G Ethernet which is not truth. So clear all claimed -* modes and set only one mode which module supports: 1000baseX_Full. -*/ -phylink_zero (modes); - phylink_set(modes, 1000baseX_Full); -} - -static const struct sfp_quirk sfp_quirks[] = { - { -// Alcatel Lucent G-010S-P can operate at 2500base-X, but -// incorrectly report 2500MBd NRZ in their EEPROM - .vendor ="ALCATELLUCENT" , - .part ="G010SP" , - .modes = sfp_quirk_2500basex, - }, { -// Alcatel Lucent G-010S-A can operate at 2500base-X, but -// report 3.2GBd NRZ in their EEPROM - .vendor ="ALCATELLUCENT" , - .part ="3FE46541AA" , - .modes = sfp_quirk_2500basex, - }, { -// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd -// NRZ in their EEPROM - .vendor ="HUAWEI" , - .part ="MA5671A" , - .modes = sfp_quirk_2500basex, - }, { -// Lantech 8330-262D-E can operate at 2500base-X, but -// incorrectly report 2500MBd NRZ in their EEPROM - .vendor ="Lantech" , - .part ="8330-262D-E" , - .modes = sfp_quirk_2500basex, - }, { - .vendor ="UBNT" , - .part ="UF-INSTANT" , - .modes = sfp_quirk_ubnt_uf_instant, - }, -}; - -static size_t sfp_strlen (const char *str,size_t maxlen) -{ -size_t size, i; - -/* Trailing characters should be filled with space chars */ -for (i =0 , size =0 ; i < maxlen; i++) -if (str[i] !=' ' ) - size = i +1 ; - -return size; -} - -static bool sfp_match (const char *qs,const char *str,size_t len) -{ -if (!qs) -return true; -if (strlen (qs) != len) -return false; -return !strncmp (qs, str, len); -} - -static const struct sfp_quirk *sfp_lookup_quirk (const struct sfp_eeprom_id *id) -{ -const struct sfp_quirk *q; -unsigned int i; -size_t vs, ps; - - vs =sfp_strlen (id->base.vendor_name,ARRAY_SIZE (id->base.vendor_name)); - ps =sfp_strlen (id->base.vendor_pn,ARRAY_SIZE (id->base.vendor_pn)); - -for (i =0 , q = sfp_quirks; i <ARRAY_SIZE (sfp_quirks); i++, q++) -if (sfp_match (q->vendor, id->base.vendor_name, vs) && -sfp_match (q->part, id->base.vendor_pn, ps)) -return q; - -return NULL ; -} -/** * sfp_parse_port() - Parse the EEPROM base ID, setting the port type * @bus: a pointer to the &struct sfp_bus structure for the sfp module
@@ -786,12 +693,13 @@ void sfp_link_down(struct sfp_bus *bus) }EXPORT_SYMBOL_GPL (sfp_link_down); -int sfp_module_insert (struct sfp_bus *bus,const struct sfp_eeprom_id *id) +int sfp_module_insert (struct sfp_bus *bus,const struct sfp_eeprom_id *id, +const struct sfp_quirk *quirk) {const struct sfp_upstream_ops *ops =sfp_get_upstream_ops (bus);int ret =0 ; - bus->sfp_quirk =sfp_lookup_quirk (id); + bus->sfp_quirk = quirk;if (ops && ops->module_insert) ret = ops->module_insert (bus->upstream, id);
drivers/net/phy/sfp.c +93 -1
118 lines not on this page · raw message
drivers/net/phy/sfp.h +8 -1
@@ -6,6 +6,12 @@struct sfp ; +struct sfp_quirk { +const char *vendor; +const char *part; +void (*modes)(const struct sfp_eeprom_id *id,unsigned long *modes); +}; +struct sfp_socket_ops {void (*attach)(struct sfp *sfp);void (*detach)(struct sfp *sfp);
@@ -23,7 +29,8 @@ int sfp_add_phy(struct sfp_bus *bus, struct phy_device *phydev);void sfp_remove_phy (struct sfp_bus *bus);void sfp_link_up (struct sfp_bus *bus);void sfp_link_down (struct sfp_bus *bus); -int sfp_module_insert (struct sfp_bus *bus,const struct sfp_eeprom_id *id); +int sfp_module_insert (struct sfp_bus *bus,const struct sfp_eeprom_id *id, +const struct sfp_quirk *quirk);void sfp_module_remove (struct sfp_bus *bus);int sfp_module_start (struct sfp_bus *bus);void sfp_module_stop (struct sfp_bus *bus);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 32/46 net: sfp: move Alcatel Lucent 3FE46541AA fixup
In reply to Sasha LevinFrom: "Russell King (Oracle)" <[email protected]>
[ Upstream commit 275416754e9a262c97a1ad6f806a4bc6e0464aa2 ]
Add a new fixup mechanism to the SFP quirks, and use it for this module.
--- drivers/net/phy/sfp.c | 14 +++++++++----- drivers/net/phy/sfp.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-)
drivers/net/phy/sfp.c +9 -5
@@ -311,6 +311,11 @@ static const struct of_device_id sfp_of_match[] = { };MODULE_DEVICE_TABLE (of, sfp_of_match); +static void sfp_fixup_long_startup (struct sfp *sfp) +{ + sfp->module_t_start_up =T_START_UP_BAD_GPON ; +} +static void sfp_quirk_2500basex (const struct sfp_eeprom_id *id,unsigned long *modes) {
@@ -341,6 +346,7 @@ static const struct sfp_quirk sfp_quirks[] = { .vendor = "ALCATELLUCENT", .part = "3FE46541AA", .modes = sfp_quirk_2500basex, + .fixup = sfp_fixup_long_startup, }, {// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd // NRZ in their EEPROM
@@ -2041,11 +2047,7 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)if (sfp->gpio[GPIO_LOS ]) sfp->state_hw_mask |=SFP_F_LOS ; -if (!memcmp (id.base.vendor_name,"ALCATELLUCENT " ,16 ) && - !memcmp (id.base.vendor_pn,"3FE46541AA " ,16 )) - sfp->module_t_start_up =T_START_UP_BAD_GPON ; -else - sfp->module_t_start_up =T_START_UP ; + sfp->module_t_start_up =T_START_UP ;if (!memcmp (id.base.vendor_name,"HUAWEI " ,16 ) && !memcmp (id.base.vendor_pn,"MA5671A " ,16 ))
@@ -2054,6 +2056,8 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report) sfp->tx_fault_ignore = false; sfp->quirk =sfp_lookup_quirk (&id); +if (sfp->quirk && sfp->quirk->fixup) + sfp->quirk->fixup (sfp);return 0 ; }
drivers/net/phy/sfp.h +1 -0
@@ -10,6 +10,7 @@ struct sfp_quirk {const char *vendor;const char *part;void (*modes)(const struct sfp_eeprom_id *id,unsigned long *modes); +void (*fixup)(struct sfp *sfp); };struct sfp_socket_ops {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 33/46 net/sched: taprio: taprio_dump and taprio_change are protected by rtnl_mutex
In reply to Sasha LevinFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 18cdd2f0998a4967b1fff4c43ed9aef049e42c39 ]
Since the writer-side lock is taken here, we do not need to open an RCU read-side critical section, instead we can use rtnl_dereference() to tell lockdep we are serialized with concurrent writes.
--- net/sched/sch_taprio.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
net/sched/sch_taprio.c +4 -10
@@ -1491,10 +1491,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, }INIT_LIST_HEAD (&new_admin->entries); -rcu_read_lock (); - oper =rcu_dereference (q->oper_sched); - admin =rcu_dereference (q->admin_sched); -rcu_read_unlock (); + oper =rtnl_dereference (q->oper_sched); + admin =rtnl_dereference (q->admin_sched);/* no changes - no new mqprio settings */ if (!taprio_mqprio_cmp (dev, mqprio))
@@ -1887,9 +1885,8 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)struct nlattr *nest, *sched_nest;unsigned int i; -rcu_read_lock (); - oper =rcu_dereference (q->oper_sched); - admin =rcu_dereference (q->admin_sched); + oper =rtnl_dereference (q->oper_sched); + admin =rtnl_dereference (q->admin_sched); opt.num_tc =netdev_get_num_tc (dev);memcpy (opt.prio_tc_map, dev->prio_tc_map,sizeof (opt.prio_tc_map));
@@ -1933,8 +1930,6 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)nla_nest_end (skb, sched_nest); done: -rcu_read_unlock (); -return nla_nest_end (skb, nest); admin_error:
@@ -1944,7 +1939,6 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)nla_nest_cancel (skb, nest); start_error: -rcu_read_unlock ();return -ENOSPC ; }
Signature · 1 line
2.35.1
Re: [PATCH AUTOSEL 5.15 33/46] net/sched: taprio: taprio_dump and taprio_change are protected by rtnl_mutex
Quoted 4 lines · Sasha Levin
From: Vladimir Oltean <[email protected]>
[ Upstream commit
18cdd2f0998a4967b1fff4c43ed9aef049e42c39]
Quoted 8 lines
Since the writer-side lock is taken here, we do not need to open an RCU read-side critical section, instead we can use
rtnl_dereference()to tell lockdep we are serialized with concurrent writes.Signed-off-by Vladimir Oltean <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
Not needed for stable kernels, please drop, thanks.
Sasha Levin
maintainerPATCH 34/46 Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 448a496f760664d3e2e79466aa1787e6abc922b5 ]
device_add shall not be called multiple times as stated in its documentation:
'Do not call this routine or device_register() more than once for any device structure'
Syzkaller reports a bug as follows [1]:
------------[ cut here ]------------ kernel BUG at lib/list_debug.c:33! invalid opcode: 0000 [#1] PREEMPT SMP KASAN [...] Call Trace: <TASK> __list_add include/linux/list.h:69 [inline] list_add_tail include/linux/list.h:102 [inline] kobj_kset_join lib/kobject.c:164 [inline] kobject_add_internal+0x18f/0x8f0 lib/kobject.c:214 kobject_add_varg lib/kobject.c:358 [inline] kobject_add+0x150/0x1c0 lib/kobject.c:410 device_add+0x368/0x1e90 drivers/base/core.c:3452 hci_conn_add_sysfs+0x9b/0x1b0 net/bluetooth/hci_sysfs.c:53 hci_le_cis_estabilished_evt+0x57c/0xae0 net/bluetooth/hci_event.c:6799 hci_le_meta_evt+0x2b8/0x510 net/bluetooth/hci_event.c:7110 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x63d/0xfd0 net/bluetooth/hci_event.c:7495 hci_rx_work+0xae7/0x1230 net/bluetooth/hci_core.c:4007 process_one_work+0x991/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 </TASK>
--- net/bluetooth/hci_sysfs.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/hci_sysfs.c +3 -0
@@ -48,6 +48,9 @@ void hci_conn_add_sysfs(struct hci_conn *conn)BT_DBG ("conn %p" , conn); +if (device_is_registered (&conn->dev)) +return ; +dev_set_name (&conn->dev,"%s:%d" , hdev->name, conn->handle);if (device_add (&conn->dev) <0 ) {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 35/46 wifi: ath10k: reset pointer after memory free to avoid potential use-after-free
In reply to Sasha LevinFrom: Wen Gong <[email protected]>
[ Upstream commit 1e1cb8e0b73e6f39a9d4a7a15d940b1265387eb5 ]
When running suspend test, kernel crash happened in ath10k, and it is fixed by commit b72a4aff947b ("ath10k: skip ath10k_halt during suspend for driver state RESTARTING").
Currently the crash is fixed, but as a common code style, it is better to set the pointer to NULL after memory is free.
This is to address the code style and it will avoid potential bug of use-after-free.
Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
--- drivers/net/wireless/ath/ath10k/htt_rx.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/ath/ath10k/htt_rx.c +6 -0
@@ -297,12 +297,16 @@ void ath10k_htt_rx_free(struct ath10k_htt *htt)ath10k_htt_get_vaddr_ring (htt), htt->rx_ring.base_paddr); +ath10k_htt_config_paddrs_ring (htt,NULL ); +dma_free_coherent (htt->ar->dev,sizeof (*htt->rx_ring.alloc_idx.vaddr), htt->rx_ring.alloc_idx.vaddr, htt->rx_ring.alloc_idx.paddr); + htt->rx_ring.alloc_idx.vaddr =NULL ;kfree (htt->rx_ring.netbufs_ring); + htt->rx_ring.netbufs_ring =NULL ; }static inline struct sk_buff *ath10k_htt_rx_netbuf_pop (struct ath10k_htt *htt)
@@ -823,8 +827,10 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt)ath10k_htt_get_rx_ring_size (htt), vaddr_ring, htt->rx_ring.base_paddr); +ath10k_htt_config_paddrs_ring (htt,NULL ); err_dma_ring:kfree (htt->rx_ring.netbufs_ring); + htt->rx_ring.netbufs_ring =NULL ; err_netbuf:return -ENOMEM ; }
Signature · 7 lines
2.35.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 36/46 can: bcm: check the result of can_send() in bcm_can_tx()
In reply to Sasha LevinFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 3fd7bfd28cfd68ae80a2fe92ea1615722cc2ee6e ]
If can_send() fail, it should not update frames_abs counter in bcm_can_tx(). Add the result check for can_send() in bcm_can_tx().
--- net/can/bcm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/can/bcm.c +4 -3
@@ -274,6 +274,7 @@ static void bcm_can_tx(struct bcm_op *op)struct sk_buff *skb;struct net_device *dev;struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; +int err;/* no target device? => exit */ if (!op->ifindex)
@@ -298,11 +299,11 @@ static void bcm_can_tx(struct bcm_op *op)/* send with loopback */ skb->dev = dev;can_skb_set_owner (skb, op->sk); -can_send (skb,1 ); + err =can_send (skb,1 ); +if (!err) + op->frames_abs++; -/* update statistics */ op->currframe++; - op->frames_abs++;/* reached last frame? */ if (op->currframe >= op->nframes)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 37/46 wifi: rt2x00: don't run Rt5592 IQ calibration on MT7620
In reply to Sasha LevinFrom: Daniel Golle <[email protected]>
[ Upstream commit d3aad83d05aec0cfd7670cf0028f2ad4b81de92e ]
The function rt2800_iq_calibrate is intended for Rt5592 only. Don't call it for MT7620 which has it's own calibration functions.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +2 -1
@@ -4365,7 +4365,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, reg = (rf->channel <=14 ?0x1c :0x24 ) +2 *rt2x00dev->lna_gain;rt2800_bbp_write_with_rx_chain (rt2x00dev,66 , reg); -rt2800_iq_calibrate (rt2x00dev, rf->channel); +if (rt2x00_rt (rt2x00dev,RT5592 )) +rt2800_iq_calibrate (rt2x00dev, rf->channel); } bbp =rt2800_bbp_read (rt2x00dev,4 );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 38/46 wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620
In reply to Sasha LevinFrom: Daniel Golle <[email protected]>
[ Upstream commit eeb50acf15762b61921f9df18663f839f387c054 ]
Set correct TX_SW_CFG1 MAC register as it is done also in v3 of the vendor driver[1].
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +1 -1
@@ -5868,7 +5868,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)rt2800_register_write (rt2x00dev,TX_SW_CFG0 ,0x00000404 ); }else if (rt2x00_rt (rt2x00dev,RT6352 )) {rt2800_register_write (rt2x00dev,TX_SW_CFG0 ,0x00000401 ); -rt2800_register_write (rt2x00dev,TX_SW_CFG1 ,0x000C0000 ); +rt2800_register_write (rt2x00dev,TX_SW_CFG1 ,0x000C0001 );rt2800_register_write (rt2x00dev,TX_SW_CFG2 ,0x00000000 );rt2800_register_write (rt2x00dev,TX_ALC_VGA3 ,0x00000000 );rt2800_register_write (rt2x00dev,TX0_BB_GAIN_ATTEN ,0x0 );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 39/46 wifi: rt2x00: set VGC gain for both chains of MT7620
In reply to Sasha LevinFrom: Daniel Golle <[email protected]>
[ Upstream commit 0e09768c085709e10ece3b68f6ac921d3f6a9caa ]
Set bbp66 for all chains of the MT7620.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +2 -1
@@ -5645,7 +5645,8 @@ static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev,if (qual->vgc_level != vgc_level) {if (rt2x00_rt (rt2x00dev,RT3572 ) ||rt2x00_rt (rt2x00dev,RT3593 ) || -rt2x00_rt (rt2x00dev,RT3883 )) { +rt2x00_rt (rt2x00dev,RT3883 ) || +rt2x00_rt (rt2x00dev,RT6352 )) {rt2800_bbp_write_with_rx_chain (rt2x00dev,66 , vgc_level); }else if (rt2x00_rt (rt2x00dev,RT5592 )) {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 40/46 wifi: rt2x00: set SoC wmac clock register
In reply to Sasha LevinFrom: Daniel Golle <[email protected]>
[ Upstream commit cbde6ed406a51092d9e8a2df058f5f8490f27443 ]
Instead of using the default value 33 (pci), set US_CYC_CNT init based on Programming guide:
If available, set chipset bus clock with fallback to cpu clock/3.
--- .../net/wireless/ralink/rt2x00/rt2800lib.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +21 -0
@@ -6131,6 +6131,27 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) reg =rt2800_register_read (rt2x00dev,US_CYC_CNT );rt2x00_set_field32 (®,US_CYC_CNT_CLOCK_CYCLE ,125 );rt2800_register_write (rt2x00dev,US_CYC_CNT , reg); + }else if (rt2x00_is_soc (rt2x00dev)) { +struct clk *clk =clk_get_sys ("bus" ,NULL ); +int rate; + +if (IS_ERR (clk)) { + clk =clk_get_sys ("cpu" ,NULL ); + +if (IS_ERR (clk)) { + rate =125 ; + }else { + rate =clk_get_rate (clk) /3000000 ; +clk_put (clk); + } + }else { + rate =clk_get_rate (clk) /1000000 ; +clk_put (clk); + } + + reg =rt2800_register_read (rt2x00dev,US_CYC_CNT ); +rt2x00_set_field32 (®,US_CYC_CNT_CLOCK_CYCLE , rate); +rt2800_register_write (rt2x00dev,US_CYC_CNT , reg); } reg =rt2800_register_read (rt2x00dev,HT_FBK_CFG0 );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 41/46 wifi: rt2x00: correctly set BBP register 86 for MT7620
In reply to Sasha LevinFrom: Daniel Golle <[email protected]>
[ Upstream commit c9aada64fe6493461127f1522d7e2f01792d2424 ]
Instead of 0 set the correct value for BBP register 86 for MT7620.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +4 -1
@@ -4164,7 +4164,10 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,rt2800_bbp_write (rt2x00dev,62 ,0x37 - rt2x00dev->lna_gain);rt2800_bbp_write (rt2x00dev,63 ,0x37 - rt2x00dev->lna_gain);rt2800_bbp_write (rt2x00dev,64 ,0x37 - rt2x00dev->lna_gain); -rt2800_bbp_write (rt2x00dev,86 ,0 ); +if (rt2x00_rt (rt2x00dev,RT6352 )) +rt2800_bbp_write (rt2x00dev,86 ,0x38 ); +else +rt2800_bbp_write (rt2x00dev,86 ,0 ); }if (rf->channel <=14 ) {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 42/46 hwmon: (sht4x) do not overflow clamping operation on 32-bit platforms
In reply to Sasha LevinFrom: "Jason A. Donenfeld" <[email protected]>
[ Upstream commit f9c0cf8f26de367c58e48b02b1cdb9c377626e6f ]
On 32-bit platforms, long is 32 bits, so (long)UINT_MAX is less than (long)SHT4X_MIN_POLL_INTERVAL, which means the clamping operation is bogus. Fix this by clamping at INT_MAX, so that the upperbound is the same on all platforms.
--- drivers/hwmon/sht4x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/sht4x.c +1 -1
@@ -129,7 +129,7 @@ static int sht4x_read_values(struct sht4x_data *data)static ssize_t sht4x_interval_write (struct sht4x_data *data,long val) { - data->update_interval =clamp_val (val,SHT4X_MIN_POLL_INTERVAL ,UINT_MAX ); + data->update_interval =clamp_val (val,SHT4X_MIN_POLL_INTERVAL ,INT_MAX );return 0 ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 43/46 net: If sock is dead don't access sock's sk_wq in sk_stream_wait_memory
In reply to Sasha LevinFrom: Liu Jian <[email protected]>
[ Upstream commit 3f8ef65af927db247418d4e1db49164d7a158fc5 ]
Fixes the below NULL pointer dereference:
[...]
[ 14.471200] Call Trace: [ 14.471562] <TASK> [ 14.471882] lock_acquire+0x245/0x2e0 [ 14.472416] ? remove_wait_queue+0x12/0x50 [ 14.473014] ? _raw_spin_lock_irqsave+0x17/0x50 [ 14.473681] _raw_spin_lock_irqsave+0x3d/0x50 [ 14.474318] ? remove_wait_queue+0x12/0x50 [ 14.474907] remove_wait_queue+0x12/0x50 [ 14.475480] sk_stream_wait_memory+0x20d/0x340 [ 14.476127] ? do_wait_intr_irq+0x80/0x80 [ 14.476704] do_tcp_sendpages+0x287/0x600 [ 14.477283] tcp_bpf_push+0xab/0x260 [ 14.477817] tcp_bpf_sendmsg_redir+0x297/0x500 [ 14.478461] ? __local_bh_enable_ip+0x77/0xe0 [ 14.479096] tcp_bpf_send_verdict+0x105/0x470 [ 14.479729] tcp_bpf_sendmsg+0x318/0x4f0 [ 14.480311] sock_sendmsg+0x2d/0x40 [ 14.480822] ____sys_sendmsg+0x1b4/0x1c0 [ 14.481390] ? copy_msghdr_from_user+0x62/0x80 [ 14.482048] ___sys_sendmsg+0x78/0xb0 [ 14.482580] ? vmf_insert_pfn_prot+0x91/0x150 [ 14.483215] ? __do_fault+0x2a/0x1a0 [ 14.483738] ? do_fault+0x15e/0x5d0 [ 14.484246] ? __handle_mm_fault+0x56b/0x1040 [ 14.484874] ? lock_is_held_type+0xdf/0x130 [ 14.485474] ? find_held_lock+0x2d/0x90 [ 14.486046] ? __sys_sendmsg+0x41/0x70 [ 14.486587] __sys_sendmsg+0x41/0x70 [ 14.487105] ? intel_pmu_drain_pebs_core+0x350/0x350 [ 14.487822] do_syscall_64+0x34/0x80 [ 14.488345] entry_SYSCALL_64_after_hwframe+0x63/0xcd [...]
The test scenario has the following flow:
thread1 thread2
----------- ---------------
tcp_bpf_sendmsg
tcp_bpf_send_verdict
tcp_bpf_sendmsg_redir sock_close
tcp_bpf_push_locked __sock_release
tcp_bpf_push //inet_release
do_tcp_sendpages sock->ops->release
sk_stream_wait_memory // tcp_close
sk_wait_event sk->sk_prot->close
release_sock(__sk);
***
lock_sock(sk);
__tcp_close
sock_orphan(sk)
sk->sk_wq = NULL
release_sock
****
lock_sock(__sk);
remove_wait_queue(sk_sleep(sk), &wait);
sk_sleep(sk)
//NULL pointer dereference
&rcu_dereference_raw(sk->sk_wq)->waitWhile waiting for memory in thread1, the socket is released with its wait queue because thread2 has closed it. This caused by tcp_bpf_send_verdict didn't increase the f_count of psock->sk_redir->sk_socket->file in thread1.
We should check if SOCK_DEAD flag is set on wakeup in sk_stream_wait_memory before accessing the wait queue.
--- net/core/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/stream.c +2 -1
@@ -159,7 +159,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) *timeo_p = current_timeo; } out: -remove_wait_queue (sk_sleep (sk), &wait); +if (!sock_flag (sk,SOCK_DEAD )) +remove_wait_queue (sk_sleep (sk), &wait);return err; do_error:
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 44/46 Bluetooth: L2CAP: Fix user-after-free
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 35fcbc4243aad7e7d020b7c1dfb14bb888b20a4f ]
This uses l2cap_chan_hold_unless_zero() after calling __l2cap_get_chan_blah() to prevent the following trace:
Bluetooth: l2cap_core.c:static void l2cap_chan_destroy(struct kref *kref)
Bluetooth: chan 0000000023c4974d
Bluetooth: parent 00000000ae861c08
==================================================================
BUG: KASAN: use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:191 [inline] BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:671 [inline] BUG: KASAN: use-after-free in __mutex_lock+0x278/0x400 kernel/locking/mutex.c:729 Read of size 8 at addr ffff888006a49b08 by task kworker/u3:2/389
--- net/bluetooth/l2cap_core.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/bluetooth/l2cap_core.c +7 -0
@@ -4309,6 +4309,12 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, } } + chan =l2cap_chan_hold_unless_zero (chan); +if (!chan) { + err = -EBADSLT ; + goto unlock; + } + err =0 ;l2cap_chan_lock (chan);
@@ -4338,6 +4344,7 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, }l2cap_chan_unlock (chan); +l2cap_chan_put (chan); unlock:mutex_unlock (&conn->chan_lock);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 45/46 libbpf: Fix overrun in netlink attribute iteration
In reply to Sasha LevinFrom: Xin Liu <[email protected]>
[ Upstream commit 51e05a8cf8eb34da7473823b7f236a77adfef0b4 ]
I accidentally found that a change in commit 1045b03e07d8 ("netlink: fix overrun in attribute iteration") was not synchronized to the function nla_ok in tools/lib/bpf/nlattr.c, I think it is necessary to modify, this patch will do it.
--- tools/lib/bpf/nlattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/nlattr.c +1 -1
@@ -32,7 +32,7 @@ static struct nlattr *nla_next(const struct nlattr *nla, int *remaining)static int nla_ok (const struct nlattr *nla,int remaining) { -return remaining >=sizeof (*nla) && +return remaining >= (int )sizeof (*nla) && nla->nla_len >=sizeof (*nla) && nla->nla_len <= remaining; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 46/46 r8152: Rate limit overflow messages
In reply to Sasha LevinFrom: Andrew Gaul <[email protected]>
[ Upstream commit 93e2be344a7db169b7119de21ac1bf253b8c6907 ]
My system shows almost 10 million of these messages over a 24-hour period which pollutes my logs.
--- drivers/net/usb/r8152.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/r8152.c +3 -1
@@ -1871,7 +1871,9 @@ static void intr_callback(struct urb *urb) "Stop submitting intr, status %d\n", status);return ;case -EOVERFLOW : -netif_info (tp, intr, tp->netdev,"intr status -EOVERFLOW\n" ); +if (net_ratelimit ()) +netif_info (tp, intr, tp->netdev, +"intr status -EOVERFLOW\n" ); goto resubmit;/* -EPIPE: should clear the halt */ default :
Signature · 1 line
2.35.1