From: Sasha Levin Date: Sun, 13 Nov 2022 22:41:35 +0000 (-0500) Subject: Fixes for 4.9 X-Git-Tag: v5.10.155~51^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c10b3daf9ad9566231d496c2ef5198d30b1392f7;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.9 Signed-off-by: Sasha Levin --- diff --git a/queue-4.9/bnxt_en-fix-potentially-incorrect-return-value-for-n.patch b/queue-4.9/bnxt_en-fix-potentially-incorrect-return-value-for-n.patch new file mode 100644 index 00000000000..82614ea35ba --- /dev/null +++ b/queue-4.9/bnxt_en-fix-potentially-incorrect-return-value-for-n.patch @@ -0,0 +1,45 @@ +From be349bce3999ed333316b4b08e220485a5c35779 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Nov 2022 19:33:27 -0400 +Subject: bnxt_en: fix potentially incorrect return value for ndo_rx_flow_steer + +From: Alex Barba + +[ Upstream commit 02597d39145bb0aa81d04bf39b6a913ce9a9d465 ] + +In the bnxt_en driver ndo_rx_flow_steer returns '0' whenever an entry +that we are attempting to steer is already found. This is not the +correct behavior. The return code should be the value/index that +corresponds to the entry. Returning zero all the time causes the +RFS records to be incorrect unless entry '0' is the correct one. As +flows migrate to different cores this can create entries that are not +correct. + +Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") +Reported-by: Akshay Navgire +Signed-off-by: Alex Barba +Signed-off-by: Andy Gospodarek +Signed-off-by: Michael Chan +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +index 77dadbe1a446..ceaa066bdc33 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +@@ -6577,8 +6577,8 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, + rcu_read_lock(); + hlist_for_each_entry_rcu(fltr, head, hash) { + if (bnxt_fltr_match(fltr, new_fltr)) { ++ rc = fltr->sw_id; + rcu_read_unlock(); +- rc = 0; + goto err_free; + } + } +-- +2.35.1 + diff --git a/queue-4.9/capabilities-fix-undefined-behavior-in-bit-shift-for.patch b/queue-4.9/capabilities-fix-undefined-behavior-in-bit-shift-for.patch new file mode 100644 index 00000000000..d201f493981 --- /dev/null +++ b/queue-4.9/capabilities-fix-undefined-behavior-in-bit-shift-for.patch @@ -0,0 +1,53 @@ +From 8474c9474758ac88540ea544f2c876ac06726034 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 31 Oct 2022 19:25:36 +0800 +Subject: capabilities: fix undefined behavior in bit shift for CAP_TO_MASK + +From: Gaosheng Cui + +[ Upstream commit 46653972e3ea64f79e7f8ae3aa41a4d3fdb70a13 ] + +Shifting signed 32-bit value by 31 bits is undefined, so changing +significant bit to unsigned. The UBSAN warning calltrace like below: + +UBSAN: shift-out-of-bounds in security/commoncap.c:1252:2 +left shift of 1 by 31 places cannot be represented in type 'int' +Call Trace: + + dump_stack_lvl+0x7d/0xa5 + dump_stack+0x15/0x1b + ubsan_epilogue+0xe/0x4e + __ubsan_handle_shift_out_of_bounds+0x1e7/0x20c + cap_task_prctl+0x561/0x6f0 + security_task_prctl+0x5a/0xb0 + __x64_sys_prctl+0x61/0x8f0 + do_syscall_64+0x58/0x80 + entry_SYSCALL_64_after_hwframe+0x63/0xcd + + +Fixes: e338d263a76a ("Add 64-bit capability support to the kernel") +Signed-off-by: Gaosheng Cui +Acked-by: Andrew G. Morgan +Reviewed-by: Serge Hallyn +Signed-off-by: Paul Moore +Signed-off-by: Sasha Levin +--- + include/uapi/linux/capability.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/uapi/linux/capability.h b/include/uapi/linux/capability.h +index 49bc06295398..0ba5b62a6aa0 100644 +--- a/include/uapi/linux/capability.h ++++ b/include/uapi/linux/capability.h +@@ -359,7 +359,7 @@ struct vfs_cap_data { + */ + + #define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */ +-#define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */ ++#define CAP_TO_MASK(x) (1U << ((x) & 31)) /* mask for indexed __u32 */ + + + #endif /* _UAPI_LINUX_CAPABILITY_H */ +-- +2.35.1 + diff --git a/queue-4.9/dmaengine-mv_xor_v2-fix-a-resource-leak-in-mv_xor_v2.patch b/queue-4.9/dmaengine-mv_xor_v2-fix-a-resource-leak-in-mv_xor_v2.patch new file mode 100644 index 00000000000..ca361064e4e --- /dev/null +++ b/queue-4.9/dmaengine-mv_xor_v2-fix-a-resource-leak-in-mv_xor_v2.patch @@ -0,0 +1,38 @@ +From 6e0ab4139f560d3f87a534d74f717bc7e638bbd9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Oct 2022 21:50:09 +0200 +Subject: dmaengine: mv_xor_v2: Fix a resource leak in mv_xor_v2_remove() + +From: Christophe JAILLET + +[ Upstream commit 081195d17a0c4c636da2b869bd5809d42e8cbb13 ] + +A clk_prepare_enable() call in the probe is not balanced by a corresponding +clk_disable_unprepare() in the remove function. + +Add the missing call. + +Fixes: 3cd2c313f1d6 ("dmaengine: mv_xor_v2: Fix clock resource by adding a register clock") +Signed-off-by: Christophe JAILLET +Link: https://lore.kernel.org/r/e9e3837a680c9bd2438e4db2b83270c6c052d005.1666640987.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/mv_xor_v2.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c +index be1f5c26fae8..9eb5647fef3e 100644 +--- a/drivers/dma/mv_xor_v2.c ++++ b/drivers/dma/mv_xor_v2.c +@@ -847,6 +847,7 @@ static int mv_xor_v2_remove(struct platform_device *pdev) + tasklet_kill(&xor_dev->irq_tasklet); + + clk_disable_unprepare(xor_dev->clk); ++ clk_disable_unprepare(xor_dev->reg_clk); + + return 0; + } +-- +2.35.1 + diff --git a/queue-4.9/drivers-net-xgene-disable-napi-when-register-irq-fai.patch b/queue-4.9/drivers-net-xgene-disable-napi-when-register-irq-fai.patch new file mode 100644 index 00000000000..0388b3a5a22 --- /dev/null +++ b/queue-4.9/drivers-net-xgene-disable-napi-when-register-irq-fai.patch @@ -0,0 +1,42 @@ +From f2f607e34b67d8936ffeb2758f502a2290cc6501 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Nov 2022 12:30:32 +0800 +Subject: drivers: net: xgene: disable napi when register irq failed in + xgene_enet_open() + +From: Zhengchao Shao + +[ Upstream commit ce9e57feeed81d17d5e80ed86f516ff0d39c3867 ] + +When failed to register irq in xgene_enet_open() for opening device, +napi isn't disabled. When open xgene device next time, it will reports +a invalid opcode issue. Fix it. Only be compiled, not be tested. + +Fixes: aeb20b6b3f4e ("drivers: net: xgene: fix: ifconfig up/down crash") +Signed-off-by: Zhengchao Shao +Link: https://lore.kernel.org/r/20221107043032.357673-1-shaozhengchao@huawei.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +index 17c07837033f..3eeae65bcc5a 100644 +--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c ++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +@@ -805,8 +805,10 @@ static int xgene_enet_open(struct net_device *ndev) + + xgene_enet_napi_enable(pdata); + ret = xgene_enet_register_irq(ndev); +- if (ret) ++ if (ret) { ++ xgene_enet_napi_disable(pdata); + return ret; ++ } + + if (ndev->phydev) { + phy_start(ndev->phydev); +-- +2.35.1 + diff --git a/queue-4.9/ethernet-s2io-disable-napi-when-start-nic-failed-in-.patch b/queue-4.9/ethernet-s2io-disable-napi-when-start-nic-failed-in-.patch new file mode 100644 index 00000000000..f8af7b1a8cd --- /dev/null +++ b/queue-4.9/ethernet-s2io-disable-napi-when-start-nic-failed-in-.patch @@ -0,0 +1,86 @@ +From 0f34d59d349b0fc2adb1401194b0c316ff57014a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Nov 2022 10:37:41 +0800 +Subject: ethernet: s2io: disable napi when start nic failed in s2io_card_up() + +From: Zhengchao Shao + +[ Upstream commit 0348c1ab980c1d43fb37b758d4b760990c066cb5 ] + +When failed to start nic or add interrupt service routine in +s2io_card_up() for opening device, napi isn't disabled. When open +s2io device next time, it will trigger a BUG_ON()in napi_enable(). +Compile tested only. + +Fixes: 5f490c968056 ("S2io: Fixed synchronization between scheduling of napi with card reset and close") +Signed-off-by: Zhengchao Shao +Link: https://lore.kernel.org/r/20221109023741.131552-1-shaozhengchao@huawei.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/neterion/s2io.c | 29 +++++++++++++++++++--------- + 1 file changed, 20 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c +index a1447d7ff48b..a66f4b867e3a 100644 +--- a/drivers/net/ethernet/neterion/s2io.c ++++ b/drivers/net/ethernet/neterion/s2io.c +@@ -7171,9 +7171,8 @@ static int s2io_card_up(struct s2io_nic *sp) + if (ret) { + DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n", + dev->name); +- s2io_reset(sp); +- free_rx_buffers(sp); +- return -ENOMEM; ++ ret = -ENOMEM; ++ goto err_fill_buff; + } + DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i, + ring->rx_bufs_left); +@@ -7211,18 +7210,16 @@ static int s2io_card_up(struct s2io_nic *sp) + /* Enable Rx Traffic and interrupts on the NIC */ + if (start_nic(sp)) { + DBG_PRINT(ERR_DBG, "%s: Starting NIC failed\n", dev->name); +- s2io_reset(sp); +- free_rx_buffers(sp); +- return -ENODEV; ++ ret = -ENODEV; ++ goto err_out; + } + + /* Add interrupt service routine */ + if (s2io_add_isr(sp) != 0) { + if (sp->config.intr_type == MSI_X) + s2io_rem_isr(sp); +- s2io_reset(sp); +- free_rx_buffers(sp); +- return -ENODEV; ++ ret = -ENODEV; ++ goto err_out; + } + + S2IO_TIMER_CONF(sp->alarm_timer, s2io_alarm_handle, sp, (HZ/2)); +@@ -7241,6 +7238,20 @@ static int s2io_card_up(struct s2io_nic *sp) + } + + return 0; ++ ++err_out: ++ if (config->napi) { ++ if (config->intr_type == MSI_X) { ++ for (i = 0; i < sp->config.rx_ring_num; i++) ++ napi_disable(&sp->mac_control.rings[i].napi); ++ } else { ++ napi_disable(&sp->napi); ++ } ++ } ++err_fill_buff: ++ s2io_reset(sp); ++ free_rx_buffers(sp); ++ return ret; + } + + /** +-- +2.35.1 + diff --git a/queue-4.9/hamradio-fix-issue-of-dev-reference-count-leakage-in.patch b/queue-4.9/hamradio-fix-issue-of-dev-reference-count-leakage-in.patch new file mode 100644 index 00000000000..a27aa5957ab --- /dev/null +++ b/queue-4.9/hamradio-fix-issue-of-dev-reference-count-leakage-in.patch @@ -0,0 +1,49 @@ +From 0f9a8fc2fb6181e1b94580a603c9ec7e3941d5db Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Nov 2022 17:09:05 +0800 +Subject: hamradio: fix issue of dev reference count leakage in + bpq_device_event() + +From: Zhengchao Shao + +[ Upstream commit 85cbaf032d3cd9f595152625eda5d4ecb1d6d78d ] + +When following tests are performed, it will cause dev reference counting +leakage. +a)ip link add bond2 type bond mode balance-rr +b)ip link set bond2 up +c)ifenslave -f bond2 rose1 +d)ip link del bond2 + +When new bond device is created, the default type of the bond device is +ether. And the bond device is up, bpq_device_event() receives the message +and creates a new bpq device. In this case, the reference count value of +dev is hold once. But after "ifenslave -f bond2 rose1" command is +executed, the type of the bond device is changed to rose. When the bond +device is unregistered, bpq_device_event() will not put the dev reference +count. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Zhengchao Shao +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/hamradio/bpqether.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c +index f5e0983ae2a1..7b766301189a 100644 +--- a/drivers/net/hamradio/bpqether.c ++++ b/drivers/net/hamradio/bpqether.c +@@ -551,7 +551,7 @@ static int bpq_device_event(struct notifier_block *this, + if (!net_eq(dev_net(dev), &init_net)) + return NOTIFY_DONE; + +- if (!dev_is_ethdev(dev)) ++ if (!dev_is_ethdev(dev) && !bpq_get_ax25_dev(dev)) + return NOTIFY_DONE; + + switch (event) { +-- +2.35.1 + diff --git a/queue-4.9/hid-hyperv-fix-possible-memory-leak-in-mousevsc_prob.patch b/queue-4.9/hid-hyperv-fix-possible-memory-leak-in-mousevsc_prob.patch new file mode 100644 index 00000000000..828f0efd59d --- /dev/null +++ b/queue-4.9/hid-hyperv-fix-possible-memory-leak-in-mousevsc_prob.patch @@ -0,0 +1,37 @@ +From 8780d25af6f9972af6283b8031624b3ef0697e9c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Oct 2022 21:40:43 +0800 +Subject: HID: hyperv: fix possible memory leak in mousevsc_probe() + +From: Yang Yingliang + +[ Upstream commit b5bcb94b0954a026bbd671741fdb00e7141f9c91 ] + +If hid_add_device() returns error, it should call hid_destroy_device() +to free hid_dev which is allocated in hid_allocate_device(). + +Fixes: 74c4fb058083 ("HID: hv_mouse: Properly add the hid device") +Signed-off-by: Yang Yingliang +Reviewed-by: Wei Liu +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-hyperv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c +index 6039f071fab1..15e20d5e76dd 100644 +--- a/drivers/hid/hid-hyperv.c ++++ b/drivers/hid/hid-hyperv.c +@@ -536,7 +536,7 @@ static int mousevsc_probe(struct hv_device *device, + + ret = hid_add_device(hid_dev); + if (ret) +- goto probe_err1; ++ goto probe_err2; + + + ret = hid_parse(hid_dev); +-- +2.35.1 + diff --git a/queue-4.9/ipv6-addrlabel-fix-infoleak-when-sending-struct-ifad.patch b/queue-4.9/ipv6-addrlabel-fix-infoleak-when-sending-struct-ifad.patch new file mode 100644 index 00000000000..160ad677767 --- /dev/null +++ b/queue-4.9/ipv6-addrlabel-fix-infoleak-when-sending-struct-ifad.patch @@ -0,0 +1,77 @@ +From 1f5b7a1a7fe12964326088984d3e8b86e882c479 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Nov 2022 11:32:16 +0100 +Subject: ipv6: addrlabel: fix infoleak when sending struct ifaddrlblmsg to + network + +From: Alexander Potapenko + +[ Upstream commit c23fb2c82267638f9d206cb96bb93e1f93ad7828 ] + +When copying a `struct ifaddrlblmsg` to the network, __ifal_reserved +remained uninitialized, resulting in a 1-byte infoleak: + + BUG: KMSAN: kernel-network-infoleak in __netdev_start_xmit ./include/linux/netdevice.h:4841 + __netdev_start_xmit ./include/linux/netdevice.h:4841 + netdev_start_xmit ./include/linux/netdevice.h:4857 + xmit_one net/core/dev.c:3590 + dev_hard_start_xmit+0x1dc/0x800 net/core/dev.c:3606 + __dev_queue_xmit+0x17e8/0x4350 net/core/dev.c:4256 + dev_queue_xmit ./include/linux/netdevice.h:3009 + __netlink_deliver_tap_skb net/netlink/af_netlink.c:307 + __netlink_deliver_tap+0x728/0xad0 net/netlink/af_netlink.c:325 + netlink_deliver_tap net/netlink/af_netlink.c:338 + __netlink_sendskb net/netlink/af_netlink.c:1263 + netlink_sendskb+0x1d9/0x200 net/netlink/af_netlink.c:1272 + netlink_unicast+0x56d/0xf50 net/netlink/af_netlink.c:1360 + nlmsg_unicast ./include/net/netlink.h:1061 + rtnl_unicast+0x5a/0x80 net/core/rtnetlink.c:758 + ip6addrlbl_get+0xfad/0x10f0 net/ipv6/addrlabel.c:628 + rtnetlink_rcv_msg+0xb33/0x1570 net/core/rtnetlink.c:6082 + ... + Uninit was created at: + slab_post_alloc_hook+0x118/0xb00 mm/slab.h:742 + slab_alloc_node mm/slub.c:3398 + __kmem_cache_alloc_node+0x4f2/0x930 mm/slub.c:3437 + __do_kmalloc_node mm/slab_common.c:954 + __kmalloc_node_track_caller+0x117/0x3d0 mm/slab_common.c:975 + kmalloc_reserve net/core/skbuff.c:437 + __alloc_skb+0x27a/0xab0 net/core/skbuff.c:509 + alloc_skb ./include/linux/skbuff.h:1267 + nlmsg_new ./include/net/netlink.h:964 + ip6addrlbl_get+0x490/0x10f0 net/ipv6/addrlabel.c:608 + rtnetlink_rcv_msg+0xb33/0x1570 net/core/rtnetlink.c:6082 + netlink_rcv_skb+0x299/0x550 net/netlink/af_netlink.c:2540 + rtnetlink_rcv+0x26/0x30 net/core/rtnetlink.c:6109 + netlink_unicast_kernel net/netlink/af_netlink.c:1319 + netlink_unicast+0x9ab/0xf50 net/netlink/af_netlink.c:1345 + netlink_sendmsg+0xebc/0x10f0 net/netlink/af_netlink.c:1921 + ... + +This patch ensures that the reserved field is always initialized. + +Reported-by: syzbot+3553517af6020c4f2813f1003fe76ef3cbffe98d@syzkaller.appspotmail.com +Fixes: 2a8cc6c89039 ("[IPV6] ADDRCONF: Support RFC3484 configurable address selection policy table.") +Signed-off-by: Alexander Potapenko +Reviewed-by: David Ahern +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv6/addrlabel.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c +index a8f6986dcbe5..2297df80d3ca 100644 +--- a/net/ipv6/addrlabel.c ++++ b/net/ipv6/addrlabel.c +@@ -458,6 +458,7 @@ static void ip6addrlbl_putmsg(struct nlmsghdr *nlh, + { + struct ifaddrlblmsg *ifal = nlmsg_data(nlh); + ifal->ifal_family = AF_INET6; ++ ifal->__ifal_reserved = 0; + ifal->ifal_prefixlen = prefixlen; + ifal->ifal_flags = 0; + ifal->ifal_index = ifindex; +-- +2.35.1 + diff --git a/queue-4.9/net-cxgb3_main-disable-napi-when-bind-qsets-failed-i.patch b/queue-4.9/net-cxgb3_main-disable-napi-when-bind-qsets-failed-i.patch new file mode 100644 index 00000000000..dd291e57bac --- /dev/null +++ b/queue-4.9/net-cxgb3_main-disable-napi-when-bind-qsets-failed-i.patch @@ -0,0 +1,37 @@ +From 323c492225aa19fb3a512af86eec67c0fc1aba18 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Nov 2022 10:14:51 +0800 +Subject: net: cxgb3_main: disable napi when bind qsets failed in cxgb_up() + +From: Zhengchao Shao + +[ Upstream commit d75aed1428da787cbe42bc073d76f1354f364d92 ] + +When failed to bind qsets in cxgb_up() for opening device, napi isn't +disabled. When open cxgb3 device next time, it will trigger a BUG_ON() +in napi_enable(). Compile tested only. + +Fixes: 48c4b6dbb7e2 ("cxgb3 - fix port up/down error path") +Signed-off-by: Zhengchao Shao +Link: https://lore.kernel.org/r/20221109021451.121490-1-shaozhengchao@huawei.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +index 9627ed0b2f1c..6d08fd3284dc 100644 +--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c ++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +@@ -1304,6 +1304,7 @@ static int cxgb_up(struct adapter *adap) + if (ret < 0) { + CH_ERR(adap, "failed to bind qsets, err %d\n", ret); + t3_intr_disable(adap); ++ quiesce_rx(adap); + free_irq_resources(adap); + err = ret; + goto out; +-- +2.35.1 + diff --git a/queue-4.9/net-fman-unregister-ethernet-device-on-removal.patch b/queue-4.9/net-fman-unregister-ethernet-device-on-removal.patch new file mode 100644 index 00000000000..a55ae3b24f5 --- /dev/null +++ b/queue-4.9/net-fman-unregister-ethernet-device-on-removal.patch @@ -0,0 +1,53 @@ +From 0fd65050ca23ab6c7457abf1855ae0c534414b0a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Nov 2022 14:28:30 -0400 +Subject: net: fman: Unregister ethernet device on removal + +From: Sean Anderson + +[ Upstream commit b7cbc6740bd6ad5d43345a2504f7e4beff0d709f ] + +When the mac device gets removed, it leaves behind the ethernet device. +This will result in a segfault next time the ethernet device accesses +mac_dev. Remove the ethernet device when we get removed to prevent +this. This is not completely reversible, since some resources aren't +cleaned up properly, but that can be addressed later. + +Fixes: 3933961682a3 ("fsl/fman: Add FMan MAC driver") +Signed-off-by: Sean Anderson +Link: https://lore.kernel.org/r/20221103182831.2248833-1-sean.anderson@seco.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/fman/mac.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c +index 93b7ed361b82..dca6fd114bb5 100644 +--- a/drivers/net/ethernet/freescale/fman/mac.c ++++ b/drivers/net/ethernet/freescale/fman/mac.c +@@ -953,12 +953,21 @@ static int mac_probe(struct platform_device *_of_dev) + return err; + } + ++static int mac_remove(struct platform_device *pdev) ++{ ++ struct mac_device *mac_dev = platform_get_drvdata(pdev); ++ ++ platform_device_unregister(mac_dev->priv->eth_dev); ++ return 0; ++} ++ + static struct platform_driver mac_driver = { + .driver = { + .name = KBUILD_MODNAME, + .of_match_table = mac_match, + }, + .probe = mac_probe, ++ .remove = mac_remove, + }; + + builtin_platform_driver(mac_driver); +-- +2.35.1 + diff --git a/queue-4.9/net-gso-fix-panic-on-frag_list-with-mixed-head-alloc.patch b/queue-4.9/net-gso-fix-panic-on-frag_list-with-mixed-head-alloc.patch new file mode 100644 index 00000000000..58f00d80860 --- /dev/null +++ b/queue-4.9/net-gso-fix-panic-on-frag_list-with-mixed-head-alloc.patch @@ -0,0 +1,105 @@ +From b2bd31bf037ebc06d758f9bc14f72cbda14d59f0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 2 Nov 2022 17:53:25 +0100 +Subject: net: gso: fix panic on frag_list with mixed head alloc types + +From: Jiri Benc + +[ Upstream commit 9e4b7a99a03aefd37ba7bb1f022c8efab5019165 ] + +Since commit 3dcbdb134f32 ("net: gso: Fix skb_segment splat when +splitting gso_size mangled skb having linear-headed frag_list"), it is +allowed to change gso_size of a GRO packet. However, that commit assumes +that "checking the first list_skb member suffices; i.e if either of the +list_skb members have non head_frag head, then the first one has too". + +It turns out this assumption does not hold. We've seen BUG_ON being hit +in skb_segment when skbs on the frag_list had differing head_frag with +the vmxnet3 driver. This happens because __netdev_alloc_skb and +__napi_alloc_skb can return a skb that is page backed or kmalloced +depending on the requested size. As the result, the last small skb in +the GRO packet can be kmalloced. + +There are three different locations where this can be fixed: + +(1) We could check head_frag in GRO and not allow GROing skbs with + different head_frag. However, that would lead to performance + regression on normal forward paths with unmodified gso_size, where + !head_frag in the last packet is not a problem. + +(2) Set a flag in bpf_skb_net_grow and bpf_skb_net_shrink indicating + that NETIF_F_SG is undesirable. That would need to eat a bit in + sk_buff. Furthermore, that flag can be unset when all skbs on the + frag_list are page backed. To retain good performance, + bpf_skb_net_grow/shrink would have to walk the frag_list. + +(3) Walk the frag_list in skb_segment when determining whether + NETIF_F_SG should be cleared. This of course slows things down. + +This patch implements (3). To limit the performance impact in +skb_segment, the list is walked only for skbs with SKB_GSO_DODGY set +that have gso_size changed. Normal paths thus will not hit it. + +We could check only the last skb but since we need to walk the whole +list anyway, let's stay on the safe side. + +Fixes: 3dcbdb134f32 ("net: gso: Fix skb_segment splat when splitting gso_size mangled skb having linear-headed frag_list") +Signed-off-by: Jiri Benc +Reviewed-by: Willem de Bruijn +Link: https://lore.kernel.org/r/e04426a6a91baf4d1081e1b478c82b5de25fdf21.1667407944.git.jbenc@redhat.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/core/skbuff.c | 36 +++++++++++++++++++----------------- + 1 file changed, 19 insertions(+), 17 deletions(-) + +diff --git a/net/core/skbuff.c b/net/core/skbuff.c +index 022e26c18024..5dcdbffdee49 100644 +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -3125,23 +3125,25 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, + int pos; + int dummy; + +- if (list_skb && !list_skb->head_frag && skb_headlen(list_skb) && +- (skb_shinfo(head_skb)->gso_type & SKB_GSO_DODGY)) { +- /* gso_size is untrusted, and we have a frag_list with a linear +- * non head_frag head. +- * +- * (we assume checking the first list_skb member suffices; +- * i.e if either of the list_skb members have non head_frag +- * head, then the first one has too). +- * +- * If head_skb's headlen does not fit requested gso_size, it +- * means that the frag_list members do NOT terminate on exact +- * gso_size boundaries. Hence we cannot perform skb_frag_t page +- * sharing. Therefore we must fallback to copying the frag_list +- * skbs; we do so by disabling SG. +- */ +- if (mss != GSO_BY_FRAGS && mss != skb_headlen(head_skb)) +- features &= ~NETIF_F_SG; ++ if ((skb_shinfo(head_skb)->gso_type & SKB_GSO_DODGY) && ++ mss != GSO_BY_FRAGS && mss != skb_headlen(head_skb)) { ++ struct sk_buff *check_skb; ++ ++ for (check_skb = list_skb; check_skb; check_skb = check_skb->next) { ++ if (skb_headlen(check_skb) && !check_skb->head_frag) { ++ /* gso_size is untrusted, and we have a frag_list with ++ * a linear non head_frag item. ++ * ++ * If head_skb's headlen does not fit requested gso_size, ++ * it means that the frag_list members do NOT terminate ++ * on exact gso_size boundaries. Hence we cannot perform ++ * skb_frag_t page sharing. Therefore we must fallback to ++ * copying the frag_list skbs; we do so by disabling SG. ++ */ ++ features &= ~NETIF_F_SG; ++ break; ++ } ++ } + } + + __skb_push(head_skb, doffset); +-- +2.35.1 + diff --git a/queue-4.9/net-lapbether-fix-issue-of-dev-reference-count-leaka.patch b/queue-4.9/net-lapbether-fix-issue-of-dev-reference-count-leaka.patch new file mode 100644 index 00000000000..48a5deceb2e --- /dev/null +++ b/queue-4.9/net-lapbether-fix-issue-of-dev-reference-count-leaka.patch @@ -0,0 +1,49 @@ +From ec15d6c34af19cdd19a0bb200aa1087073f43530 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Nov 2022 17:05:37 +0800 +Subject: net: lapbether: fix issue of dev reference count leakage in + lapbeth_device_event() + +From: Zhengchao Shao + +[ Upstream commit 531705a765493655472c993627106e19f7e5a6d2 ] + +When following tests are performed, it will cause dev reference counting +leakage. +a)ip link add bond2 type bond mode balance-rr +b)ip link set bond2 up +c)ifenslave -f bond2 rose1 +d)ip link del bond2 + +When new bond device is created, the default type of the bond device is +ether. And the bond device is up, lapbeth_device_event() receives the +message and creates a new lapbeth device. In this case, the reference +count value of dev is hold once. But after "ifenslave -f bond2 rose1" +command is executed, the type of the bond device is changed to rose. When +the bond device is unregistered, lapbeth_device_event() will not put the +dev reference count. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Zhengchao Shao +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/wan/lapbether.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c +index 24daa1d0e9c5..2741bbe09ba4 100644 +--- a/drivers/net/wan/lapbether.c ++++ b/drivers/net/wan/lapbether.c +@@ -407,7 +407,7 @@ static int lapbeth_device_event(struct notifier_block *this, + if (dev_net(dev) != &init_net) + return NOTIFY_DONE; + +- if (!dev_is_ethdev(dev)) ++ if (!dev_is_ethdev(dev) && !lapbeth_get_x25_dev(dev)) + return NOTIFY_DONE; + + switch (event) { +-- +2.35.1 + diff --git a/queue-4.9/net-macvlan-fix-memory-leaks-of-macvlan_common_newli.patch b/queue-4.9/net-macvlan-fix-memory-leaks-of-macvlan_common_newli.patch new file mode 100644 index 00000000000..65b624629d6 --- /dev/null +++ b/queue-4.9/net-macvlan-fix-memory-leaks-of-macvlan_common_newli.patch @@ -0,0 +1,68 @@ +From 096154b3567fe3a3b600501185a3c080334f9164 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Nov 2022 17:07:34 +0800 +Subject: net: macvlan: fix memory leaks of macvlan_common_newlink + +From: Chuang Wang + +[ Upstream commit 23569b5652ee8e8e55a12f7835f59af6f3cefc30 ] + +kmemleak reports memory leaks in macvlan_common_newlink, as follows: + + ip link add link eth0 name .. type macvlan mode source macaddr add + + +kmemleak reports: + +unreferenced object 0xffff8880109bb140 (size 64): + comm "ip", pid 284, jiffies 4294986150 (age 430.108s) + hex dump (first 32 bytes): + 00 00 00 00 00 00 00 00 b8 aa 5a 12 80 88 ff ff ..........Z..... + 80 1b fa 0d 80 88 ff ff 1e ff ac af c7 c1 6b 6b ..............kk + backtrace: + [] kmem_cache_alloc_trace+0x1c7/0x300 + [] macvlan_hash_add_source+0x45/0xc0 + [] macvlan_changelink_sources+0xd7/0x170 + [] macvlan_common_newlink+0x38c/0x5a0 + [] macvlan_newlink+0xe/0x20 + [] __rtnl_newlink+0x7af/0xa50 + [] rtnl_newlink+0x48/0x70 + ... + +In the scenario where the macvlan mode is configured as 'source', +macvlan_changelink_sources() will be execured to reconfigure list of +remote source mac addresses, at the same time, if register_netdevice() +return an error, the resource generated by macvlan_changelink_sources() +is not cleaned up. + +Using this patch, in the case of an error, it will execute +macvlan_flush_sources() to ensure that the resource is cleaned up. + +Fixes: aa5fd0fb7748 ("driver: macvlan: Destroy new macvlan port if macvlan_common_newlink failed.") +Signed-off-by: Chuang Wang +Link: https://lore.kernel.org/r/20221109090735.690500-1-nashuiliang@gmail.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/macvlan.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c +index 9dda2dc6b5e7..c8dbc0468ea2 100644 +--- a/drivers/net/macvlan.c ++++ b/drivers/net/macvlan.c +@@ -1392,8 +1392,10 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, + /* the macvlan port may be freed by macvlan_uninit when fail to register. + * so we destroy the macvlan port only when it's valid. + */ +- if (create && macvlan_port_get_rtnl(lowerdev)) ++ if (create && macvlan_port_get_rtnl(lowerdev)) { ++ macvlan_flush_sources(port, vlan); + macvlan_port_destroy(port->dev); ++ } + return err; + } + EXPORT_SYMBOL_GPL(macvlan_common_newlink); +-- +2.35.1 + diff --git a/queue-4.9/net-mv643xx_eth-disable-napi-when-init-rxq-or-txq-fa.patch b/queue-4.9/net-mv643xx_eth-disable-napi-when-init-rxq-or-txq-fa.patch new file mode 100644 index 00000000000..32ce869dbe7 --- /dev/null +++ b/queue-4.9/net-mv643xx_eth-disable-napi-when-init-rxq-or-txq-fa.patch @@ -0,0 +1,38 @@ +From cd564825aac68e74cc59e3a72438e2a79ee5951f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Nov 2022 10:54:32 +0800 +Subject: net: mv643xx_eth: disable napi when init rxq or txq failed in + mv643xx_eth_open() + +From: Zhengchao Shao + +[ Upstream commit f111606b63ff2282428ffbac0447c871eb957b6c ] + +When failed to init rxq or txq in mv643xx_eth_open() for opening device, +napi isn't disabled. When open mv643xx_eth device next time, it will +trigger a BUG_ON() in napi_enable(). Compile tested only. + +Fixes: 2257e05c1705 ("mv643xx_eth: get rid of receive-side locking") +Signed-off-by: Zhengchao Shao +Link: https://lore.kernel.org/r/20221109025432.80900-1-shaozhengchao@huawei.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/mv643xx_eth.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c +index 526d07e02bbc..d91118f2e24f 100644 +--- a/drivers/net/ethernet/marvell/mv643xx_eth.c ++++ b/drivers/net/ethernet/marvell/mv643xx_eth.c +@@ -2491,6 +2491,7 @@ static int mv643xx_eth_open(struct net_device *dev) + for (i = 0; i < mp->rxq_count; i++) + rxq_deinit(mp->rxq + i); + out: ++ napi_disable(&mp->napi); + free_irq(dev->irq, dev); + + return err; +-- +2.35.1 + diff --git a/queue-4.9/series b/queue-4.9/series new file mode 100644 index 00000000000..72fec173ee8 --- /dev/null +++ b/queue-4.9/series @@ -0,0 +1,15 @@ +hid-hyperv-fix-possible-memory-leak-in-mousevsc_prob.patch +net-gso-fix-panic-on-frag_list-with-mixed-head-alloc.patch +bnxt_en-fix-potentially-incorrect-return-value-for-n.patch +net-fman-unregister-ethernet-device-on-removal.patch +capabilities-fix-undefined-behavior-in-bit-shift-for.patch +net-lapbether-fix-issue-of-dev-reference-count-leaka.patch +hamradio-fix-issue-of-dev-reference-count-leakage-in.patch +ipv6-addrlabel-fix-infoleak-when-sending-struct-ifad.patch +tipc-fix-the-msg-req-tlv-len-check-in-tipc_nl_compat.patch +dmaengine-mv_xor_v2-fix-a-resource-leak-in-mv_xor_v2.patch +drivers-net-xgene-disable-napi-when-register-irq-fai.patch +net-cxgb3_main-disable-napi-when-bind-qsets-failed-i.patch +ethernet-s2io-disable-napi-when-start-nic-failed-in-.patch +net-mv643xx_eth-disable-napi-when-init-rxq-or-txq-fa.patch +net-macvlan-fix-memory-leaks-of-macvlan_common_newli.patch diff --git a/queue-4.9/tipc-fix-the-msg-req-tlv-len-check-in-tipc_nl_compat.patch b/queue-4.9/tipc-fix-the-msg-req-tlv-len-check-in-tipc_nl_compat.patch new file mode 100644 index 00000000000..e79a67451b3 --- /dev/null +++ b/queue-4.9/tipc-fix-the-msg-req-tlv-len-check-in-tipc_nl_compat.patch @@ -0,0 +1,59 @@ +From 9f978a3c5b42373d5bc5cfb93844a1092884098a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Nov 2022 16:48:53 -0400 +Subject: tipc: fix the msg->req tlv len check in + tipc_nl_compat_name_table_dump_header + +From: Xin Long + +[ Upstream commit 1c075b192fe41030457cd4a5f7dea730412bca40 ] + +This is a follow-up for commit 974cb0e3e7c9 ("tipc: fix uninit-value +in tipc_nl_compat_name_table_dump") where it should have type casted +sizeof(..) to int to work when TLV_GET_DATA_LEN() returns a negative +value. + +syzbot reported a call trace because of it: + + BUG: KMSAN: uninit-value in ... + tipc_nl_compat_name_table_dump+0x841/0xea0 net/tipc/netlink_compat.c:934 + __tipc_nl_compat_dumpit+0xab2/0x1320 net/tipc/netlink_compat.c:238 + tipc_nl_compat_dumpit+0x991/0xb50 net/tipc/netlink_compat.c:321 + tipc_nl_compat_recv+0xb6e/0x1640 net/tipc/netlink_compat.c:1324 + genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline] + genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] + genl_rcv_msg+0x103f/0x1260 net/netlink/genetlink.c:792 + netlink_rcv_skb+0x3a5/0x6c0 net/netlink/af_netlink.c:2501 + genl_rcv+0x3c/0x50 net/netlink/genetlink.c:803 + netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] + netlink_unicast+0xf3b/0x1270 net/netlink/af_netlink.c:1345 + netlink_sendmsg+0x1288/0x1440 net/netlink/af_netlink.c:1921 + sock_sendmsg_nosec net/socket.c:714 [inline] + sock_sendmsg net/socket.c:734 [inline] + +Reported-by: syzbot+e5dbaaa238680ce206ea@syzkaller.appspotmail.com +Fixes: 974cb0e3e7c9 ("tipc: fix uninit-value in tipc_nl_compat_name_table_dump") +Signed-off-by: Xin Long +Link: https://lore.kernel.org/r/ccd6a7ea801b15aec092c3b532a883b4c5708695.1667594933.git.lucien.xin@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/tipc/netlink_compat.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c +index 69151de9657c..2e6c33fbd238 100644 +--- a/net/tipc/netlink_compat.c ++++ b/net/tipc/netlink_compat.c +@@ -856,7 +856,7 @@ static int tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg) + }; + + ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); +- if (TLV_GET_DATA_LEN(msg->req) < sizeof(struct tipc_name_table_query)) ++ if (TLV_GET_DATA_LEN(msg->req) < (int)sizeof(struct tipc_name_table_query)) + return -EINVAL; + + depth = ntohl(ntq->depth); +-- +2.35.1 +