From: Sasha Levin Date: Sun, 9 Mar 2025 19:40:23 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v5.4.291~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac981210c112d7b447785b2c527461884c42a370;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/be2net-fix-sleeping-while-atomic-bugs-in-be_ndo_brid.patch b/queue-5.4/be2net-fix-sleeping-while-atomic-bugs-in-be_ndo_brid.patch new file mode 100644 index 0000000000..15dbedee22 --- /dev/null +++ b/queue-5.4/be2net-fix-sleeping-while-atomic-bugs-in-be_ndo_brid.patch @@ -0,0 +1,951 @@ +From ab62023e352d575feea726d498bfbbe67c7ffd59 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Feb 2025 18:41:29 +0200 +Subject: be2net: fix sleeping while atomic bugs in be_ndo_bridge_getlink + +From: Nikolay Aleksandrov + +[ Upstream commit 1a82d19ca2d6835904ee71e2d40fd331098f94a0 ] + +Partially revert commit b71724147e73 ("be2net: replace polling with +sleeping in the FW completion path") w.r.t mcc mutex it introduces and the +use of usleep_range. The be2net be_ndo_bridge_getlink() callback is +called with rcu_read_lock, so this code has been broken for a long time. +Both the mutex_lock and the usleep_range can cause the issue Ian Kumlien +reported[1]. The call path is: +be_ndo_bridge_getlink -> be_cmd_get_hsw_config -> be_mcc_notify_wait -> +be_mcc_wait_compl -> usleep_range() + +[1] https://lore.kernel.org/netdev/CAA85sZveppNgEVa_FD+qhOMtG_AavK9_mFiU+jWrMtXmwqefGA@mail.gmail.com/ + +Tested-by: Ian Kumlien +Fixes: b71724147e73 ("be2net: replace polling with sleeping in the FW completion path") +Signed-off-by: Nikolay Aleksandrov +Link: https://patch.msgid.link/20250227164129.1201164-1-razor@blackwall.org +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/emulex/benet/be.h | 2 +- + drivers/net/ethernet/emulex/benet/be_cmds.c | 197 ++++++++++---------- + drivers/net/ethernet/emulex/benet/be_main.c | 2 +- + 3 files changed, 100 insertions(+), 101 deletions(-) + +diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h +index cf3e6f2892ff2..ad72599aa8943 100644 +--- a/drivers/net/ethernet/emulex/benet/be.h ++++ b/drivers/net/ethernet/emulex/benet/be.h +@@ -564,7 +564,7 @@ struct be_adapter { + struct be_dma_mem mbox_mem_alloced; + + struct be_mcc_obj mcc_obj; +- struct mutex mcc_lock; /* For serializing mcc cmds to BE card */ ++ spinlock_t mcc_lock; /* For serializing mcc cmds to BE card */ + spinlock_t mcc_cq_lock; + + u16 cfg_num_rx_irqs; /* configured via set-channels */ +diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c +index 1288b5e3d2201..9812a9a5d033b 100644 +--- a/drivers/net/ethernet/emulex/benet/be_cmds.c ++++ b/drivers/net/ethernet/emulex/benet/be_cmds.c +@@ -573,7 +573,7 @@ int be_process_mcc(struct be_adapter *adapter) + /* Wait till no more pending mcc requests are present */ + static int be_mcc_wait_compl(struct be_adapter *adapter) + { +-#define mcc_timeout 12000 /* 12s timeout */ ++#define mcc_timeout 120000 /* 12s timeout */ + int i, status = 0; + struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; + +@@ -587,7 +587,7 @@ static int be_mcc_wait_compl(struct be_adapter *adapter) + + if (atomic_read(&mcc_obj->q.used) == 0) + break; +- usleep_range(500, 1000); ++ udelay(100); + } + if (i == mcc_timeout) { + dev_err(&adapter->pdev->dev, "FW not responding\n"); +@@ -865,7 +865,7 @@ static bool use_mcc(struct be_adapter *adapter) + static int be_cmd_lock(struct be_adapter *adapter) + { + if (use_mcc(adapter)) { +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + return 0; + } else { + return mutex_lock_interruptible(&adapter->mbox_lock); +@@ -876,7 +876,7 @@ static int be_cmd_lock(struct be_adapter *adapter) + static void be_cmd_unlock(struct be_adapter *adapter) + { + if (use_mcc(adapter)) +- return mutex_unlock(&adapter->mcc_lock); ++ return spin_unlock_bh(&adapter->mcc_lock); + else + return mutex_unlock(&adapter->mbox_lock); + } +@@ -1046,7 +1046,7 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, + struct be_cmd_req_mac_query *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1075,7 +1075,7 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, + } + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1087,7 +1087,7 @@ int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, + struct be_cmd_req_pmac_add *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1112,7 +1112,7 @@ int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, + } + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + + if (base_status(status) == MCC_STATUS_UNAUTHORIZED_REQUEST) + status = -EPERM; +@@ -1130,7 +1130,7 @@ int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, int pmac_id, u32 dom) + if (pmac_id == -1) + return 0; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1150,7 +1150,7 @@ int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, int pmac_id, u32 dom) + status = be_mcc_notify_wait(adapter); + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1413,7 +1413,7 @@ int be_cmd_rxq_create(struct be_adapter *adapter, + struct be_dma_mem *q_mem = &rxq->dma_mem; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1443,7 +1443,7 @@ int be_cmd_rxq_create(struct be_adapter *adapter, + } + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1507,7 +1507,7 @@ int be_cmd_rxq_destroy(struct be_adapter *adapter, struct be_queue_info *q) + struct be_cmd_req_q_destroy *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1524,7 +1524,7 @@ int be_cmd_rxq_destroy(struct be_adapter *adapter, struct be_queue_info *q) + q->created = false; + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1592,7 +1592,7 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd) + struct be_cmd_req_hdr *hdr; + int status = 0; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1620,7 +1620,7 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd) + adapter->stats_cmd_sent = true; + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1636,7 +1636,7 @@ int lancer_cmd_get_pport_stats(struct be_adapter *adapter, + CMD_SUBSYSTEM_ETH)) + return -EPERM; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1659,7 +1659,7 @@ int lancer_cmd_get_pport_stats(struct be_adapter *adapter, + adapter->stats_cmd_sent = true; + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1696,7 +1696,7 @@ int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed, + struct be_cmd_req_link_status *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + if (link_status) + *link_status = LINK_DOWN; +@@ -1735,7 +1735,7 @@ int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed, + } + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1746,7 +1746,7 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter) + struct be_cmd_req_get_cntl_addnl_attribs *req; + int status = 0; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1761,7 +1761,7 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter) + + status = be_mcc_notify(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1810,7 +1810,7 @@ int be_cmd_get_fat_dump(struct be_adapter *adapter, u32 buf_len, void *buf) + if (!get_fat_cmd.va) + return -ENOMEM; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + while (total_size) { + buf_size = min(total_size, (u32)60*1024); +@@ -1848,9 +1848,9 @@ int be_cmd_get_fat_dump(struct be_adapter *adapter, u32 buf_len, void *buf) + log_offset += buf_size; + } + err: ++ spin_unlock_bh(&adapter->mcc_lock); + dma_free_coherent(&adapter->pdev->dev, get_fat_cmd.size, + get_fat_cmd.va, get_fat_cmd.dma); +- mutex_unlock(&adapter->mcc_lock); + return status; + } + +@@ -1861,7 +1861,7 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter) + struct be_cmd_req_get_fw_version *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1884,7 +1884,7 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter) + sizeof(adapter->fw_on_flash)); + } + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1898,7 +1898,7 @@ static int __be_cmd_modify_eqd(struct be_adapter *adapter, + struct be_cmd_req_modify_eq_delay *req; + int status = 0, i; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1921,7 +1921,7 @@ static int __be_cmd_modify_eqd(struct be_adapter *adapter, + + status = be_mcc_notify(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1948,7 +1948,7 @@ int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, + struct be_cmd_req_vlan_config *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -1970,7 +1970,7 @@ int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, + + status = be_mcc_notify_wait(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -1981,7 +1981,7 @@ static int __be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value) + struct be_cmd_req_rx_filter *req = mem->va; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -2014,7 +2014,7 @@ static int __be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value) + + status = be_mcc_notify_wait(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -2045,7 +2045,7 @@ int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc) + CMD_SUBSYSTEM_COMMON)) + return -EPERM; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -2065,7 +2065,7 @@ int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc) + status = be_mcc_notify_wait(adapter); + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + + if (base_status(status) == MCC_STATUS_FEATURE_NOT_SUPPORTED) + return -EOPNOTSUPP; +@@ -2084,7 +2084,7 @@ int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc) + CMD_SUBSYSTEM_COMMON)) + return -EPERM; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -2107,7 +2107,7 @@ int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc) + } + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -2188,7 +2188,7 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, + if (!(be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS)) + return 0; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -2213,7 +2213,7 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, + + status = be_mcc_notify_wait(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -2225,7 +2225,7 @@ int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, + struct be_cmd_req_enable_disable_beacon *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -2246,7 +2246,7 @@ int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, + status = be_mcc_notify_wait(adapter); + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -2257,7 +2257,7 @@ int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state) + struct be_cmd_req_get_beacon_state *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -2281,7 +2281,7 @@ int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state) + } + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -2305,7 +2305,7 @@ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, + return -ENOMEM; + } + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -2327,7 +2327,7 @@ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, + memcpy(data, resp->page_data + off, len); + } + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); + return status; + } +@@ -2344,7 +2344,7 @@ static int lancer_cmd_write_object(struct be_adapter *adapter, + void *ctxt = NULL; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + adapter->flash_status = 0; + + wrb = wrb_from_mccq(adapter); +@@ -2386,7 +2386,7 @@ static int lancer_cmd_write_object(struct be_adapter *adapter, + if (status) + goto err_unlock; + +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + + if (!wait_for_completion_timeout(&adapter->et_cmd_compl, + msecs_to_jiffies(60000))) +@@ -2405,7 +2405,7 @@ static int lancer_cmd_write_object(struct be_adapter *adapter, + return status; + + err_unlock: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -2459,7 +2459,7 @@ static int lancer_cmd_delete_object(struct be_adapter *adapter, + struct be_mcc_wrb *wrb; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -2477,7 +2477,7 @@ static int lancer_cmd_delete_object(struct be_adapter *adapter, + + status = be_mcc_notify_wait(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -2490,7 +2490,7 @@ int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, + struct lancer_cmd_resp_read_object *resp; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -2524,7 +2524,7 @@ int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, + } + + err_unlock: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -2536,7 +2536,7 @@ static int be_cmd_write_flashrom(struct be_adapter *adapter, + struct be_cmd_write_flashrom *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + adapter->flash_status = 0; + + wrb = wrb_from_mccq(adapter); +@@ -2561,7 +2561,7 @@ static int be_cmd_write_flashrom(struct be_adapter *adapter, + if (status) + goto err_unlock; + +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + + if (!wait_for_completion_timeout(&adapter->et_cmd_compl, + msecs_to_jiffies(40000))) +@@ -2572,7 +2572,7 @@ static int be_cmd_write_flashrom(struct be_adapter *adapter, + return status; + + err_unlock: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -2583,7 +2583,7 @@ static int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, + struct be_mcc_wrb *wrb; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -2610,7 +2610,7 @@ static int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, + memcpy(flashed_crc, req->crc, 4); + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3216,7 +3216,7 @@ int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, + struct be_cmd_req_acpi_wol_magic_config *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3233,7 +3233,7 @@ int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, + status = be_mcc_notify_wait(adapter); + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3248,7 +3248,7 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, + CMD_SUBSYSTEM_LOWLEVEL)) + return -EPERM; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3271,7 +3271,7 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, + if (status) + goto err_unlock; + +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + + if (!wait_for_completion_timeout(&adapter->et_cmd_compl, + msecs_to_jiffies(SET_LB_MODE_TIMEOUT))) +@@ -3280,7 +3280,7 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, + return status; + + err_unlock: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3297,7 +3297,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, + CMD_SUBSYSTEM_LOWLEVEL)) + return -EPERM; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3323,7 +3323,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, + if (status) + goto err; + +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + + wait_for_completion(&adapter->et_cmd_compl); + resp = embedded_payload(wrb); +@@ -3331,7 +3331,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, + + return status; + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3347,7 +3347,7 @@ int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, + CMD_SUBSYSTEM_LOWLEVEL)) + return -EPERM; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3381,7 +3381,7 @@ int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, + } + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3392,7 +3392,7 @@ int be_cmd_get_seeprom_data(struct be_adapter *adapter, + struct be_cmd_req_seeprom_read *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3408,7 +3408,7 @@ int be_cmd_get_seeprom_data(struct be_adapter *adapter, + status = be_mcc_notify_wait(adapter); + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3423,7 +3423,7 @@ int be_cmd_get_phy_info(struct be_adapter *adapter) + CMD_SUBSYSTEM_COMMON)) + return -EPERM; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3468,7 +3468,7 @@ int be_cmd_get_phy_info(struct be_adapter *adapter) + } + dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3478,7 +3478,7 @@ static int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain) + struct be_cmd_req_set_qos *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3498,7 +3498,7 @@ static int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain) + status = be_mcc_notify_wait(adapter); + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3610,7 +3610,7 @@ int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege, + struct be_cmd_req_get_fn_privileges *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3642,7 +3642,7 @@ int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege, + } + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3654,7 +3654,7 @@ int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges, + struct be_cmd_req_set_fn_privileges *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3674,7 +3674,7 @@ int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges, + + status = be_mcc_notify_wait(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3706,7 +3706,7 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, + return -ENOMEM; + } + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3770,7 +3770,7 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, + } + + out: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + dma_free_coherent(&adapter->pdev->dev, get_mac_list_cmd.size, + get_mac_list_cmd.va, get_mac_list_cmd.dma); + return status; +@@ -3830,7 +3830,7 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, + if (!cmd.va) + return -ENOMEM; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3852,7 +3852,7 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, + + err: + dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3888,7 +3888,7 @@ int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, + CMD_SUBSYSTEM_COMMON)) + return -EPERM; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3929,7 +3929,7 @@ int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, + status = be_mcc_notify_wait(adapter); + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -3943,7 +3943,7 @@ int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, + int status; + u16 vid; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -3990,7 +3990,7 @@ int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, + } + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -4189,7 +4189,7 @@ int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter, + struct be_cmd_req_set_ext_fat_caps *req; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -4205,7 +4205,7 @@ int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter, + + status = be_mcc_notify_wait(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -4683,7 +4683,7 @@ int be_cmd_manage_iface(struct be_adapter *adapter, u32 iface, u8 op) + if (iface == 0xFFFFFFFF) + return -1; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -4700,7 +4700,7 @@ int be_cmd_manage_iface(struct be_adapter *adapter, u32 iface, u8 op) + + status = be_mcc_notify_wait(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -4734,7 +4734,7 @@ int be_cmd_get_if_id(struct be_adapter *adapter, struct be_vf_cfg *vf_cfg, + struct be_cmd_resp_get_iface_list *resp; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -4755,7 +4755,7 @@ int be_cmd_get_if_id(struct be_adapter *adapter, struct be_vf_cfg *vf_cfg, + } + + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -4849,7 +4849,7 @@ int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain) + if (BEx_chip(adapter)) + return 0; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -4867,7 +4867,7 @@ int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain) + req->enable = 1; + status = be_mcc_notify_wait(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -4940,7 +4940,7 @@ __be_cmd_set_logical_link_config(struct be_adapter *adapter, + u32 link_config = 0; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -4968,7 +4968,7 @@ __be_cmd_set_logical_link_config(struct be_adapter *adapter, + + status = be_mcc_notify_wait(adapter); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -4999,8 +4999,7 @@ int be_cmd_set_features(struct be_adapter *adapter) + struct be_mcc_wrb *wrb; + int status; + +- if (mutex_lock_interruptible(&adapter->mcc_lock)) +- return -1; ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -5038,7 +5037,7 @@ int be_cmd_set_features(struct be_adapter *adapter) + dev_info(&adapter->pdev->dev, + "Adapter does not support HW error recovery\n"); + +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + +@@ -5052,7 +5051,7 @@ int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload, + struct be_cmd_resp_hdr *resp; + int status; + +- mutex_lock(&adapter->mcc_lock); ++ spin_lock_bh(&adapter->mcc_lock); + + wrb = wrb_from_mccq(adapter); + if (!wrb) { +@@ -5075,7 +5074,7 @@ int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload, + memcpy(wrb_payload, resp, sizeof(*resp) + resp->response_length); + be_dws_le_to_cpu(wrb_payload, sizeof(*resp) + resp->response_length); + err: +- mutex_unlock(&adapter->mcc_lock); ++ spin_unlock_bh(&adapter->mcc_lock); + return status; + } + EXPORT_SYMBOL(be_roce_mcc_cmd); +diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c +index 51dddf63d40f7..4b9380003c851 100644 +--- a/drivers/net/ethernet/emulex/benet/be_main.c ++++ b/drivers/net/ethernet/emulex/benet/be_main.c +@@ -5803,8 +5803,8 @@ static int be_drv_init(struct be_adapter *adapter) + } + + mutex_init(&adapter->mbox_lock); +- mutex_init(&adapter->mcc_lock); + mutex_init(&adapter->rx_filter_lock); ++ spin_lock_init(&adapter->mcc_lock); + spin_lock_init(&adapter->mcc_cq_lock); + init_completion(&adapter->et_cmd_compl); + +-- +2.39.5 + diff --git a/queue-5.4/caif_virtio-fix-wrong-pointer-check-in-cfv_probe.patch b/queue-5.4/caif_virtio-fix-wrong-pointer-check-in-cfv_probe.patch new file mode 100644 index 0000000000..355a34eb78 --- /dev/null +++ b/queue-5.4/caif_virtio-fix-wrong-pointer-check-in-cfv_probe.patch @@ -0,0 +1,43 @@ +From b6ef9d55d748dd051465e2caf45c9e8f6c0d4108 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Feb 2025 23:46:27 +0500 +Subject: caif_virtio: fix wrong pointer check in cfv_probe() + +From: Vitaliy Shevtsov + +[ Upstream commit a466fd7e9fafd975949e5945e2f70c33a94b1a70 ] + +del_vqs() frees virtqueues, therefore cfv->vq_tx pointer should be checked +for NULL before calling it, not cfv->vdev. Also the current implementation +is redundant because the pointer cfv->vdev is dereferenced before it is +checked for NULL. + +Fix this by checking cfv->vq_tx for NULL instead of cfv->vdev before +calling del_vqs(). + +Fixes: 0d2e1a2926b1 ("caif_virtio: Introduce caif over virtio") +Signed-off-by: Vitaliy Shevtsov +Reviewed-by: Gerhard Engleder +Link: https://patch.msgid.link/20250227184716.4715-1-v.shevtsov@mt-integration.ru +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/caif/caif_virtio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/caif/caif_virtio.c b/drivers/net/caif/caif_virtio.c +index 7f2c551e5d690..41c096c2af5bd 100644 +--- a/drivers/net/caif/caif_virtio.c ++++ b/drivers/net/caif/caif_virtio.c +@@ -746,7 +746,7 @@ static int cfv_probe(struct virtio_device *vdev) + + if (cfv->vr_rx) + vdev->vringh_config->del_vrhs(cfv->vdev); +- if (cfv->vdev) ++ if (cfv->vq_tx) + vdev->config->del_vqs(cfv->vdev); + free_netdev(netdev); + return err; +-- +2.39.5 + diff --git a/queue-5.4/drm-sched-fix-preprocessor-guard.patch b/queue-5.4/drm-sched-fix-preprocessor-guard.patch new file mode 100644 index 0000000000..c60d141a93 --- /dev/null +++ b/queue-5.4/drm-sched-fix-preprocessor-guard.patch @@ -0,0 +1,48 @@ +From 24da20f8a1c8aab15d8ee95dedce212dc364bd5e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 Feb 2025 13:41:50 +0100 +Subject: drm/sched: Fix preprocessor guard + +From: Philipp Stanner + +[ Upstream commit 23e0832d6d7be2d3c713f9390c060b6f1c48bf36 ] + +When writing the header guard for gpu_scheduler_trace.h, a typo, +apparently, occurred. + +Fix the typo and document the scope of the guard. + +Fixes: 353da3c520b4 ("drm/amdgpu: add tracepoint for scheduler (v2)") +Reviewed-by: Tvrtko Ursulin +Signed-off-by: Philipp Stanner +Link: https://patchwork.freedesktop.org/patch/msgid/20250218124149.118002-2-phasta@kernel.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/scheduler/gpu_scheduler_trace.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +index d79086498affe..4fe2a87705040 100644 +--- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h ++++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +@@ -21,7 +21,7 @@ + * + */ + +-#if !defined(_GPU_SCHED_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) ++#if !defined(_GPU_SCHED_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) + #define _GPU_SCHED_TRACE_H_ + + #include +@@ -96,7 +96,7 @@ TRACE_EVENT(drm_sched_job_wait_dep, + __entry->seqno) + ); + +-#endif ++#endif /* _GPU_SCHED_TRACE_H_ */ + + /* This part must be outside protection */ + #undef TRACE_INCLUDE_PATH +-- +2.39.5 + diff --git a/queue-5.4/gpio-rcar-fix-missing-of_node_put-call.patch b/queue-5.4/gpio-rcar-fix-missing-of_node_put-call.patch new file mode 100644 index 0000000000..86fa2c2f1c --- /dev/null +++ b/queue-5.4/gpio-rcar-fix-missing-of_node_put-call.patch @@ -0,0 +1,47 @@ +From 524e4e693c52e583560d5ff1bfaa01472809012f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 Mar 2025 16:37:50 +0000 +Subject: gpio: rcar: Fix missing of_node_put() call + +From: Fabrizio Castro + +[ Upstream commit 391b41f983bf7ff853de44704d8e14e7cc648a9b ] + +of_parse_phandle_with_fixed_args() requires its caller to +call into of_node_put() on the node pointer from the output +structure, but such a call is currently missing. + +Call into of_node_put() to rectify that. + +Fixes: 159f8a0209af ("gpio-rcar: Add DT support") +Signed-off-by: Fabrizio Castro +Reviewed-by: Lad Prabhakar +Reviewed-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/20250305163753.34913-2-fabrizio.castro.jz@renesas.com +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-rcar.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c +index f0b6c68e848e3..37b731d22cb00 100644 +--- a/drivers/gpio/gpio-rcar.c ++++ b/drivers/gpio/gpio-rcar.c +@@ -418,7 +418,12 @@ static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins) + p->has_both_edge_trigger = info->has_both_edge_trigger; + + ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args); +- *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK; ++ if (ret) { ++ *npins = RCAR_MAX_GPIO_PER_BANK; ++ } else { ++ *npins = args.args[2]; ++ of_node_put(args.np); ++ } + + if (*npins == 0 || *npins > RCAR_MAX_GPIO_PER_BANK) { + dev_warn(p->dev, "Invalid number of gpio lines %u, using %u\n", +-- +2.39.5 + diff --git a/queue-5.4/hid-google-fix-unused-variable-warning-under-config_.patch b/queue-5.4/hid-google-fix-unused-variable-warning-under-config_.patch new file mode 100644 index 0000000000..e542f5ec2b --- /dev/null +++ b/queue-5.4/hid-google-fix-unused-variable-warning-under-config_.patch @@ -0,0 +1,50 @@ +From 7f0a5fabd1fa2dcb92e2abbd1d70fb04f2903ac2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 Feb 2025 00:50:13 +0800 +Subject: HID: google: fix unused variable warning under !CONFIG_ACPI + +From: Yu-Chun Lin + +[ Upstream commit 4bd0725c09f377ffaf22b834241f6c050742e4fc ] + +As reported by the kernel test robot, the following warning occurs: + +>> drivers/hid/hid-google-hammer.c:261:36: warning: 'cbas_ec_acpi_ids' defined but not used [-Wunused-const-variable=] + 261 | static const struct acpi_device_id cbas_ec_acpi_ids[] = { + | ^~~~~~~~~~~~~~~~ + +The 'cbas_ec_acpi_ids' array is only used when CONFIG_ACPI is enabled. +Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdef CONFIG_ACPI' +prevents a compiler warning when ACPI is disabled. + +Fixes: eb1aac4c8744f75 ("HID: google: add support tablet mode switch for Whiskers") +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202501201141.jctFH5eB-lkp@intel.com/ +Signed-off-by: Yu-Chun Lin +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-google-hammer.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c +index 2ebad3ed4e3af..727c5c018cb92 100644 +--- a/drivers/hid/hid-google-hammer.c ++++ b/drivers/hid/hid-google-hammer.c +@@ -258,11 +258,13 @@ static int cbas_ec_remove(struct platform_device *pdev) + return 0; + } + ++#ifdef CONFIG_ACPI + static const struct acpi_device_id cbas_ec_acpi_ids[] = { + { "GOOG000B", 0 }, + { } + }; + MODULE_DEVICE_TABLE(acpi, cbas_ec_acpi_ids); ++#endif + + static struct platform_driver cbas_ec_driver = { + .probe = cbas_ec_probe, +-- +2.39.5 + diff --git a/queue-5.4/hid-intel-ish-hid-fix-use-after-free-issue-in-ishtp_.patch b/queue-5.4/hid-intel-ish-hid-fix-use-after-free-issue-in-ishtp_.patch new file mode 100644 index 0000000000..5f6ca517cd --- /dev/null +++ b/queue-5.4/hid-intel-ish-hid-fix-use-after-free-issue-in-ishtp_.patch @@ -0,0 +1,55 @@ +From db17fddd8f6230d1e8dd9a65d08492a52e275591 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 Feb 2025 14:37:30 +0800 +Subject: HID: intel-ish-hid: Fix use-after-free issue in ishtp_hid_remove() + +From: Zhang Lixu + +[ Upstream commit 07583a0010696a17fb0942e0b499a62785c5fc9f ] + +The system can experience a random crash a few minutes after the driver is +removed. This issue occurs due to improper handling of memory freeing in +the ishtp_hid_remove() function. + +The function currently frees the `driver_data` directly within the loop +that destroys the HID devices, which can lead to accessing freed memory. +Specifically, `hid_destroy_device()` uses `driver_data` when it calls +`hid_ishtp_set_feature()` to power off the sensor, so freeing +`driver_data` beforehand can result in accessing invalid memory. + +This patch resolves the issue by storing the `driver_data` in a temporary +variable before calling `hid_destroy_device()`, and then freeing the +`driver_data` after the device is destroyed. + +Fixes: 0b28cb4bcb17 ("HID: intel-ish-hid: ISH HID client driver") +Signed-off-by: Zhang Lixu +Acked-by: Srinivas Pandruvada +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/intel-ish-hid/ishtp-hid.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/hid/intel-ish-hid/ishtp-hid.c b/drivers/hid/intel-ish-hid/ishtp-hid.c +index b8aae69ad15d7..ef52368557715 100644 +--- a/drivers/hid/intel-ish-hid/ishtp-hid.c ++++ b/drivers/hid/intel-ish-hid/ishtp-hid.c +@@ -263,12 +263,14 @@ int ishtp_hid_probe(unsigned int cur_hid_dev, + */ + void ishtp_hid_remove(struct ishtp_cl_data *client_data) + { ++ void *data; + int i; + + for (i = 0; i < client_data->num_hid_devices; ++i) { + if (client_data->hid_sensor_hubs[i]) { +- kfree(client_data->hid_sensor_hubs[i]->driver_data); ++ data = client_data->hid_sensor_hubs[i]->driver_data; + hid_destroy_device(client_data->hid_sensor_hubs[i]); ++ kfree(data); + client_data->hid_sensor_hubs[i] = NULL; + } + } +-- +2.39.5 + diff --git a/queue-5.4/hwmon-ad7314-validate-leading-zero-bits-and-return-e.patch b/queue-5.4/hwmon-ad7314-validate-leading-zero-bits-and-return-e.patch new file mode 100644 index 0000000000..776cf2be71 --- /dev/null +++ b/queue-5.4/hwmon-ad7314-validate-leading-zero-bits-and-return-e.patch @@ -0,0 +1,65 @@ +From e61ba8fbc6c27d1ed5ecd297a01f3a800d4a8704 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Feb 2025 09:19:04 +0000 +Subject: hwmon: (ad7314) Validate leading zero bits and return error + +From: Erik Schumacher + +[ Upstream commit e278d5e8aef4c0a1d9a9fa8b8910d713a89aa800 ] + +Leading zero bits are sent on the bus before the temperature value is +transmitted. If any of these bits are high, the connection might be +unstable or there could be no AD7314 / ADT730x (or compatible) at all. +Return -EIO in that case. + +Signed-off-by: Erik Schumacher +Fixes: 4f3a659581cab ("hwmon: AD7314 driver (ported from IIO)") +Link: https://lore.kernel.org/r/24a50c2981a318580aca8f50d23be7987b69ea00.camel@iris-sensing.com +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/ad7314.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c +index 7802bbf5f9587..59424103f6348 100644 +--- a/drivers/hwmon/ad7314.c ++++ b/drivers/hwmon/ad7314.c +@@ -22,11 +22,13 @@ + */ + #define AD7314_TEMP_MASK 0x7FE0 + #define AD7314_TEMP_SHIFT 5 ++#define AD7314_LEADING_ZEROS_MASK BIT(15) + + /* + * ADT7301 and ADT7302 temperature masks + */ + #define ADT7301_TEMP_MASK 0x3FFF ++#define ADT7301_LEADING_ZEROS_MASK (BIT(15) | BIT(14)) + + enum ad7314_variant { + adt7301, +@@ -65,12 +67,20 @@ static ssize_t ad7314_temperature_show(struct device *dev, + return ret; + switch (spi_get_device_id(chip->spi_dev)->driver_data) { + case ad7314: ++ if (ret & AD7314_LEADING_ZEROS_MASK) { ++ /* Invalid read-out, leading zero part is missing */ ++ return -EIO; ++ } + data = (ret & AD7314_TEMP_MASK) >> AD7314_TEMP_SHIFT; + data = sign_extend32(data, 9); + + return sprintf(buf, "%d\n", 250 * data); + case adt7301: + case adt7302: ++ if (ret & ADT7301_LEADING_ZEROS_MASK) { ++ /* Invalid read-out, leading zero part is missing */ ++ return -EIO; ++ } + /* + * Documented as a 13 bit twos complement register + * with a sign bit - which is a 14 bit 2's complement +-- +2.39.5 + diff --git a/queue-5.4/hwmon-fix-a-null-vs-is_err_or_null-check-in-xgene_hw.patch b/queue-5.4/hwmon-fix-a-null-vs-is_err_or_null-check-in-xgene_hw.patch new file mode 100644 index 0000000000..fc0605b064 --- /dev/null +++ b/queue-5.4/hwmon-fix-a-null-vs-is_err_or_null-check-in-xgene_hw.patch @@ -0,0 +1,37 @@ +From 595ccb2626ec8db05ec3abf13076bd569ada7367 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 3 Mar 2025 07:57:33 -0500 +Subject: hwmon: fix a NULL vs IS_ERR_OR_NULL() check in xgene_hwmon_probe() + +From: Xinghuo Chen + +[ Upstream commit 10fce7ebe888fa8c97eee7e317a47e7603e5e78d ] + +The devm_memremap() function returns error pointers on error, +it doesn't return NULL. + +Fixes: c7cefce03e69 ("hwmon: (xgene) access mailbox as RAM") +Signed-off-by: Xinghuo Chen +Link: https://lore.kernel.org/r/tencent_9AD8E7683EC29CAC97496B44F3F865BA070A@qq.com +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/xgene-hwmon.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/hwmon/xgene-hwmon.c b/drivers/hwmon/xgene-hwmon.c +index f5d3cf86753f7..559a73bab51e8 100644 +--- a/drivers/hwmon/xgene-hwmon.c ++++ b/drivers/hwmon/xgene-hwmon.c +@@ -719,7 +719,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev) + goto out; + } + +- if (!ctx->pcc_comm_addr) { ++ if (IS_ERR_OR_NULL(ctx->pcc_comm_addr)) { + dev_err(&pdev->dev, + "Failed to ioremap PCC comm region\n"); + rc = -ENOMEM; +-- +2.39.5 + diff --git a/queue-5.4/hwmon-ntc_thermistor-fix-the-ncpxxxh103-sensor-table.patch b/queue-5.4/hwmon-ntc_thermistor-fix-the-ncpxxxh103-sensor-table.patch new file mode 100644 index 0000000000..a838dd399d --- /dev/null +++ b/queue-5.4/hwmon-ntc_thermistor-fix-the-ncpxxxh103-sensor-table.patch @@ -0,0 +1,108 @@ +From 4a316bce7411ef759382965d82501dee17f4e26c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Feb 2025 13:57:53 +0100 +Subject: hwmon: (ntc_thermistor) Fix the ncpXXxh103 sensor table + +From: Maud Spierings + +[ Upstream commit 1c7932d5ae0f5c22fa52ac811b4c427bbca5aff5 ] + +I could not find a single table that has the values currently present in +the table, change it to the actual values that can be found in [1]/[2] +and [3] (page 15 column 2) + +[1]: https://www.murata.com/products/productdetail?partno=NCP15XH103F03RC +[2]: https://www.murata.com/products/productdata/8796836626462/NTHCG83.txt?1437969843000 +[3]: https://nl.mouser.com/datasheet/2/281/r44e-522712.pdf + +Fixes: 54ce3a0d8011 ("hwmon: (ntc_thermistor) Add support for ncpXXxh103") +Signed-off-by: Maud Spierings +Link: https://lore.kernel.org/r/20250227-ntc_thermistor_fixes-v1-3-70fa73200b52@gocontroll.com +Reviewed-by: Linus Walleij +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/ntc_thermistor.c | 66 +++++++++++++++++----------------- + 1 file changed, 33 insertions(+), 33 deletions(-) + +diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c +index 7e20beb8b11f3..1305f81c4ae33 100644 +--- a/drivers/hwmon/ntc_thermistor.c ++++ b/drivers/hwmon/ntc_thermistor.c +@@ -177,40 +177,40 @@ static const struct ntc_compensation ncpXXwf104[] = { + }; + + static const struct ntc_compensation ncpXXxh103[] = { +- { .temp_c = -40, .ohm = 247565 }, +- { .temp_c = -35, .ohm = 181742 }, +- { .temp_c = -30, .ohm = 135128 }, +- { .temp_c = -25, .ohm = 101678 }, +- { .temp_c = -20, .ohm = 77373 }, +- { .temp_c = -15, .ohm = 59504 }, +- { .temp_c = -10, .ohm = 46222 }, +- { .temp_c = -5, .ohm = 36244 }, +- { .temp_c = 0, .ohm = 28674 }, +- { .temp_c = 5, .ohm = 22878 }, +- { .temp_c = 10, .ohm = 18399 }, +- { .temp_c = 15, .ohm = 14910 }, +- { .temp_c = 20, .ohm = 12169 }, ++ { .temp_c = -40, .ohm = 195652 }, ++ { .temp_c = -35, .ohm = 148171 }, ++ { .temp_c = -30, .ohm = 113347 }, ++ { .temp_c = -25, .ohm = 87559 }, ++ { .temp_c = -20, .ohm = 68237 }, ++ { .temp_c = -15, .ohm = 53650 }, ++ { .temp_c = -10, .ohm = 42506 }, ++ { .temp_c = -5, .ohm = 33892 }, ++ { .temp_c = 0, .ohm = 27219 }, ++ { .temp_c = 5, .ohm = 22021 }, ++ { .temp_c = 10, .ohm = 17926 }, ++ { .temp_c = 15, .ohm = 14674 }, ++ { .temp_c = 20, .ohm = 12081 }, + { .temp_c = 25, .ohm = 10000 }, +- { .temp_c = 30, .ohm = 8271 }, +- { .temp_c = 35, .ohm = 6883 }, +- { .temp_c = 40, .ohm = 5762 }, +- { .temp_c = 45, .ohm = 4851 }, +- { .temp_c = 50, .ohm = 4105 }, +- { .temp_c = 55, .ohm = 3492 }, +- { .temp_c = 60, .ohm = 2985 }, +- { .temp_c = 65, .ohm = 2563 }, +- { .temp_c = 70, .ohm = 2211 }, +- { .temp_c = 75, .ohm = 1915 }, +- { .temp_c = 80, .ohm = 1666 }, +- { .temp_c = 85, .ohm = 1454 }, +- { .temp_c = 90, .ohm = 1275 }, +- { .temp_c = 95, .ohm = 1121 }, +- { .temp_c = 100, .ohm = 990 }, +- { .temp_c = 105, .ohm = 876 }, +- { .temp_c = 110, .ohm = 779 }, +- { .temp_c = 115, .ohm = 694 }, +- { .temp_c = 120, .ohm = 620 }, +- { .temp_c = 125, .ohm = 556 }, ++ { .temp_c = 30, .ohm = 8315 }, ++ { .temp_c = 35, .ohm = 6948 }, ++ { .temp_c = 40, .ohm = 5834 }, ++ { .temp_c = 45, .ohm = 4917 }, ++ { .temp_c = 50, .ohm = 4161 }, ++ { .temp_c = 55, .ohm = 3535 }, ++ { .temp_c = 60, .ohm = 3014 }, ++ { .temp_c = 65, .ohm = 2586 }, ++ { .temp_c = 70, .ohm = 2228 }, ++ { .temp_c = 75, .ohm = 1925 }, ++ { .temp_c = 80, .ohm = 1669 }, ++ { .temp_c = 85, .ohm = 1452 }, ++ { .temp_c = 90, .ohm = 1268 }, ++ { .temp_c = 95, .ohm = 1110 }, ++ { .temp_c = 100, .ohm = 974 }, ++ { .temp_c = 105, .ohm = 858 }, ++ { .temp_c = 110, .ohm = 758 }, ++ { .temp_c = 115, .ohm = 672 }, ++ { .temp_c = 120, .ohm = 596 }, ++ { .temp_c = 125, .ohm = 531 }, + }; + + /* +-- +2.39.5 + diff --git a/queue-5.4/hwmon-pmbus-initialise-page-count-in-pmbus_identify.patch b/queue-5.4/hwmon-pmbus-initialise-page-count-in-pmbus_identify.patch new file mode 100644 index 0000000000..aafe1e9aae --- /dev/null +++ b/queue-5.4/hwmon-pmbus-initialise-page-count-in-pmbus_identify.patch @@ -0,0 +1,49 @@ +From f3c8c6ab08dfcab9aff962048d00608735a8b56f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Feb 2025 22:24:55 +0000 +Subject: hwmon: (pmbus) Initialise page count in pmbus_identify() + +From: Titus Rwantare + +[ Upstream commit 6b6e2e8fd0de3fa7c6f4f8fe6841b01770b2e7bc ] + +The `pmbus_identify()` function fails to correctly determine the number +of supported pages on PMBus devices. This occurs because `info->pages` +is implicitly zero-initialised, and `pmbus_set_page()` does not perform +writes to the page register if `info->pages` is not yet initialised. +Without this patch, `info->pages` is always set to the maximum after +scanning. + +This patch initialises `info->pages` to `PMBUS_PAGES` before the probing +loop, enabling `pmbus_set_page()` writes to make it out onto the bus +correctly identifying the number of pages. `PMBUS_PAGES` seemed like a +reasonable non-zero number because that's the current result of the +identification process. + +Testing was done with a PMBus device in QEMU. + +Signed-off-by: Titus Rwantare +Fixes: 442aba78728e7 ("hwmon: PMBus device driver") +Link: https://lore.kernel.org/r/20250227222455.2583468-1-titusr@google.com +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/pmbus/pmbus.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c +index c0bc43d010186..81d4e9e85d3ea 100644 +--- a/drivers/hwmon/pmbus/pmbus.c ++++ b/drivers/hwmon/pmbus/pmbus.c +@@ -101,6 +101,8 @@ static int pmbus_identify(struct i2c_client *client, + if (pmbus_check_byte_register(client, 0, PMBUS_PAGE)) { + int page; + ++ info->pages = PMBUS_PAGES; ++ + for (page = 1; page < PMBUS_PAGES; page++) { + if (pmbus_set_page(client, page) < 0) + break; +-- +2.39.5 + diff --git a/queue-5.4/llc-do-not-use-skb_get-before-dev_queue_xmit.patch b/queue-5.4/llc-do-not-use-skb_get-before-dev_queue_xmit.patch new file mode 100644 index 0000000000..93c7f5e820 --- /dev/null +++ b/queue-5.4/llc-do-not-use-skb_get-before-dev_queue_xmit.patch @@ -0,0 +1,166 @@ +From 2260334ce00a9a017eeb07799ddef4126f6fd864 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Feb 2025 08:26:42 +0000 +Subject: llc: do not use skb_get() before dev_queue_xmit() + +From: Eric Dumazet + +[ Upstream commit 64e6a754d33d31aa844b3ee66fb93ac84ca1565e ] + +syzbot is able to crash hosts [1], using llc and devices +not supporting IFF_TX_SKB_SHARING. + +In this case, e1000 driver calls eth_skb_pad(), while +the skb is shared. + +Simply replace skb_get() by skb_clone() in net/llc/llc_s_ac.c + +Note that e1000 driver might have an issue with pktgen, +because it does not clear IFF_TX_SKB_SHARING, this is an +orthogonal change. + +We need to audit other skb_get() uses in net/llc. + +[1] + +kernel BUG at net/core/skbuff.c:2178 ! +Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI +CPU: 0 UID: 0 PID: 16371 Comm: syz.2.2764 Not tainted 6.14.0-rc4-syzkaller-00052-gac9c34d1e45a #0 +Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 + RIP: 0010:pskb_expand_head+0x6ce/0x1240 net/core/skbuff.c:2178 +Call Trace: + + __skb_pad+0x18a/0x610 net/core/skbuff.c:2466 + __skb_put_padto include/linux/skbuff.h:3843 [inline] + skb_put_padto include/linux/skbuff.h:3862 [inline] + eth_skb_pad include/linux/etherdevice.h:656 [inline] + e1000_xmit_frame+0x2d99/0x5800 drivers/net/ethernet/intel/e1000/e1000_main.c:3128 + __netdev_start_xmit include/linux/netdevice.h:5151 [inline] + netdev_start_xmit include/linux/netdevice.h:5160 [inline] + xmit_one net/core/dev.c:3806 [inline] + dev_hard_start_xmit+0x9a/0x7b0 net/core/dev.c:3822 + sch_direct_xmit+0x1ae/0xc30 net/sched/sch_generic.c:343 + __dev_xmit_skb net/core/dev.c:4045 [inline] + __dev_queue_xmit+0x13d4/0x43e0 net/core/dev.c:4621 + dev_queue_xmit include/linux/netdevice.h:3313 [inline] + llc_sap_action_send_test_c+0x268/0x320 net/llc/llc_s_ac.c:144 + llc_exec_sap_trans_actions net/llc/llc_sap.c:153 [inline] + llc_sap_next_state net/llc/llc_sap.c:182 [inline] + llc_sap_state_process+0x239/0x510 net/llc/llc_sap.c:209 + llc_ui_sendmsg+0xd0d/0x14e0 net/llc/af_llc.c:993 + sock_sendmsg_nosec net/socket.c:718 [inline] + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Reported-by: syzbot+da65c993ae113742a25f@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/netdev/67c020c0.050a0220.222324.0011.GAE@google.com/T/#u +Signed-off-by: Eric Dumazet +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/llc/llc_s_ac.c | 49 +++++++++++++++++++++++++--------------------- + 1 file changed, 27 insertions(+), 22 deletions(-) + +diff --git a/net/llc/llc_s_ac.c b/net/llc/llc_s_ac.c +index df26557a02448..942ace4af18d8 100644 +--- a/net/llc/llc_s_ac.c ++++ b/net/llc/llc_s_ac.c +@@ -24,7 +24,7 @@ + #include + #include + #include +- ++#include + + /** + * llc_sap_action_unit_data_ind - forward UI PDU to network layer +@@ -40,6 +40,26 @@ int llc_sap_action_unitdata_ind(struct llc_sap *sap, struct sk_buff *skb) + return 0; + } + ++static int llc_prepare_and_xmit(struct sk_buff *skb) ++{ ++ struct llc_sap_state_ev *ev = llc_sap_ev(skb); ++ struct sk_buff *nskb; ++ int rc; ++ ++ rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); ++ if (rc) ++ return rc; ++ ++ nskb = skb_clone(skb, GFP_ATOMIC); ++ if (!nskb) ++ return -ENOMEM; ++ ++ if (skb->sk) ++ skb_set_owner_w(nskb, skb->sk); ++ ++ return dev_queue_xmit(nskb); ++} ++ + /** + * llc_sap_action_send_ui - sends UI PDU resp to UNITDATA REQ to MAC layer + * @sap: SAP +@@ -52,17 +72,12 @@ int llc_sap_action_unitdata_ind(struct llc_sap *sap, struct sk_buff *skb) + int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb) + { + struct llc_sap_state_ev *ev = llc_sap_ev(skb); +- int rc; + + llc_pdu_header_init(skb, LLC_PDU_TYPE_U, ev->saddr.lsap, + ev->daddr.lsap, LLC_PDU_CMD); + llc_pdu_init_as_ui_cmd(skb); +- rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); +- if (likely(!rc)) { +- skb_get(skb); +- rc = dev_queue_xmit(skb); +- } +- return rc; ++ ++ return llc_prepare_and_xmit(skb); + } + + /** +@@ -77,17 +92,12 @@ int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb) + int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb) + { + struct llc_sap_state_ev *ev = llc_sap_ev(skb); +- int rc; + + llc_pdu_header_init(skb, LLC_PDU_TYPE_U_XID, ev->saddr.lsap, + ev->daddr.lsap, LLC_PDU_CMD); + llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0); +- rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); +- if (likely(!rc)) { +- skb_get(skb); +- rc = dev_queue_xmit(skb); +- } +- return rc; ++ ++ return llc_prepare_and_xmit(skb); + } + + /** +@@ -133,17 +143,12 @@ int llc_sap_action_send_xid_r(struct llc_sap *sap, struct sk_buff *skb) + int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb) + { + struct llc_sap_state_ev *ev = llc_sap_ev(skb); +- int rc; + + llc_pdu_header_init(skb, LLC_PDU_TYPE_U, ev->saddr.lsap, + ev->daddr.lsap, LLC_PDU_CMD); + llc_pdu_init_as_test_cmd(skb); +- rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); +- if (likely(!rc)) { +- skb_get(skb); +- rc = dev_queue_xmit(skb); +- } +- return rc; ++ ++ return llc_prepare_and_xmit(skb); + } + + int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb) +-- +2.39.5 + diff --git a/queue-5.4/net-gso-fix-ownership-in-__udp_gso_segment.patch b/queue-5.4/net-gso-fix-ownership-in-__udp_gso_segment.patch new file mode 100644 index 0000000000..6cf44022da --- /dev/null +++ b/queue-5.4/net-gso-fix-ownership-in-__udp_gso_segment.patch @@ -0,0 +1,73 @@ +From 733e15b1925510ad5b258b36c900781bd0c5a371 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Feb 2025 18:13:42 +0100 +Subject: net: gso: fix ownership in __udp_gso_segment + +From: Antoine Tenart + +[ Upstream commit ee01b2f2d7d0010787c2343463965bbc283a497f ] + +In __udp_gso_segment the skb destructor is removed before segmenting the +skb but the socket reference is kept as-is. This is an issue if the +original skb is later orphaned as we can hit the following bug: + + kernel BUG at ./include/linux/skbuff.h:3312! (skb_orphan) + RIP: 0010:ip_rcv_core+0x8b2/0xca0 + Call Trace: + ip_rcv+0xab/0x6e0 + __netif_receive_skb_one_core+0x168/0x1b0 + process_backlog+0x384/0x1100 + __napi_poll.constprop.0+0xa1/0x370 + net_rx_action+0x925/0xe50 + +The above can happen following a sequence of events when using +OpenVSwitch, when an OVS_ACTION_ATTR_USERSPACE action precedes an +OVS_ACTION_ATTR_OUTPUT action: + +1. OVS_ACTION_ATTR_USERSPACE is handled (in do_execute_actions): the skb + goes through queue_gso_packets and then __udp_gso_segment, where its + destructor is removed. +2. The segments' data are copied and sent to userspace. +3. OVS_ACTION_ATTR_OUTPUT is handled (in do_execute_actions) and the + same original skb is sent to its path. +4. If it later hits skb_orphan, we hit the bug. + +Fix this by also removing the reference to the socket in +__udp_gso_segment. + +Fixes: ad405857b174 ("udp: better wmem accounting on gso") +Signed-off-by: Antoine Tenart +Link: https://patch.msgid.link/20250226171352.258045-1-atenart@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv4/udp_offload.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c +index 487a92d75c703..6505a6fd245a6 100644 +--- a/net/ipv4/udp_offload.c ++++ b/net/ipv4/udp_offload.c +@@ -204,13 +204,17 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, + + /* clear destructor to avoid skb_segment assigning it to tail */ + copy_dtor = gso_skb->destructor == sock_wfree; +- if (copy_dtor) ++ if (copy_dtor) { + gso_skb->destructor = NULL; ++ gso_skb->sk = NULL; ++ } + + segs = skb_segment(gso_skb, features); + if (IS_ERR_OR_NULL(segs)) { +- if (copy_dtor) ++ if (copy_dtor) { + gso_skb->destructor = sock_wfree; ++ gso_skb->sk = sk; ++ } + return segs; + } + +-- +2.39.5 + diff --git a/queue-5.4/net-ipv6-fix-dst-ref-loop-in-ila-lwtunnel.patch b/queue-5.4/net-ipv6-fix-dst-ref-loop-in-ila-lwtunnel.patch new file mode 100644 index 0000000000..10c17b8259 --- /dev/null +++ b/queue-5.4/net-ipv6-fix-dst-ref-loop-in-ila-lwtunnel.patch @@ -0,0 +1,41 @@ +From 9c56c529b0f101d4ba4eb34793a8013bbc5985d2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 4 Mar 2025 19:10:39 +0100 +Subject: net: ipv6: fix dst ref loop in ila lwtunnel + +From: Justin Iurman + +[ Upstream commit 0e7633d7b95b67f1758aea19f8e85621c5f506a3 ] + +This patch follows commit 92191dd10730 ("net: ipv6: fix dst ref loops in +rpl, seg6 and ioam6 lwtunnels") and, on a second thought, the same patch +is also needed for ila (even though the config that triggered the issue +was pathological, but still, we don't want that to happen). + +Fixes: 79ff2fc31e0f ("ila: Cache a route to translated address") +Cc: Tom Herbert +Signed-off-by: Justin Iurman +Link: https://patch.msgid.link/20250304181039.35951-1-justin.iurman@uliege.be +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + net/ipv6/ila/ila_lwt.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c +index 6a6a30e82810d..dc01cdb043498 100644 +--- a/net/ipv6/ila/ila_lwt.c ++++ b/net/ipv6/ila/ila_lwt.c +@@ -88,7 +88,8 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb) + goto drop; + } + +- if (ilwt->connected) { ++ /* cache only if we don't create a dst reference loop */ ++ if (ilwt->connected && orig_dst->lwtstate != dst->lwtstate) { + local_bh_disable(); + dst_cache_set_ip6(&ilwt->dst_cache, dst, &fl6.saddr); + local_bh_enable(); +-- +2.39.5 + diff --git a/queue-5.4/net-ipv6-fix-missing-dst-ref-drop-in-ila-lwtunnel.patch b/queue-5.4/net-ipv6-fix-missing-dst-ref-drop-in-ila-lwtunnel.patch new file mode 100644 index 0000000000..3558334597 --- /dev/null +++ b/queue-5.4/net-ipv6-fix-missing-dst-ref-drop-in-ila-lwtunnel.patch @@ -0,0 +1,37 @@ +From 128962cc9c4b6f3420429ecab7fe170d6fc418c2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 Mar 2025 09:16:55 +0100 +Subject: net: ipv6: fix missing dst ref drop in ila lwtunnel + +From: Justin Iurman + +[ Upstream commit 5da15a9c11c1c47ef573e6805b60a7d8a1687a2a ] + +Add missing skb_dst_drop() to drop reference to the old dst before +adding the new dst to the skb. + +Fixes: 79ff2fc31e0f ("ila: Cache a route to translated address") +Cc: Tom Herbert +Signed-off-by: Justin Iurman +Link: https://patch.msgid.link/20250305081655.19032-1-justin.iurman@uliege.be +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + net/ipv6/ila/ila_lwt.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c +index dc01cdb043498..d54259b03a4d8 100644 +--- a/net/ipv6/ila/ila_lwt.c ++++ b/net/ipv6/ila/ila_lwt.c +@@ -96,6 +96,7 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb) + } + } + ++ skb_dst_drop(skb); + skb_dst_set(skb, dst); + return dst_output(net, sk, skb); + +-- +2.39.5 + diff --git a/queue-5.4/net-timestamp-support-tcp-gso-case-for-a-few-missing.patch b/queue-5.4/net-timestamp-support-tcp-gso-case-for-a-few-missing.patch new file mode 100644 index 0000000000..c2d755bb5a --- /dev/null +++ b/queue-5.4/net-timestamp-support-tcp-gso-case-for-a-few-missing.patch @@ -0,0 +1,73 @@ +From f2538e27eb1d1f9670b7cb17d9362b201702b7d6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 4 Mar 2025 08:44:29 +0800 +Subject: net-timestamp: support TCP GSO case for a few missing flags + +From: Jason Xing + +[ Upstream commit 3c9231ea6497dfc50ac0ef69fff484da27d0df66 ] + +When I read through the TSO codes, I found out that we probably +miss initializing the tx_flags of last seg when TSO is turned +off, which means at the following points no more timestamp +(for this last one) will be generated. There are three flags +to be handled in this patch: +1. SKBTX_HW_TSTAMP +2. SKBTX_BPF +3. SKBTX_SCHED_TSTAMP +Note that SKBTX_BPF[1] was added in 6.14.0-rc2 by commit +6b98ec7e882af ("bpf: Add BPF_SOCK_OPS_TSTAMP_SCHED_CB callback") +and only belongs to net-next branch material for now. The common +issue of the above three flags can be fixed by this single patch. + +This patch initializes the tx_flags to SKBTX_ANY_TSTAMP like what +the UDP GSO does to make the newly segmented last skb inherit the +tx_flags so that requested timestamp will be generated in each +certain layer, or else that last one has zero value of tx_flags +which leads to no timestamp at all. + +Fixes: 4ed2d765dfacc ("net-timestamp: TCP timestamping") +Signed-off-by: Jason Xing +Reviewed-by: Willem de Bruijn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv4/tcp_offload.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c +index fc61cd3fea652..27b7887f4f4eb 100644 +--- a/net/ipv4/tcp_offload.c ++++ b/net/ipv4/tcp_offload.c +@@ -11,12 +11,15 @@ + #include + #include + +-static void tcp_gso_tstamp(struct sk_buff *skb, unsigned int ts_seq, ++static void tcp_gso_tstamp(struct sk_buff *skb, struct sk_buff *gso_skb, + unsigned int seq, unsigned int mss) + { ++ u32 flags = skb_shinfo(gso_skb)->tx_flags & SKBTX_ANY_TSTAMP; ++ u32 ts_seq = skb_shinfo(gso_skb)->tskey; ++ + while (skb) { + if (before(ts_seq, seq + mss)) { +- skb_shinfo(skb)->tx_flags |= SKBTX_SW_TSTAMP; ++ skb_shinfo(skb)->tx_flags |= flags; + skb_shinfo(skb)->tskey = ts_seq; + return; + } +@@ -115,8 +118,8 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, + th = tcp_hdr(skb); + seq = ntohl(th->seq); + +- if (unlikely(skb_shinfo(gso_skb)->tx_flags & SKBTX_SW_TSTAMP)) +- tcp_gso_tstamp(segs, skb_shinfo(gso_skb)->tskey, seq, mss); ++ if (unlikely(skb_shinfo(gso_skb)->tx_flags & SKBTX_ANY_TSTAMP)) ++ tcp_gso_tstamp(segs, gso_skb, seq, mss); + + newcheck = ~csum_fold((__force __wsum)((__force u32)th->check + + (__force u32)delta)); +-- +2.39.5 + diff --git a/queue-5.4/ppp-fix-kmsan-uninit-value-warning-with-bpf.patch b/queue-5.4/ppp-fix-kmsan-uninit-value-warning-with-bpf.patch new file mode 100644 index 0000000000..58b717d335 --- /dev/null +++ b/queue-5.4/ppp-fix-kmsan-uninit-value-warning-with-bpf.patch @@ -0,0 +1,121 @@ +From 77e6a1e84fcf8fe36adde6402bed37222fe86b3b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Feb 2025 22:14:08 +0800 +Subject: ppp: Fix KMSAN uninit-value warning with bpf + +From: Jiayuan Chen + +[ Upstream commit 4c2d14c40a68678d885eab4008a0129646805bae ] + +Syzbot caught an "KMSAN: uninit-value" warning [1], which is caused by the +ppp driver not initializing a 2-byte header when using socket filter. + +The following code can generate a PPP filter BPF program: +''' +struct bpf_program fp; +pcap_t *handle; +handle = pcap_open_dead(DLT_PPP_PPPD, 65535); +pcap_compile(handle, &fp, "ip and outbound", 0, 0); +bpf_dump(&fp, 1); +''' +Its output is: +''' +(000) ldh [2] +(001) jeq #0x21 jt 2 jf 5 +(002) ldb [0] +(003) jeq #0x1 jt 4 jf 5 +(004) ret #65535 +(005) ret #0 +''' +Wen can find similar code at the following link: +https://github.com/ppp-project/ppp/blob/master/pppd/options.c#L1680 +The maintainer of this code repository is also the original maintainer +of the ppp driver. + +As you can see the BPF program skips 2 bytes of data and then reads the +'Protocol' field to determine if it's an IP packet. Then it read the first +byte of the first 2 bytes to determine the direction. + +The issue is that only the first byte indicating direction is initialized +in current ppp driver code while the second byte is not initialized. + +For normal BPF programs generated by libpcap, uninitialized data won't be +used, so it's not a problem. However, for carefully crafted BPF programs, +such as those generated by syzkaller [2], which start reading from offset +0, the uninitialized data will be used and caught by KMSAN. + +[1] https://syzkaller.appspot.com/bug?extid=853242d9c9917165d791 +[2] https://syzkaller.appspot.com/text?tag=ReproC&x=11994913980000 + +Cc: Paul Mackerras +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Reported-by: syzbot+853242d9c9917165d791@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/bpf/000000000000dea025060d6bc3bc@google.com/ +Signed-off-by: Jiayuan Chen +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/20250228141408.393864-1-jiayuan.chen@linux.dev +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ppp/ppp_generic.c | 28 +++++++++++++++++++--------- + 1 file changed, 19 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c +index 3cd4196b36b21..7b9337e16d6e1 100644 +--- a/drivers/net/ppp/ppp_generic.c ++++ b/drivers/net/ppp/ppp_generic.c +@@ -72,6 +72,17 @@ + #define PPP_PROTO_LEN 2 + #define PPP_LCP_HDRLEN 4 + ++/* The filter instructions generated by libpcap are constructed ++ * assuming a four-byte PPP header on each packet, where the last ++ * 2 bytes are the protocol field defined in the RFC and the first ++ * byte of the first 2 bytes indicates the direction. ++ * The second byte is currently unused, but we still need to initialize ++ * it to prevent crafted BPF programs from reading them which would ++ * cause reading of uninitialized data. ++ */ ++#define PPP_FILTER_OUTBOUND_TAG 0x0100 ++#define PPP_FILTER_INBOUND_TAG 0x0000 ++ + /* + * An instance of /dev/ppp can be associated with either a ppp + * interface unit or a ppp channel. In both cases, file->private_data +@@ -1541,10 +1552,10 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) + + if (proto < 0x8000) { + #ifdef CONFIG_PPP_FILTER +- /* check if we should pass this packet */ +- /* the filter instructions are constructed assuming +- a four-byte PPP header on each packet */ +- *(u8 *)skb_push(skb, 2) = 1; ++ /* check if the packet passes the pass and active filters. ++ * See comment for PPP_FILTER_OUTBOUND_TAG above. ++ */ ++ *(__be16 *)skb_push(skb, 2) = htons(PPP_FILTER_OUTBOUND_TAG); + if (ppp->pass_filter && + BPF_PROG_RUN(ppp->pass_filter, skb) == 0) { + if (ppp->debug & 1) +@@ -2223,14 +2234,13 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) + /* network protocol frame - give it to the kernel */ + + #ifdef CONFIG_PPP_FILTER +- /* check if the packet passes the pass and active filters */ +- /* the filter instructions are constructed assuming +- a four-byte PPP header on each packet */ + if (ppp->pass_filter || ppp->active_filter) { + if (skb_unclone(skb, GFP_ATOMIC)) + goto err; +- +- *(u8 *)skb_push(skb, 2) = 0; ++ /* Check if the packet passes the pass and active filters. ++ * See comment for PPP_FILTER_INBOUND_TAG above. ++ */ ++ *(__be16 *)skb_push(skb, 2) = htons(PPP_FILTER_INBOUND_TAG); + if (ppp->pass_filter && + BPF_PROG_RUN(ppp->pass_filter, skb) == 0) { + if (ppp->debug & 1) +-- +2.39.5 + diff --git a/queue-5.4/series b/queue-5.4/series index 985f6658bf..0d890181a4 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -289,3 +289,21 @@ wifi-nl80211-reject-cooked-mode-if-it-is-set-along-with-other-flags.patch rapidio-add-check-for-rio_add_net-in-rio_scan_alloc_net.patch rapidio-fix-an-api-misues-when-rio_add_net-fails.patch mm-page_alloc-fix-uninitialized-variable.patch +wifi-iwlwifi-limit-printed-string-from-fw-file.patch +hid-google-fix-unused-variable-warning-under-config_.patch +hid-intel-ish-hid-fix-use-after-free-issue-in-ishtp_.patch +net-gso-fix-ownership-in-__udp_gso_segment.patch +caif_virtio-fix-wrong-pointer-check-in-cfv_probe.patch +hwmon-pmbus-initialise-page-count-in-pmbus_identify.patch +hwmon-ntc_thermistor-fix-the-ncpxxxh103-sensor-table.patch +hwmon-ad7314-validate-leading-zero-bits-and-return-e.patch +llc-do-not-use-skb_get-before-dev_queue_xmit.patch +hwmon-fix-a-null-vs-is_err_or_null-check-in-xgene_hw.patch +drm-sched-fix-preprocessor-guard.patch +be2net-fix-sleeping-while-atomic-bugs-in-be_ndo_brid.patch +ppp-fix-kmsan-uninit-value-warning-with-bpf.patch +vlan-enforce-underlying-device-type.patch +net-timestamp-support-tcp-gso-case-for-a-few-missing.patch +net-ipv6-fix-dst-ref-loop-in-ila-lwtunnel.patch +net-ipv6-fix-missing-dst-ref-drop-in-ila-lwtunnel.patch +gpio-rcar-fix-missing-of_node_put-call.patch diff --git a/queue-5.4/vlan-enforce-underlying-device-type.patch b/queue-5.4/vlan-enforce-underlying-device-type.patch new file mode 100644 index 0000000000..1e3d30f8a3 --- /dev/null +++ b/queue-5.4/vlan-enforce-underlying-device-type.patch @@ -0,0 +1,69 @@ +From b5bcdd96e58548cb00548d2401c5f87985557846 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 3 Mar 2025 16:56:19 +0100 +Subject: vlan: enforce underlying device type + +From: Oscar Maes + +[ Upstream commit b33a534610067ade2bdaf2052900aaad99701353 ] + +Currently, VLAN devices can be created on top of non-ethernet devices. + +Besides the fact that it doesn't make much sense, this also causes a +bug which leaks the address of a kernel function to usermode. + +When creating a VLAN device, we initialize GARP (garp_init_applicant) +and MRP (mrp_init_applicant) for the underlying device. + +As part of the initialization process, we add the multicast address of +each applicant to the underlying device, by calling dev_mc_add. + +__dev_mc_add uses dev->addr_len to determine the length of the new +multicast address. + +This causes an out-of-bounds read if dev->addr_len is greater than 6, +since the multicast addresses provided by GARP and MRP are only 6 +bytes long. + +This behaviour can be reproduced using the following commands: + +ip tunnel add gretest mode ip6gre local ::1 remote ::2 dev lo +ip l set up dev gretest +ip link add link gretest name vlantest type vlan id 100 + +Then, the following command will display the address of garp_pdu_rcv: + +ip maddr show | grep 01:80:c2:00:00:21 + +Fix the bug by enforcing the type of the underlying device during VLAN +device initialization. + +Fixes: 22bedad3ce11 ("net: convert multicast list to list_head") +Reported-by: syzbot+91161fe81857b396c8a0@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/netdev/000000000000ca9a81061a01ec20@google.com/ +Signed-off-by: Oscar Maes +Reviewed-by: Jiri Pirko +Link: https://patch.msgid.link/20250303155619.8918-1-oscmaes92@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/8021q/vlan.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c +index 796d95797ab40..c75fca3eed49e 100644 +--- a/net/8021q/vlan.c ++++ b/net/8021q/vlan.c +@@ -124,7 +124,8 @@ int vlan_check_real_dev(struct net_device *real_dev, + { + const char *name = real_dev->name; + +- if (real_dev->features & NETIF_F_VLAN_CHALLENGED) { ++ if (real_dev->features & NETIF_F_VLAN_CHALLENGED || ++ real_dev->type != ARPHRD_ETHER) { + pr_info("VLANs not supported on %s\n", name); + NL_SET_ERR_MSG_MOD(extack, "VLANs not supported on device"); + return -EOPNOTSUPP; +-- +2.39.5 + diff --git a/queue-5.4/wifi-iwlwifi-limit-printed-string-from-fw-file.patch b/queue-5.4/wifi-iwlwifi-limit-printed-string-from-fw-file.patch new file mode 100644 index 0000000000..a58fda54b0 --- /dev/null +++ b/queue-5.4/wifi-iwlwifi-limit-printed-string-from-fw-file.patch @@ -0,0 +1,43 @@ +From 40dc898f91d0394fa7b6aaac50bf09091e6a1cbd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 9 Feb 2025 14:34:51 +0200 +Subject: wifi: iwlwifi: limit printed string from FW file + +From: Johannes Berg + +[ Upstream commit e0dc2c1bef722cbf16ae557690861e5f91208129 ] + +There's no guarantee here that the file is always with a +NUL-termination, so reading the string may read beyond the +end of the TLV. If that's the last TLV in the file, it can +perhaps even read beyond the end of the file buffer. + +Fix that by limiting the print format to the size of the +buffer we have. + +Fixes: aee1b6385e29 ("iwlwifi: support fseq tlv and print fseq version") +Signed-off-by: Johannes Berg +Signed-off-by: Miri Korenblit +Link: https://patch.msgid.link/20250209143303.cb5f9d0c2f5d.Idec695d53c6c2234aade306f7647b576c7e3d928@changeid +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +index 9e63230da1ec0..03de1ca54c948 100644 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +@@ -1113,7 +1113,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, + + if (tlv_len != sizeof(*fseq_ver)) + goto invalid_tlv_len; +- IWL_INFO(drv, "TLV_FW_FSEQ_VERSION: %s\n", ++ IWL_INFO(drv, "TLV_FW_FSEQ_VERSION: %.32s\n", + fseq_ver->version); + } + break; +-- +2.39.5 +