5.15.162-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 1/356 wifi: mac80211: mesh: Fix leak of mesh_preq_queue objects
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Escande <[email protected]>
[ Upstream commit b7d7f11a291830fdf69d3301075dd0fb347ced84 ]
The hwmp code use objects of type mesh_preq_queue, added to a list in ieee80211_if_mesh, to keep track of mpath we need to resolve. If the mpath gets deleted, ex mesh interface is removed, the entries in that list will never get cleaned. Fix this by flushing all corresponding items of the preq_queue in mesh_path_flush_pending().
This should take care of KASAN reports like this:
unreferenced object 0xffff00000668d800 (size 128):
comm "kworker/u8:4", pid 67, jiffies 4295419552 (age 1836.444s) hex dump (first 32 bytes):
00 1f 05 09 00 00 ff ff 00 d5 68 06 00 00 ff ff ..........h.....
8e 97 ea eb 3e b8 01 00 00 00 00 00 00 00 00 00 ....>...........
backtrace:
[<000000007302a0b6>] __kmem_cache_alloc_node+0x1e0/0x35c
[<00000000049bd418>] kmalloc_trace+0x34/0x80
[<0000000000d792bb>] mesh_queue_preq+0x44/0x2a8
[<00000000c99c3696>] mesh_nexthop_resolve+0x198/0x19c
[<00000000926bf598>] ieee80211_xmit+0x1d0/0x1f4
[<00000000fc8c2284>] __ieee80211_subif_start_xmit+0x30c/0x764
[<000000005926ee38>] ieee80211_subif_start_xmit+0x9c/0x7a4
[<000000004c86e916>] dev_hard_start_xmit+0x174/0x440
[<0000000023495647>] __dev_queue_xmit+0xe24/0x111c
[<00000000cfe9ca78>] batadv_send_skb_packet+0x180/0x1e4
[<000000007bacc5d5>] batadv_v_elp_periodic_work+0x2f4/0x508
[<00000000adc3cd94>] process_one_work+0x4b8/0xa1c
[<00000000b36425d1>] worker_thread+0x9c/0x634
[<0000000005852dd5>] kthread+0x1bc/0x1c4
[<000000005fccd770>] ret_from_fork+0x10/0x20
unreferenced object 0xffff000009051f00 (size 128):
comm "kworker/u8:4", pid 67, jiffies 4295419553 (age 1836.440s)
hex dump (first 32 bytes):
90 d6 92 0d 00 00 ff ff 00 d8 68 06 00 00 ff ff ..........h.....
36 27 92 e4 02 e0 01 00 00 58 79 06 00 00 ff ff 6'.......Xy.....
backtrace:
[<000000007302a0b6>] __kmem_cache_alloc_node+0x1e0/0x35c
[<00000000049bd418>] kmalloc_trace+0x34/0x80
[<0000000000d792bb>] mesh_queue_preq+0x44/0x2a8
[<00000000c99c3696>] mesh_nexthop_resolve+0x198/0x19c
[<00000000926bf598>] ieee80211_xmit+0x1d0/0x1f4
[<00000000fc8c2284>] __ieee80211_subif_start_xmit+0x30c/0x764
[<000000005926ee38>] ieee80211_subif_start_xmit+0x9c/0x7a4
[<000000004c86e916>] dev_hard_start_xmit+0x174/0x440
[<0000000023495647>] __dev_queue_xmit+0xe24/0x111c
[<00000000cfe9ca78>] batadv_send_skb_packet+0x180/0x1e4
[<000000007bacc5d5>] batadv_v_elp_periodic_work+0x2f4/0x508
[<00000000adc3cd94>] process_one_work+0x4b8/0xa1c
[<00000000b36425d1>] worker_thread+0x9c/0x634
[<0000000005852dd5>] kthread+0x1bc/0x1c4
[<000000005fccd770>] ret_from_fork+0x10/0x20--- net/mac80211/mesh_pathtbl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/mac80211/mesh_pathtbl.c +13 -0
@@ -723,10 +723,23 @@ void mesh_path_discard_frame(struct ieee80211_sub_if_data *sdata,*/ void mesh_path_flush_pending (struct mesh_path *mpath) { +struct ieee80211_sub_if_data *sdata = mpath->sdata; +struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; +struct mesh_preq_queue *preq, *tmp;struct sk_buff *skb;while ((skb =skb_dequeue (&mpath->frame_queue)) !=NULL )mesh_path_discard_frame (mpath->sdata, skb); + +spin_lock_bh (&ifmsh->mesh_preq_queue_lock); +list_for_each_entry_safe (preq, tmp, &ifmsh->preq_queue.list, list) { +if (ether_addr_equal (mpath->dst, preq->dst)) { +list_del (&preq->list); +kfree (preq); + --ifmsh->preq_queue_len; + } + } +spin_unlock_bh (&ifmsh->mesh_preq_queue_lock); }/**
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 2/356 wifi: mac80211: Fix deadlock in ieee80211_sta_ps_deliver_wakeup()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Remi Pommarel <[email protected]>
[ Upstream commit 44c06bbde6443de206b30f513100b5670b23fc5e ]
The ieee80211_sta_ps_deliver_wakeup() function takes sta->ps_lock to synchronizes with ieee80211_tx_h_unicast_ps_buf() which is called from softirq context. However using only spin_lock() to get sta->ps_lock in ieee80211_sta_ps_deliver_wakeup() does not prevent softirq to execute on this same CPU, to run ieee80211_tx_h_unicast_ps_buf() and try to take this same lock ending in deadlock. Below is an example of rcu stall that arises in such situation.
rcu: INFO: rcu_sched self-detected stall on CPU rcu: 2-....: (42413413 ticks this GP) idle=b154/1/0x4000000000000000 softirq=1763/1765 fqs=21206996 rcu: (t=42586894 jiffies g=2057 q=362405 ncpus=4) CPU: 2 PID: 719 Comm: wpa_supplicant Tainted: G W 6.4.0-02158-g1b062f552873 #742 Hardware name: RPT (r1) (DT) pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : queued_spin_lock_slowpath+0x58/0x2d0 lr : invoke_tx_handlers_early+0x5b4/0x5c0 sp : ffff00001ef64660 x29: ffff00001ef64660 x28: ffff000009bc1070 x27: ffff000009bc0ad8 x26: ffff000009bc0900 x25: ffff00001ef647a8 x24: 0000000000000000 x23: ffff000009bc0900 x22: ffff000009bc0900 x21: ffff00000ac0e000 x20: ffff00000a279e00 x19: ffff00001ef646e8 x18: 0000000000000000 x17: ffff800016468000 x16: ffff00001ef608c0 x15: 0010533c93f64f80 x14: 0010395c9faa3946 x13: 0000000000000000 x12: 00000000fa83b2da x11: 000000012edeceea x10: ffff0000010fbe00 x9 : 0000000000895440 x8 : 000000000010533c x7 : ffff00000ad8b740 x6 : ffff00000c350880 x5 : 0000000000000007 x4 : 0000000000000001 x3 : 0000000000000000 x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffff00000ac0e0e8 Call trace: queued_spin_lock_slowpath+0x58/0x2d0 ieee80211_tx+0x80/0x12c ieee80211_tx_pending+0x110/0x278 tasklet_action_common.constprop.0+0x10c/0x144 tasklet_action+0x20/0x28 _stext+0x11c/0x284 ____do_softirq+0xc/0x14 call_on_irq_stack+0x24/0x34 do_softirq_own_stack+0x18/0x20 do_softirq+0x74/0x7c __local_bh_enable_ip+0xa0/0xa4 _ieee80211_wake_txqs+0x3b0/0x4b8 __ieee80211_wake_queue+0x12c/0x168 ieee80211_add_pending_skbs+0xec/0x138 ieee80211_sta_ps_deliver_wakeup+0x2a4/0x480 ieee80211_mps_sta_status_update.part.0+0xd8/0x11c ieee80211_mps_sta_status_update+0x18/0x24 sta_apply_parameters+0x3bc/0x4c0 ieee80211_change_station+0x1b8/0x2dc nl80211_set_station+0x444/0x49c genl_family_rcv_msg_doit.isra.0+0xa4/0xfc genl_rcv_msg+0x1b0/0x244 netlink_rcv_skb+0x38/0x10c genl_rcv+0x34/0x48 netlink_unicast+0x254/0x2bc netlink_sendmsg+0x190/0x3b4 ____sys_sendmsg+0x1e8/0x218 ___sys_sendmsg+0x68/0x8c __sys_sendmsg+0x44/0x84 __arm64_sys_sendmsg+0x20/0x28 do_el0_svc+0x6c/0xe8 el0_svc+0x14/0x48 el0t_64_sync_handler+0xb0/0xb4 el0t_64_sync+0x14c/0x150
Using spin_lock_bh()/spin_unlock_bh() instead prevents softirq to raise on the same CPU that is holding the lock.
--- net/mac80211/sta_info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mac80211/sta_info.c +2 -2
@@ -1339,7 +1339,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)skb_queue_head_init (&pending);/* sync with ieee80211_tx_h_unicast_ps_buf */ -spin_lock (&sta->ps_lock); +spin_lock_bh (&sta->ps_lock);/* Send all buffered frames to the station */ for (ac =0 ; ac <IEEE80211_NUM_ACS ; ac++) {int count =skb_queue_len (&pending), tmp;
@@ -1368,7 +1368,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)*/ clear_sta_flag (sta,WLAN_STA_PSPOLL );clear_sta_flag (sta,WLAN_STA_UAPSD ); -spin_unlock (&sta->ps_lock); +spin_unlock_bh (&sta->ps_lock);atomic_dec (&ps->num_sta_ps);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 3/356 wifi: cfg80211: Lock wiphy in cfg80211_get_station
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Remi Pommarel <[email protected]>
[ Upstream commit 642f89daa34567d02f312d03e41523a894906dae ]
Wiphy should be locked before calling rdev_get_station() (see lockdep assert in ieee80211_get_station()).
This fixes the following kernel NULL dereference:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000050 Mem abort info: ESR = 0x0000000096000006 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x06: level 2 translation fault Data abort info: ISV = 0, ISS = 0x00000006 CM = 0, WnR = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=0000000003001000 [0000000000000050] pgd=0800000002dca003, p4d=0800000002dca003, pud=08000000028e9003, pmd=0000000000000000 Internal error: Oops: 0000000096000006 [#1] SMP Modules linked in: netconsole dwc3_meson_g12a dwc3_of_simple dwc3 ip_gre gre ath10k_pci ath10k_core ath9k ath9k_common ath9k_hw ath CPU: 0 PID: 1091 Comm: kworker/u8:0 Not tainted 6.4.0-02144-g565f9a3a7911-dirty #705 Hardware name: RPT (r1) (DT) Workqueue: bat_events batadv_v_elp_throughput_metric_update pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : ath10k_sta_statistics+0x10/0x2dc [ath10k_core] lr : sta_set_sinfo+0xcc/0xbd4 sp : ffff000007b43ad0 x29: ffff000007b43ad0 x28: ffff0000071fa900 x27: ffff00000294ca98 x26: ffff000006830880 x25: ffff000006830880 x24: ffff00000294c000 x23: 0000000000000001 x22: ffff000007b43c90 x21: ffff800008898acc x20: ffff00000294c6e8 x19: ffff000007b43c90 x18: 0000000000000000 x17: 445946354d552d78 x16: 62661f7200000000 x15: 57464f445946354d x14: 0000000000000000 x13: 00000000000000e3 x12: d5f0acbcebea978e x11: 00000000000000e3 x10: 000000010048fe41 x9 : 0000000000000000 x8 : ffff000007b43d90 x7 : 000000007a1e2125 x6 : 0000000000000000 x5 : ffff0000024e0900 x4 : ffff800000a0250c x3 : ffff000007b43c90 x2 : ffff00000294ca98 x1 : ffff000006831920 x0 : 0000000000000000 Call trace: ath10k_sta_statistics+0x10/0x2dc [ath10k_core] sta_set_sinfo+0xcc/0xbd4 ieee80211_get_station+0x2c/0x44 cfg80211_get_station+0x80/0x154 batadv_v_elp_get_throughput+0x138/0x1fc batadv_v_elp_throughput_metric_update+0x1c/0xa4 process_one_work+0x1ec/0x414 worker_thread+0x70/0x46c kthread+0xdc/0xe0 ret_from_fork+0x10/0x20 Code: a9bb7bfd 910003fd a90153f3 f9411c40 (f9402814)
This happens because STA has time to disconnect and reconnect before batadv_v_elp_throughput_metric_update() delayed work gets scheduled. In this situation, ath10k_sta_state() can be in the middle of resetting arsta data when the work queue get chance to be scheduled and ends up accessing it. Locking wiphy prevents that.
--- net/wireless/util.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/wireless/util.c +6 -1
@@ -2033,6 +2033,7 @@ int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, {struct cfg80211_registered_device *rdev;struct wireless_dev *wdev; +int ret; wdev = dev->ieee80211_ptr;if (!wdev)
@@ -2044,7 +2045,11 @@ int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,memset (sinfo,0 ,sizeof (*sinfo)); -return rdev_get_station (rdev, dev, mac_addr, sinfo); +wiphy_lock (&rdev->wiphy); + ret =rdev_get_station (rdev, dev, mac_addr, sinfo); +wiphy_unlock (&rdev->wiphy); + +return ret; }EXPORT_SYMBOL (cfg80211_get_station);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 4/356 wifi: cfg80211: pmsr: use correct nla_get_uX functions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit ab904521f4de52fef4f179d2dfc1877645ef5f5c ]
The commit 9bb7e0f24e7e ("cfg80211: add peer measurement with FTM initiator API") defines four attributes NL80211_PMSR_FTM_REQ_ATTR_ {NUM_BURSTS_EXP}/{BURST_PERIOD}/{BURST_DURATION}/{FTMS_PER_BURST} in following ways.
static const struct nla_policy
nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX + 1] = {
...
[NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP] =
NLA_POLICY_MAX(NLA_U8, 15),
[NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD] = { .type = NLA_U16 },
[NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION] =
NLA_POLICY_MAX(NLA_U8, 15),
[NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST] =
NLA_POLICY_MAX(NLA_U8, 31),
...
};That is, those attributes are expected to be NLA_U8 and NLA_U16 types. However, the consumers of these attributes in pmsr_parse_ftm blindly all use nla_get_u32, which is incorrect and causes functionality issues on little-endian platforms. Hence, fix them with the correct nla_get_u8 and nla_get_u16 functions.
--- net/wireless/pmsr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/wireless/pmsr.c +4 -4
@@ -58,7 +58,7 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, out->ftm.burst_period =0 ;if (tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD ]) out->ftm.burst_period = -nla_get_u32 (tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD ]); +nla_get_u16 (tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD ]); out->ftm.asap = !!tb[NL80211_PMSR_FTM_REQ_ATTR_ASAP ];if (out->ftm.asap && !capa->ftm.asap) {
@@ -77,7 +77,7 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, out->ftm.num_bursts_exp =0 ;if (tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP ]) out->ftm.num_bursts_exp = -nla_get_u32 (tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP ]); +nla_get_u8 (tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP ]);if (capa->ftm.max_bursts_exponent >=0 && out->ftm.num_bursts_exp > capa->ftm.max_bursts_exponent) {
@@ -90,7 +90,7 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, out->ftm.burst_duration =15 ;if (tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION ]) out->ftm.burst_duration = -nla_get_u32 (tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION ]); +nla_get_u8 (tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION ]); out->ftm.ftms_per_burst =0 ;if (tb[NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST ])
@@ -109,7 +109,7 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, out->ftm.ftmr_retries =3 ;if (tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES ]) out->ftm.ftmr_retries = -nla_get_u32 (tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES ]); +nla_get_u8 (tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES ]); out->ftm.request_lci = !!tb[NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI ];if (out->ftm.request_lci && !capa->ftm.request_lci) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 5/356 wifi: iwlwifi: mvm: revert gen2 TX A-MPDU size to 64
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 4a7aace2899711592327463c1a29ffee44fcc66e ]
We don't actually support >64 even for HE devices, so revert back to 64. This fixes an issue where the session is refused because the queue is configured differently from the actual session later.
--- drivers/net/wireless/intel/iwlwifi/mvm/rs.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rs.h +2 -7
@@ -133,13 +133,8 @@ enum {#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (63)#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) -/* -* FIXME - various places in firmware API still use u8, -* e.g. LQ command and SCD config command. -* This should be 256 instead. -*/ -#define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF (255) -#define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_MAX (255) +#define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF (64) +#define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_MAX (64)#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)#define LQ_SIZE 2/* 2 mode tables: "Active" and "Search" */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 6/356 wifi: iwlwifi: dbg_ini: move iwl_dbg_tlv_free outside of debugfs ifdef
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shahar S Matityahu <[email protected]>
[ Upstream commit 87821b67dea87addbc4ab093ba752753b002176a ]
The driver should call iwl_dbg_tlv_free even if debugfs is not defined since ini mode does not depend on debugfs ifdef.
--- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c +1 -1
@@ -1667,8 +1667,8 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans) err_fw:#ifdef CONFIG_IWLWIFI_DEBUGFS debugfs_remove_recursive (drv->dbgfs_drv); -iwl_dbg_tlv_free (drv->trans);#endif +iwl_dbg_tlv_free (drv->trans);kfree (drv); err:return ERR_PTR (ret);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 7/356 wifi: iwlwifi: mvm: check n_ssids before accessing the ssids
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miri Korenblit <[email protected]>
[ Upstream commit 60d62757df30b74bf397a2847a6db7385c6ee281 ]
In some versions of cfg80211, the ssids poinet might be a valid one even though n_ssids is 0. Accessing the pointer in this case will cuase an out-of-bound access. Fix this by checking n_ssids first.
--- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/scan.c +2 -2
@@ -1312,7 +1312,7 @@ static void iwl_mvm_scan_umac_dwell(struct iwl_mvm *mvm,if (IWL_MVM_ADWELL_MAX_BUDGET ) cmd->v7.adwell_max_budget =cpu_to_le16 (IWL_MVM_ADWELL_MAX_BUDGET ); -else if (params->ssids && params->ssids[0 ].ssid_len) +else if (params->n_ssids && params->ssids[0 ].ssid_len) cmd->v7.adwell_max_budget =cpu_to_le16 (IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN );else
@@ -1414,7 +1414,7 @@ iwl_mvm_scan_umac_dwell_v10(struct iwl_mvm *mvm,if (IWL_MVM_ADWELL_MAX_BUDGET ) general_params->adwell_max_budget =cpu_to_le16 (IWL_MVM_ADWELL_MAX_BUDGET ); -else if (params->ssids && params->ssids[0 ].ssid_len) +else if (params->n_ssids && params->ssids[0 ].ssid_len) general_params->adwell_max_budget =cpu_to_le16 (IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN );else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainercover 5.15.162-rc1 review
This is the start of the stable review cycle for the 5.15.162 release. There are 356 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 05 Jul 2024 10:28:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.162-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.15.162-rc1
Alex Bee <[email protected]>
arm64: dts: rockchip: Add sound-dai-cells for RK3368
FUKAUMI Naoki <[email protected]>
arm64: dts: rockchip: fix PMIC interrupt pin on ROCK Pi E
Johan Jonker <[email protected]>
ARM: dts: rockchip: rk3066a: add #sound-dai-cells to hdmi node
Marc Zyngier <[email protected]>
KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption
Ard Biesheuvel <[email protected]>
efi/x86: Free EFI memory map only when installing a new one.
Ard Biesheuvel <[email protected]>
efi: xen: Set EFI_PARAVIRT for Xen dom0 boot on all architectures
Ard Biesheuvel <[email protected]>
efi: memmap: Move manipulation routines into x86 arch tree
Liu Zixian <[email protected]>
efi: Correct comment on efi_memmap_alloc
Zheng Zhi Yuan <[email protected]>
drivers: fix typo in firmware/efi/memmap.c
Kuniyuki Iwashima <[email protected]>
tcp: Fix data races around icsk->icsk_af_ops.
Kuniyuki Iwashima <[email protected]>
ipv6: Fix data races around sk->sk_prot.
Eric Dumazet <[email protected]>
ipv6: annotate some data-races around sk->sk_prot
Matthew Wilcox (Oracle) <[email protected]>
nfs: Leave pages in the pagecache if readpage failed
Uwe Kleine-König <[email protected]>
pwm: stm32: Refuse too small period requests
Arnd Bergmann <[email protected]>
syscalls: fix sys_fanotify_mark prototype
Arnd Bergmann <[email protected]>
syscalls: fix compat_sys_io_pgetevents_time64 usage
Arnd Bergmann <[email protected]>
ftruncate: pass a signed offset
Niklas Cassel <[email protected]>
ata: libata-core: Fix double free on error
Niklas Cassel <[email protected]>
ata: ahci: Clean up sysfs file on error
Sven Eckelmann <[email protected]>
batman-adv: Don't accept TT entries for out-of-spec VIDs
Ma Ke <[email protected]>
drm/nouveau/dispnv04: fix null pointer dereference in nv17_tv_get_hd_modes
Janusz Krzysztofik <[email protected]>
drm/i915/gt: Fix potential UAF by revoke of fence registers
Julia Zhang <[email protected]>
drm/amdgpu: avoid using null object of framebuffer
Ma Ke <[email protected]>
drm/nouveau/dispnv04: fix null pointer dereference in nv17_tv_get_ld_modes
Arnd Bergmann <[email protected]>
hexagon: fix fadvise64_64 calling conventions
Arnd Bergmann <[email protected]>
csky, hexagon: fix broken sys_sync_file_range
Arnd Bergmann <[email protected]>
sh: rework sync_file_range ABI
Dragan Simic <[email protected]>
kbuild: Install dtb files as 0644 in Makefile.dtbinst
Yuntao Wang <[email protected]>
cpu/hotplug: Fix dynstate assignment in __cpuhp_setup_state_cpuslocked()
Oleksij Rempel <[email protected]>
net: can: j1939: enhanced error handling for tightly received RTS messages in xtp_rx_rts_session_new
Oleksij Rempel <[email protected]>
net: can: j1939: recover socket queue on CAN bus error during BAM transmission
Shigeru Yoshida <[email protected]>
net: can: j1939: Initialize unused data in j1939_send_one()
Jean-Michel Hautbois <[email protected]>
tty: mcf: MCF54418 has 10 UARTS
Stefan Eichenberger <[email protected]>
serial: imx: set receiver level before starting uart
Udit Kumar <[email protected]>
serial: 8250_omap: Implementation of Errata i2310
Meng Li <[email protected]>
usb: dwc3: core: remove lock of otg mode during gadget suspend/resume to avoid deadlock
Nikita Zhandarovich <[email protected]>
usb: atm: cxacru: fix endpoint checking in cxacru_bind()
Dan Carpenter <[email protected]>
usb: musb: da8xx: fix a resource leak in probe()
Oliver Neukum <[email protected]>
usb: gadget: printer: fix races against disable
Oliver Neukum <[email protected]>
usb: gadget: printer: SS+ support
Jose Ignacio Tornos Martinez <[email protected]>
net: usb: ax88179_178a: improve link status logs
Vasileios Amoiridis <[email protected]>
iio: chemical: bme680: Fix sensor data read operation
Vasileios Amoiridis <[email protected]>
iio: chemical: bme680: Fix overflows in compensate() functions
Vasileios Amoiridis <[email protected]>
iio: chemical: bme680: Fix calibration data variable
Vasileios Amoiridis <[email protected]>
iio: chemical: bme680: Fix pressure value output
Alexander Sverdlin <[email protected]>
iio: accel: fxls8962af: select IIO_BUFFER & IIO_KFIFO_BUF
Fernando Yang <[email protected]>
iio: adc: ad7266: Fix variable checking bug
Wolfram Sang <[email protected]>
i2c: testunit: discard write requests while old command is running
Wolfram Sang <[email protected]>
i2c: testunit: don't erase registers after STOP
Adrian Hunter <[email protected]>
mmc: sdhci: Do not lock spinlock around mmc_gpio_get_ro()
Adrian Hunter <[email protected]>
mmc: sdhci: Do not invert write-protect twice
Ilpo Järvinen <[email protected]>
mmc: sdhci-pci: Convert PCIBIOS_* return codes to errnos
Jan Kara <[email protected]>
ocfs2: fix DIO failure due to insufficient transaction credits
Arnd Bergmann <[email protected]>
parisc: use generic sys_fanotify_mark implementation
Linus Torvalds <[email protected]>
x86: stop playing stack games in profile_pc()
Kent Gibson <[email protected]>
gpiolib: cdev: Disallow reconfiguration without direction (uAPI v1)
Aleksandr Mishin <[email protected]>
gpio: davinci: Validate the obtained number of IRQs
Liu Ying <[email protected]>
drm/panel: simple: Add missing display timing flags for KOE TX26D202VM0BWA
Hannes Reinecke <[email protected]>
nvme: fixup comment for nvme RDMA Provider Type
Erick Archer <[email protected]>
drm/radeon/radeon_display: Decrease the size of allocated memory
Andrew Davis <[email protected]>
soc: ti: wkup_m3_ipc: Send NULL dummy message instead of pointer message
Ricardo Ribalda <[email protected]>
media: dvbdev: Initialize sbuf
Oswald Buddenhagen <[email protected]>
ALSA: emux: improve patch ioctl data validation
Joachim Vandersmissen <[email protected]>
crypto: ecdh - explicitly zeroize private_key
Dawei Li <[email protected]>
net/dpaa2: Avoid explicit cpumask var allocation on stack
Dawei Li <[email protected]>
net/iucv: Avoid explicit cpumask var allocation on stack
Wenchao Hao <[email protected]>
RDMA/restrack: Fix potential invalid address access
Anton Protopopov <[email protected]>
bpf: Add a check for struct bpf_fib_lookup size
Denis Arefev <[email protected]>
mtd: partitions: redboot: Added conversion of operands to a larger type
Uros Bizjak <[email protected]>
x86/fpu: Fix AMD X86_BUG_FXSAVE_LEAK fixup
Maxime Coquelin <[email protected]>
vduse: Temporarily fail if control queue feature requested
Maxime Coquelin <[email protected]>
vduse: validate block features only with block devices
Laurent Pinchart <[email protected]>
drm/panel: ilitek-ili9881c: Fix warning with GPIO controllers that sleep
Christophe Leroy <[email protected]>
bpf: Take return from set_memory_ro() into account with bpf_prog_lock_ro()
Yunseong Kim <[email protected]>
tracing/net_sched: NULL pointer dereference in perf_trace_qdisc_reset()
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: fully validate NFT_DATA_VALUE on store to data registers
Neal Cardwell <[email protected]>
tcp: fix tcp_rcv_fastopen_synack() to enter TCP_CA_Loss for failed TFO
Arnd Bergmann <[email protected]>
parisc: use correct compat recv/recvfrom syscalls
Arnd Bergmann <[email protected]>
sparc: fix compat recv/recvfrom syscalls
Arnd Bergmann <[email protected]>
sparc: fix old compat_sys_select()
luoxuanqiang <[email protected]>
Fix race for duplicate reqsk on identical SYN
Akhmat Karakotov <[email protected]>
tcp: Use BPF timeout setting for SYN ACK RTO
Daniil Dulov <[email protected]>
xdp: Remove WARN() from __xdp_reg_mem_model()
Enguerrand de Ribaucourt <[email protected]>
net: phy: micrel: add Microchip KSZ 9477 to the device table
Nick Child <[email protected]>
ibmvnic: Free any outstanding tx skbs during scrq reset
Tristram Ha <[email protected]>
net: dsa: microchip: fix initial port flush problem
Elinor Montmasson <[email protected]>
ASoC: fsl-asoc-card: set priv->pdev before using it
Oleksij Rempel <[email protected]>
net: stmmac: Assign configured channel value to EXTTS event
Russell King (Oracle) <[email protected]>
net: mdio: add helpers to extract clause 45 regad and devad fields
Alex Deucher <[email protected]>
drm/amdgpu: fix UBSAN warning in kv_dpm.c
Steve French <[email protected]>
cifs: fix typo in module parameter enable_gcm_256
Huang-Huang Bao <[email protected]>
pinctrl: rockchip: fix pinmux reset in rockchip_pmx_set
Huang-Huang Bao <[email protected]>
pinctrl: rockchip: use dedicated pinctrl type for RK3328
Huang-Huang Bao <[email protected]>
pinctrl: rockchip: fix pinmux bits for RK3328 GPIO3-B pins
Huang-Huang Bao <[email protected]>
pinctrl: rockchip: fix pinmux bits for RK3328 GPIO2-B pins
Hagar Hemdan <[email protected]>
pinctrl: fix deadlock in create_pinctrl() when handling -EPROBE_DEFER
John Keeping <[email protected]>
Input: ili210x - fix ili251x_read_touch_data() return value
Ziwei Xiao <[email protected]>
gve: Clear napi->skb before dev_kfree_skb_any()
David Awogbemila <[email protected]>
gve: Add RX context.
Mario Limonciello <[email protected]>
ACPI: x86: Force StorageD3Enable on more products
Mario Limonciello <[email protected]>
ACPI: x86: utils: Add Picasso to the list for forcing StorageD3Enable
Jan Beulich <[email protected]>
x86/mm/numa: Use NUMA_NO_NODE when calling memblock_set_node()
Enzo Matsumiya <[email protected]>
smb: client: fix deadlock in smb2_find_smb_tcon()
Yazen Ghannam <[email protected]>
x86/amd_nb: Check for invalid SMN reads
Naveen Naidu <[email protected]>
PCI: Add PCI_ERROR_RESPONSE and related definitions
Haifeng Xu <[email protected]>
perf/core: Fix missing wakeup when waiting for context reference
Nam Cao <[email protected]>
riscv: fix overlap of allocated page and PTR_ERR
Jisheng Zhang <[email protected]>
riscv: mm: init: try best to use IS_ENABLED(CONFIG_64BIT) instead of #ifdef
Matthias Maennich <[email protected]>
kheaders: explicitly define file modes for archived headers
Masahiro Yamada <[email protected]>
Revert "kheaders: substituting --sort in archive creation"
Chris Wilson <[email protected]>
drm/i915/gt: Disarm breadcrumbs if engines are already idle
Chris Wilson <[email protected]>
drm/i915/gt: Only kick the signal worker if there's been an update
Nandor Kracser <[email protected]>
ksmbd: ignore trailing slashes in share paths
Tony Luck <[email protected]>
x86/cpu: Fix x86_match_cpu() to match just X86_VENDOR_INTEL
Tony Luck <[email protected]>
x86/cpu/vfm: Add new macros to work with (vendor/family/model) values
Jeff Johnson <[email protected]>
tracing: Add MODULE_DESCRIPTION() to preemptirq_delay_test
Matthew Mirvish <[email protected]>
bcache: fix variable length array abuse in btree_iter
Tomi Valkeinen <[email protected]>
pmdomain: ti-sci: Fix duplicate PD referrals
Bitterblue Smith <[email protected]>
wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power
Kees Cook <[email protected]>
rtlwifi: rtl8192de: Style clean-ups
Krzysztof Kozlowski <[email protected]>
ARM: dts: samsung: smdk4412: fix keypad no-autorepeat
Krzysztof Kozlowski <[email protected]>
ARM: dts: samsung: exynos4412-origen: fix keypad no-autorepeat
Krzysztof Kozlowski <[email protected]>
ARM: dts: samsung: smdkv310: fix keypad no-autorepeat
Adrian Hunter <[email protected]>
perf script: Show also errors for --insn-trace option
Changbin Du <[email protected]>
perf: script: add raw|disasm arguments to --insn-trace option
Martin Leung <[email protected]>
drm/amd/display: revert Exit idle optimizations before HDCP execution
Frank Li <[email protected]>
arm64: dts: imx8qm-mek: fix gpio number for reg_usdhc2_vmmc
Krzysztof Kozlowski <[email protected]>
dt-bindings: i2c: google,cros-ec-i2c-tunnel: correct path to i2c-controller schema
Grygorii Tertychnyi <[email protected]>
i2c: ocores: set IACK bit after core is enabled
Eric Dumazet <[email protected]>
tcp: clear tp->retrans_stamp in tcp_rcv_fastopen_synack()
Aleksandr Nogikh <[email protected]>
kcov: don't lose track of remote references during softirqs
Peter Oberparleiter <[email protected]>
gcov: add support for GCC 14
Alex Deucher <[email protected]>
drm/radeon: fix UBSAN warning in kv_dpm.c
Jani Nikula <[email protected]>
drm/i915/mso: using joiner is not possible with eDP MSO
Edson Juliano Drosdeck <[email protected]>
ALSA: hda/realtek: Limit mic boost on N14AP7
Sean Christopherson <[email protected]>
KVM: x86: Always sync PIR to IRR prior to scanning I/O APIC routes
Boris Burkov <[email protected]>
btrfs: retry block group reclaim without infinite loop
Ignat Korchagin <[email protected]>
net: do not leave a dangling sk pointer, when socket creation fails
Erwan Le Ray <[email protected]>
serial: stm32: rework RX over DMA
Patrisious Haddad <[email protected]>
RDMA/mlx5: Add check for srq max_sge attribute
Raju Rangoju <[email protected]>
ACPICA: Revert "ACPICA: avoid Info: mapping multiple BARs. Your kernel is fine."
Kalle Niemi <[email protected]>
regulator: bd71815: fix ramp values
Nikita Shubin <[email protected]>
dmaengine: ioatdma: Fix missing kmem_cache_destroy()
Nikita Shubin <[email protected]>
dmaengine: ioatdma: Fix kmemleak in ioat_pci_probe()
Nikita Shubin <[email protected]>
dmaengine: ioatdma: Fix error path in ioat3_dma_probe()
Bjorn Helgaas <[email protected]>
dmaengine: ioat: use PCI core macros for PCIe Capability
Nikita Shubin <[email protected]>
dmaengine: ioatdma: Fix leaking on version mismatch
Bjorn Helgaas <[email protected]>
dmaengine: ioat: Drop redundant pci_enable_pcie_error_reporting()
Qing Wang <[email protected]>
dmaengine: ioat: switch from 'pci_' to 'dma_' API
Li RongQing <[email protected]>
dmaengine: idxd: Fix possible Use-After-Free in irq_process_work_list
Biju Das <[email protected]>
regulator: core: Fix modpost error "regulator_get_regmap" undefined
Oliver Neukum <[email protected]>
net: usb: rtl8150 fix unintiatilzed variables in rtl8150_get_link_ksettings
Pavan Chebbi <[email protected]>
bnxt_en: Restore PTP tx_avail count in case of skb_pad() error
Jianguo Wu <[email protected]>
seg6: fix parameter passing when calling NF_HOOK() in End.DX4 and End.DX6 behaviors
Jozsef Kadlecsik <[email protected]>
netfilter: ipset: Fix suspicious rcu_dereference_protected()
Simon Horman <[email protected]>
octeontx2-pf: Add error handling to VLAN unoffload handling
Heng Qi <[email protected]>
virtio_net: checksum offloading handling fix
Xiaolei Wang <[email protected]>
net: stmmac: No need to calculate speed divider when offload is disabled
Dan Carpenter <[email protected]>
ptp: fix integer overflow in max_vclocks_store
Xin Long <[email protected]>
sched: act_ct: add netns into the key of tcf_ct_flow_table
Vlad Buslov <[email protected]>
net/sched: act_ct: set 'net' pointer when creating new nf_flow_table
Xin Long <[email protected]>
tipc: force a dst refcount before doing decryption
David Ruth <[email protected]>
net/sched: act_api: fix possible infinite loop in tcf_idr_check_alloc()
Pedro Tammela <[email protected]>
net/sched: act_api: rely on rcu in tcf_idr_check_alloc
Stefan Wahren <[email protected]>
qca_spi: Make interrupt remembering atomic
Yue Haibing <[email protected]>
netns: Make get_net_ns() handle zero refcount net
Eric Dumazet <[email protected]>
xfrm6: check ip6_dst_idev() return value in xfrm6_get_saddr()
Eric Dumazet <[email protected]>
ipv6: prevent possible NULL dereference in rt6_probe()
Eric Dumazet <[email protected]>
ipv6: prevent possible NULL deref in fib6_nh_init()
Gavrilov Ilia <[email protected]>
netrom: Fix a memory leak in nr_heartbeat_expiry()
Ondrej Mosnacek <[email protected]>
cipso: fix total option length computation
Masami Hiramatsu (Google) <[email protected]>
tracing: Build event generation tests only as modules
Christian Marangi <[email protected]>
mips: bmips: BCM6358: make sure CBR is correctly set
Ilpo Järvinen <[email protected]>
MIPS: Routerboard 532: Fix vendor retry check code
Parker Newman <[email protected]>
serial: exar: adding missing CTI and Exar PCI ids
Esben Haabendal <[email protected]>
serial: imx: Introduce timeout when waiting on transmitter empty
Songyang Li <[email protected]>
MIPS: Octeon: Add PCIe link status check
Mario Limonciello <[email protected]>
PCI/PM: Avoid D3cold for HP Pavilion 17 PC/1972 PCIe Ports
Roman Smirnov <[email protected]>
udf: udftime: prevent overflow in udf_disk_stamp_to_time()
Joao Pinto <[email protected]>
Avoid hw_desc array overrun in dw-axi-dmac
Alex Henrie <[email protected]>
usb: misc: uss720: check for incompatible versions of the Belkin F5U002
Yunlei He <[email protected]>
f2fs: remove clear SB_INLINECRYPT flag in default_options
Aleksandr Aprelkov <[email protected]>
iommu/arm-smmu-v3: Free MSIs in case of ENOMEM
Tzung-Bi Shih <[email protected]>
power: supply: cros_usbpd: provide ID table for avoiding fallback match
Michael Ellerman <[email protected]>
powerpc/io: Avoid clang null pointer arithmetic warnings
Nathan Lynch <[email protected]>
powerpc/pseries: Enforce hcall result buffer validity and size
Erico Nunes <[email protected]>
drm/lima: mask irqs in timeout path before hard reset
Erico Nunes <[email protected]>
drm/lima: add mask irq callback to gp and pp
Nicholas Kazlauskas <[email protected]>
drm/amd/display: Exit idle optimizations before HDCP execution
Uri Arev <[email protected]>
Bluetooth: ath3k: Fix multiple issues reported by checkpatch.pl
Takashi Iwai <[email protected]>
ACPI: video: Add backlight=native quirk for Lenovo Slim 7 16ARH7
Sean O'Brien <[email protected]>
HID: Add quirk for Logitech Casa touchpad
Breno Leitao <[email protected]>
netpoll: Fix race condition in netpoll_owner_active
Kunwu Chan <[email protected]>
kselftest: arm64: Add a null pointer check
Manish Rangankar <[email protected]>
scsi: qedi: Fix crash while reading debugfs attribute
Wander Lairson Costa <[email protected]>
drop_monitor: replace spin_lock by raw_spin_lock
Eric Dumazet <[email protected]>
af_packet: avoid a false positive warning in packet_setsockopt()
Arnd Bergmann <[email protected]>
wifi: ath9k: work around memset overflow warning
Eric Dumazet <[email protected]>
batman-adv: bypass empty buckets in batadv_purge_orig_ref()
Yonghong Song <[email protected]>
selftests/bpf: Fix flaky test btf_map_in_map/lookup_update
Alessandro Carminati (Red Hat) <[email protected]>
selftests/bpf: Prevent client connect before server bind in test_tc_tunnel.sh
Justin Stitt <[email protected]>
block/ioctl: prefer different overflow check
Zqiang <[email protected]>
rcutorture: Fix invalid context warning when enable srcu barrier testing
Zqiang <[email protected]>
rcutorture: Make stall-tasks directly exit when rcutorture tests end
Paul E. McKenney <[email protected]>
rcutorture: Fix rcu_torture_one_read() pipe_count overflow comment
Chenghai Huang <[email protected]>
crypto: hisilicon/sec - Fix memory leak for sec resource release
Herbert Xu <[email protected]>
padata: Disable BH when taking works lock on MT path
Johan Hovold <[email protected]>
Bluetooth: qca: fix info leak when fetching board id
Dan Carpenter <[email protected]>
Bluetooth: qca: Fix error code in qca_read_fw_build_info()
Oleg Nesterov <[email protected]>
zap_pid_ns_processes: clear TIF_NOTIFY_SIGNAL along with TIF_SIGPENDING
Jean Delvare <[email protected]>
i2c: designware: Fix the functionality flags of the slave-only interface
Jean Delvare <[email protected]>
i2c: at91: Fix the functionality flags of the slave-only interface
Shichao Lai <[email protected]>
usb-storage: alauda: Check whether the media is initialized
Sicong Huang <[email protected]>
greybus: Fix use-after-free bug in gb_interface_release due to race condition.
Nathan Chancellor <[email protected]>
kbuild: Remove support for Clang's ThinLTO caching
YonglongLi <[email protected]>
mptcp: pm: update add_addr counters after connect
YonglongLi <[email protected]>
mptcp: pm: inc RmAddr MIB counter once per RM_ADDR ID
Matthias Goergens <[email protected]>
hugetlb_encode.h: fix undefined behaviour (34 << 26)
Doug Brown <[email protected]>
serial: 8250_pxa: Configure tx_loadsz to match FIFO IRQ level
Miaohe Lin <[email protected]>
mm/huge_memory: don't unpoison huge_zero_folio
Damien Le Moal <[email protected]>
scsi: mpi3mr: Fix ATA NCQ priority support
Oleg Nesterov <[email protected]>
tick/nohz_full: Don't abuse smp_call_function_single() in tick_setup_device()
Ryusuke Konishi <[email protected]>
nilfs2: fix potential kernel bug due to lack of writeback flag waiting
Alexander Shishkin <[email protected]>
intel_th: pci: Add Lunar Lake support
Alexander Shishkin <[email protected]>
intel_th: pci: Add Meteor Lake-S support
Alexander Shishkin <[email protected]>
intel_th: pci: Add Sapphire Rapids SOC support
Alexander Shishkin <[email protected]>
intel_th: pci: Add Granite Rapids SOC support
Alexander Shishkin <[email protected]>
intel_th: pci: Add Granite Rapids support
Nuno Sa <[email protected]>
dmaengine: axi-dmac: fix possible race in remove()
Rick Wertenbroek <[email protected]>
PCI: rockchip-ep: Remove wrong mask on subsys_vendor_id
Su Yue <[email protected]>
ocfs2: fix races between hole punching and AIO+DIO
Su Yue <[email protected]>
ocfs2: use coarse time for new created files
Rik van Riel <[email protected]>
fs/proc: fix softlockup in __read_vmcore
Trond Myklebust <[email protected]>
knfsd: LOOKUP can return an illegal error value
Vamshi Gajjela <[email protected]>
spmi: hisi-spmi-controller: Do not override device identifier
Hagar Gamal Halim Hemdan <[email protected]>
vmci: prevent speculation leaks by sanitizing event in event_deliver()
Thadeu Lima de Souza Cascardo <[email protected]>
sock_map: avoid race between sock_map_close and sk_psock_put
Damien Le Moal <[email protected]>
null_blk: Print correct max open zones limit in null_init_zoned_dev()
Steven Rostedt (Google) <[email protected]>
tracing/selftests: Fix kprobe event name test for .isra. functions
Paolo Abeni <[email protected]>
mptcp: ensure snd_una is properly initialized on connect
Marek Szyprowski <[email protected]>
drm/exynos: hdmi: report safe 640x480 mode as a fallback when no EDID found
Jani Nikula <[email protected]>
drm/exynos/vidi: fix memory leak in .get_modes()
Dirk Behme <[email protected]>
drivers: core: synchronize really_probe() and dev_uevent()
Jean-Baptiste Maneyrol <[email protected]>
iio: imu: inv_icm42600: delete unneeded update watermark call
Marc Ferland <[email protected]>
iio: dac: ad5592r: fix temperature channel scaling value
David Lechner <[email protected]>
iio: adc: ad9467: fix scan type sign
Rao Shoaib <[email protected]>
af_unix: Read with MSG_PEEK loops if the first unread byte is OOB
Taehee Yoo <[email protected]>
ionic: fix use after netif_napi_del()
Petr Pavlu <[email protected]>
net/ipv6: Fix the RT cache flush via sysctl using a previous delay
Xiaolei Wang <[email protected]>
net: stmmac: replace priv->speed with the portTransmitRate from the tc-cbs parameters
Jozsef Kadlecsik <[email protected]>
netfilter: ipset: Fix race between namespace cleanup and gc in the list:set type
Luiz Augusto von Dentz <[email protected]>
Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ
Gal Pressman <[email protected]>
net/mlx5e: Fix features validation check for tunneled UDP (non-VXLAN) packets
Eric Dumazet <[email protected]>
tcp: fix race in tcp_v6_syn_recv_sock()
Adam Miotk <[email protected]>
drm/bridge/panel: Fix runtime warning on panel bridge release
Amjad Ouled-Ameur <[email protected]>
drm/komeda: check for error-valued pointer
Aleksandr Mishin <[email protected]>
liquidio: Adjust a NULL pointer handling path in lio_vf_rep_copy_packet
Jie Wang <[email protected]>
net: hns3: add cond_resched() to hns3 ring buffer init process
Yonglong Liu <[email protected]>
net: hns3: fix kernel crash problem in concurrent scenario
Csókás, Bence <[email protected]>
net: sfp: Always call sfp_sm_mod_remove() on remove
Ian Forbes <[email protected]>
drm/vmwgfx: 3D disabled should not effect STDU memory limits
José Expósito <[email protected]>
HID: logitech-dj: Fix memory leak in logi_dj_recv_switch_to_dj_mode()
Lu Baolu <[email protected]>
iommu: Return right value in iommu_sva_bind_device()
Kun(llfl) <[email protected]>
iommu/amd: Fix sysfs leak in iommu init
Vasant Hegde <[email protected]>
iommu/amd: Introduce pci segment structure
Nikita Zhandarovich <[email protected]>
HID: core: remove unnecessary WARN_ON() in implement()
Matthias Schiffer <[email protected]>
gpio: tqmx86: store IRQ trigger type and unmask status separately
Gregor Herburger <[email protected]>
gpio: tqmx86: fix typo in Kconfig label
Armin Wolf <[email protected]>
platform/x86: dell-smbios: Fix wrong token data in sysfs
ye xingchen <[email protected]>
platform/x86: dell-smbios-base: Use sysfs_emit()
Chen Hanxiao <[email protected]>
SUNRPC: return proper error from gss_wrap_req_priv
Samuel Holland <[email protected]>
clk: sifive: Do not register clkdevs for PRCI clocks
Dmitry Torokhov <[email protected]>
Input: try trimming too long modalias strings
Michael Ellerman <[email protected]>
powerpc/uaccess: Fix build errors seen with GCC 13/14
Breno Leitao <[email protected]>
scsi: mpt3sas: Avoid test/set_bit() operating in non-allocated memory
Kuangyi Chiang <[email protected]>
xhci: Apply broken streams quirk to Etron EJ188 xHCI host
Hector Martin <[email protected]>
xhci: Handle TD clearing for multiple streams case
Kuangyi Chiang <[email protected]>
xhci: Apply reset resume quirk to Etron EJ188 xHCI host
Mathias Nyman <[email protected]>
xhci: Set correct transferred length for cancelled bulk transfers
Greg Kroah-Hartman <[email protected]>
jfs: xattr: fix buffer overflow for invalid xattr
Tomas Winkler <[email protected]>
mei: me: release irq in mei_me_pci_resume error path
Kyle Tso <[email protected]>
usb: typec: tcpm: Ignore received Hard Reset in TOGGLING state
Alan Stern <[email protected]>
USB: class: cdc-wdm: Fix CPU lockup caused by excessive log messages
Ryusuke Konishi <[email protected]>
nilfs2: fix nilfs_empty_dir() misjudgment and long loop on I/O errors
Matthew Wilcox (Oracle) <[email protected]>
nilfs2: return the mapped address from nilfs_get_page()
Matthew Wilcox (Oracle) <[email protected]>
nilfs2: Remove check for PageError
Filipe Manana <[email protected]>
btrfs: fix leak of qgroup extent records after transaction abort
Dmitry Baryshkov <[email protected]>
wifi: ath10k: fix QCOM_RPROC_COMMON dependency
Dev Jain <[email protected]>
selftests/mm: compaction_test: fix bogus test success on Aarch64
Mark Brown <[email protected]>
selftests/mm: log a consistent test name for check_compaction
Muhammad Usama Anjum <[email protected]>
selftests/mm: conform test to TAP format output
Dev Jain <[email protected]>
selftests/mm: compaction_test: fix incorrect write of zero to nr_hugepages
Frank van der Linden <[email protected]>
mm/cma: drop incorrect alignment check in cma_init_reserved_mem
David Hildenbrand <[email protected]>
cma: factor out minimum alignment requirement
Hamish Martin <[email protected]>
i2c: acpi: Unbind mux adapters before delete
Russell King (Oracle) <[email protected]>
i2c: add fwnode APIs
Uwe Kleine-König <[email protected]>
mmc: davinci: Don't strip remove function when driver is builtin
Yangtao Li <[email protected]>
mmc: davinci_mmc: Convert to platform remove callback returning void
Zheng Yejian <[email protected]>
ftrace: Fix possible use-after-free issue in ftrace_location()
Peter Zijlstra <[email protected]>
x86/ibt,ftrace: Search for __fentry__ location
Hugo Villeneuve <[email protected]>
serial: sc16is7xx: fix bug in sc16is7xx_set_baud() when using prescaler
Hugo Villeneuve <[email protected]>
serial: sc16is7xx: replace hardcoded divisor value with BIT() macro
Johan Hovold <[email protected]>
Bluetooth: qca: fix info leak when fetching fw build id
Tim Jiang <[email protected]>
Bluetooth: qca: add support for QCA2066
Neil Armstrong <[email protected]>
Bluetooth: qca: use switch case for soc type behavior
Luca Weiss <[email protected]>
Bluetooth: btqca: Add WCN3988 support
Min-Hua Chen <[email protected]>
Bluetooth: btqca: use le32_to_cpu for ver.soc_id
Krzysztof Kozlowski <[email protected]>
Bluetooth: hci_qca: mark OF related data as maybe unused
Luiz Augusto von Dentz <[email protected]>
skbuff: introduce skb_pull_data
Thomas Weißschuh <[email protected]>
misc/pvpanic-pci: register attributes via pci_driver
Thomas Weißschuh <[email protected]>
misc/pvpanic: deduplicate common code
Andy Shevchenko <[email protected]>
pvpanic: Indentation fixes here and there
Andy Shevchenko <[email protected]>
pvpanic: Keep single style across modules
Hersen Wu <[email protected]>
drm/amd/display: Fix incorrect DSC instance for MST
Alexey Kodanev <[email protected]>
drm/amd/display: drop unnecessary NULL checks in debugfs
Jiapeng Chong <[email protected]>
drm/amd/display: Clean up some inconsistent indenting
George Shen <[email protected]>
drm/amd/display: Handle Y carry-over in VCP X.Y calculation
Hans de Goede <[email protected]>
iio: accel: mxc4005: Reset chip on probe() and resume()
Wesley Cheng <[email protected]>
usb: gadget: f_fs: Fix race between aio_cancel() and AIO request complete
John Keeping <[email protected]>
usb: gadget: f_fs: use io_data->status consistently
Eric Dumazet <[email protected]>
ipv6: fix possible race in __fib6_drop_pcpu_from()
Kuniyuki Iwashima <[email protected]>
af_unix: Annotate data-race of sk->sk_shutdown in sk_diag_fill().
Kuniyuki Iwashima <[email protected]>
af_unix: Use skb_queue_len_lockless() in sk_diag_show_rqlen().
Kuniyuki Iwashima <[email protected]>
af_unix: Use skb_queue_empty_lockless() in unix_release_sock().
Eric Dumazet <[email protected]>
af_unix: annotate lockless accesses to sk->sk_err
Kuniyuki Iwashima <[email protected]>
af_unix: Use unix_recvq_full_lockless() in unix_stream_connect().
Kuniyuki Iwashima <[email protected]>
af_unix: Annotate data-race of net->unx.sysctl_max_dgram_qlen.
Kuniyuki Iwashima <[email protected]>
af_unix: Annotate data-races around sk->sk_state in UNIX_DIAG.
Kuniyuki Iwashima <[email protected]>
af_unix: Annotate data-race of sk->sk_state in unix_stream_read_skb().
Kuniyuki Iwashima <[email protected]>
af_unix: Annotate data-races around sk->sk_state in sendmsg() and recvmsg().
Kuniyuki Iwashima <[email protected]>
af_unix: Annotate data-race of sk->sk_state in unix_stream_connect().
Eric Dumazet <[email protected]>
net: drop nopreempt requirement on sock_prot_inuse_add()
Eric Dumazet <[email protected]>
net: inline sock_prot_inuse_add()
Kuniyuki Iwashima <[email protected]>
af_unix: Annotate data-races around sk->sk_state in unix_write_space() and poll().
Kuniyuki Iwashima <[email protected]>
af_unix: Annotate data-race of sk->sk_state in unix_inq_len().
Kuniyuki Iwashima <[email protected]>
af_unix: Annodate data-races around sk->sk_state for writers.
Kuniyuki Iwashima <[email protected]>
af_unix: Set sk->sk_state under unix_state_lock() for truly disconencted peer.
Karol Kolacinski <[email protected]>
ptp: Fix error message on failed pin verification
Eric Dumazet <[email protected]>
net/sched: taprio: always validate TCA_TAPRIO_ATTR_PRIOMAP
Jason Xing <[email protected]>
tcp: count CLOSE-WAIT sockets for TCP_MIB_CURRESTAB
Daniel Borkmann <[email protected]>
vxlan: Fix regression when dropping packets due to invalid src addresses
Hangyu Hua <[email protected]>
net: sched: sch_multiq: fix possible OOB write in multiq_tune()
Subbaraya Sundeep <[email protected]>
octeontx2-af: Always allocate PF entries from low prioriy zone
Jiri Olsa <[email protected]>
bpf: Set run context for rawtp test_run callback
Eric Dumazet <[email protected]>
ipv6: sr: block BH in seg6_output_core() and seg6_input_core()
DelphineCCChiu <[email protected]>
net/ncsi: Fix the multi thread manner of NCSI driver
Peter Delevoryas <[email protected]>
net/ncsi: Simplify Kconfig/dts control flow
Lingbo Kong <[email protected]>
wifi: mac80211: correctly parse Spatial Reuse Parameter Set element
Emmanuel Grumbach <[email protected]>
wifi: iwlwifi: mvm: don't read past the mfuart notifcation
Miri Korenblit <[email protected]>
wifi: iwlwifi: mvm: check n_ssids before accessing the ssids
Shahar S Matityahu <[email protected]>
wifi: iwlwifi: dbg_ini: move iwl_dbg_tlv_free outside of debugfs ifdef
Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: revert gen2 TX A-MPDU size to 64
Lin Ma <[email protected]>
wifi: cfg80211: pmsr: use correct nla_get_uX functions
Remi Pommarel <[email protected]>
wifi: cfg80211: Lock wiphy in cfg80211_get_station
Remi Pommarel <[email protected]>
wifi: mac80211: Fix deadlock in ieee80211_sta_ps_deliver_wakeup()
Nicolas Escande <[email protected]>
wifi: mac80211: mesh: Fix leak of mesh_preq_queue objects
-------------
Diffstat:
.../bindings/i2c/google,cros-ec-i2c-tunnel.yaml | 2 +- Makefile | 9 +- arch/arm/boot/dts/exynos4210-smdkv310.dts | 2 +- arch/arm/boot/dts/exynos4412-origen.dts | 2 +- arch/arm/boot/dts/exynos4412-smdk4412.dts | 2 +- arch/arm/boot/dts/rk3066a.dtsi | 1 + arch/arm64/boot/dts/freescale/imx8qm-mek.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts | 4 +- arch/arm64/boot/dts/rockchip/rk3368.dtsi | 3 + arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/include/asm/unistd32.h | 2 +- arch/arm64/kvm/arm.c | 6 +- arch/arm64/kvm/vgic/vgic-v3.c | 2 +- arch/arm64/kvm/vgic/vgic-v4.c | 8 +- arch/csky/include/uapi/asm/unistd.h | 1 + arch/hexagon/include/asm/syscalls.h | 6 + arch/hexagon/include/uapi/asm/unistd.h | 1 + arch/hexagon/kernel/syscalltab.c | 7 + arch/mips/bmips/setup.c | 3 +- arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +- arch/mips/kernel/syscalls/syscall_o32.tbl | 2 +- arch/mips/pci/ops-rc32434.c | 4 +- arch/mips/pci/pcie-octeon.c | 6 + arch/parisc/Kconfig | 1 + arch/parisc/kernel/sys_parisc32.c | 9 - arch/parisc/kernel/syscalls/syscall.tbl | 6 +- arch/powerpc/include/asm/fadump-internal.h | 5 - arch/powerpc/include/asm/hvcall.h | 8 +- arch/powerpc/include/asm/io.h | 24 +- arch/powerpc/include/asm/uaccess.h | 15 +- arch/powerpc/kernel/fadump.c | 2 +- arch/powerpc/kernel/syscalls/syscall.tbl | 2 +- arch/riscv/mm/init.c | 58 ++--- arch/s390/kernel/syscalls/syscall.tbl | 2 +- arch/sh/kernel/sys_sh32.c | 11 + arch/sh/kernel/syscalls/syscall.tbl | 3 +- arch/sparc/kernel/sys32.S | 221 ----------------- arch/sparc/kernel/syscalls/syscall.tbl | 8 +- arch/x86/entry/syscalls/syscall_32.tbl | 2 +- arch/x86/include/asm/cpu_device_id.h | 98 ++++++++ arch/x86/include/asm/efi.h | 11 + arch/x86/kernel/amd_nb.c | 9 +- arch/x86/kernel/cpu/match.c | 4 +- arch/x86/kernel/fpu/core.c | 4 +- arch/x86/kernel/kprobes/core.c | 11 +- arch/x86/kernel/time.c | 20 +- arch/x86/kvm/x86.c | 9 +- arch/x86/mm/numa.c | 6 +- arch/x86/platform/efi/Makefile | 3 +- arch/x86/platform/efi/efi.c | 8 +- arch/x86/platform/efi/memmap.c | 249 +++++++++++++++++++ block/ioctl.c | 2 +- crypto/ecdh.c | 2 + drivers/acpi/acpica/exregion.c | 23 +- drivers/acpi/video_detect.c | 8 + drivers/acpi/x86/utils.c | 23 +- drivers/ata/ahci.c | 17 +- drivers/ata/libata-core.c | 8 +- drivers/base/core.c | 3 + drivers/block/null_blk/zoned.c | 2 +- drivers/bluetooth/ath3k.c | 25 +- drivers/bluetooth/btqca.c | 186 +++++++++++--- drivers/bluetooth/btqca.h | 36 +-- drivers/bluetooth/hci_qca.c | 266 ++++++++++++++++----- drivers/clk/sifive/sifive-prci.c | 8 - drivers/crypto/hisilicon/sec2/sec_crypto.c | 4 +- drivers/dma/dma-axi-dmac.c | 2 +- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 +- drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 1 + drivers/dma/idxd/irq.c | 4 +- drivers/dma/ioat/init.c | 73 +++--- drivers/dma/ioat/registers.h | 7 - drivers/firmware/efi/fdtparams.c | 4 + drivers/firmware/efi/memmap.c | 239 +----------------- drivers/gpio/Kconfig | 2 +- drivers/gpio/gpio-davinci.c | 5 + drivers/gpio/gpio-tqmx86.c | 46 ++-- drivers/gpio/gpiolib-cdev.c | 16 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 18 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 144 +++++------ .../amd/display/dc/dcn10/dcn10_stream_encoder.c | 6 + drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c | 2 + .../drm/arm/display/komeda/komeda_pipeline_state.c | 2 +- drivers/gpu/drm/bridge/panel.c | 7 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 7 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 7 +- drivers/gpu/drm/i915/display/intel_dp.c | 4 + drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 16 +- drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c | 1 + drivers/gpu/drm/lima/lima_bcast.c | 12 + drivers/gpu/drm/lima/lima_bcast.h | 3 + drivers/gpu/drm/lima/lima_gp.c | 8 + drivers/gpu/drm/lima/lima_pp.c | 18 ++ drivers/gpu/drm/lima/lima_sched.c | 7 + drivers/gpu/drm/lima/lima_sched.h | 1 + drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 6 + drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 6 +- drivers/gpu/drm/panel/panel-simple.c | 1 + drivers/gpu/drm/radeon/radeon.h | 1 - drivers/gpu/drm/radeon/radeon_display.c | 8 +- drivers/gpu/drm/radeon/sumo_dpm.c | 2 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 - drivers/greybus/interface.c | 1 + drivers/hid/hid-core.c | 1 - drivers/hid/hid-ids.h | 1 + drivers/hid/hid-logitech-dj.c | 4 +- drivers/hid/hid-multitouch.c | 6 + drivers/hwtracing/intel_th/pci.c | 25 ++ drivers/i2c/busses/i2c-at91-slave.c | 3 +- drivers/i2c/busses/i2c-designware-slave.c | 2 +- drivers/i2c/busses/i2c-ocores.c | 2 +- drivers/i2c/i2c-core-acpi.c | 30 +-- drivers/i2c/i2c-core-base.c | 98 ++++++++ drivers/i2c/i2c-core-of.c | 66 ----- drivers/i2c/i2c-slave-testunit.c | 5 +- drivers/iio/accel/Kconfig | 2 + drivers/iio/accel/mxc4005.c | 68 ++++++ drivers/iio/adc/ad7266.c | 2 + drivers/iio/adc/ad9467.c | 4 +- drivers/iio/chemical/bme680.h | 2 + drivers/iio/chemical/bme680_core.c | 62 ++++- drivers/iio/dac/ad5592r-base.c | 2 +- drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 4 - drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c | 4 - drivers/infiniband/core/restrack.c | 51 +--- drivers/infiniband/hw/mlx5/srq.c | 13 +- drivers/input/input.c | 105 ++++++-- drivers/input/touchscreen/ili210x.c | 4 +- drivers/iommu/amd/amd_iommu_types.h | 24 +- drivers/iommu/amd/init.c | 55 ++++- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- drivers/md/bcache/bset.c | 44 ++-- drivers/md/bcache/bset.h | 28 ++- drivers/md/bcache/btree.c | 40 ++-- drivers/md/bcache/super.c | 5 +- drivers/md/bcache/sysfs.c | 2 +- drivers/md/bcache/writeback.c | 10 +- drivers/media/dvb-core/dvbdev.c | 2 +- drivers/misc/mei/pci-me.c | 4 +- drivers/misc/pvpanic/pvpanic-mmio.c | 59 +---- drivers/misc/pvpanic/pvpanic-pci.c | 80 +------ drivers/misc/pvpanic/pvpanic.c | 90 ++++++- drivers/misc/pvpanic/pvpanic.h | 10 +- drivers/misc/vmw_vmci/vmci_event.c | 6 +- drivers/mmc/host/davinci_mmc.c | 6 +- drivers/mmc/host/sdhci-pci-core.c | 11 +- drivers/mmc/host/sdhci.c | 25 +- drivers/mtd/parsers/redboot.c | 2 +- drivers/net/dsa/microchip/ksz9477.c | 7 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 +- drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c | 11 +- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 14 +- drivers/net/ethernet/google/gve/gve.h | 13 +- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 76 +++--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 + drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 2 + .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 21 +- drivers/net/ethernet/ibm/ibmvnic.c | 6 + .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 33 ++- .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 5 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 4 +- drivers/net/ethernet/qualcomm/qca_debug.c | 6 +- drivers/net/ethernet/qualcomm/qca_spi.c | 16 +- drivers/net/ethernet/qualcomm/qca_spi.h | 3 +- .../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 6 +- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 55 ++--- drivers/net/phy/micrel.c | 1 + drivers/net/phy/sfp.c | 3 +- drivers/net/usb/ax88179_178a.c | 6 +- drivers/net/usb/rtl8150.c | 3 +- drivers/net/virtio_net.c | 12 +- drivers/net/vxlan/vxlan_core.c | 4 + drivers/net/wireless/ath/ath.h | 6 +- drivers/net/wireless/ath/ath10k/Kconfig | 1 + drivers/net/wireless/ath/ath9k/main.c | 3 +- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 10 - drivers/net/wireless/intel/iwlwifi/mvm/rs.h | 9 +- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 4 +- .../net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 19 +- drivers/net/wireless/realtek/rtlwifi/wifi.h | 1 - drivers/of/of_reserved_mem.c | 9 +- drivers/pci/controller/pcie-rockchip-ep.c | 6 +- drivers/pci/pci.c | 12 + drivers/pinctrl/core.c | 2 +- drivers/pinctrl/pinctrl-rockchip.c | 68 +++++- drivers/pinctrl/pinctrl-rockchip.h | 1 + drivers/platform/x86/dell/dell-smbios-base.c | 91 +++---- drivers/power/supply/cros_usbpd-charger.c | 11 +- drivers/ptp/ptp_chardev.c | 3 +- drivers/ptp/ptp_sysfs.c | 3 +- drivers/pwm/pwm-stm32.c | 3 + drivers/regulator/bd71815-regulator.c | 2 +- drivers/regulator/core.c | 1 + drivers/scsi/mpi3mr/mpi3mr.h | 1 + drivers/scsi/mpi3mr/mpi3mr_os.c | 67 ++++++ drivers/scsi/mpt3sas/mpt3sas_base.c | 19 ++ drivers/scsi/mpt3sas/mpt3sas_base.h | 3 - drivers/scsi/mpt3sas/mpt3sas_ctl.c | 4 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 25 -- drivers/scsi/qedi/qedi_debugfs.c | 12 +- drivers/scsi/scsi_transport_sas.c | 29 +++ drivers/soc/ti/ti_sci_pm_domains.c | 20 +- drivers/soc/ti/wkup_m3_ipc.c | 7 +- drivers/spmi/hisi-spmi-controller.c | 1 - drivers/tty/serial/8250/8250_exar.c | 42 ++++ drivers/tty/serial/8250/8250_omap.c | 25 +- drivers/tty/serial/8250/8250_pxa.c | 1 + drivers/tty/serial/imx.c | 11 +- drivers/tty/serial/mcf.c | 2 +- drivers/tty/serial/sc16is7xx.c | 25 +- drivers/tty/serial/stm32-usart.c | 208 ++++++++++++---- drivers/tty/serial/stm32-usart.h | 12 +- drivers/usb/atm/cxacru.c | 14 ++ drivers/usb/class/cdc-wdm.c | 4 +- drivers/usb/dwc3/core.c | 6 - drivers/usb/gadget/function/f_fs.c | 9 +- drivers/usb/gadget/function/f_printer.c | 40 +++- drivers/usb/host/xhci-pci.c | 7 + drivers/usb/host/xhci-ring.c | 59 +++-- drivers/usb/host/xhci.h | 1 + drivers/usb/misc/uss720.c | 22 +- drivers/usb/musb/da8xx.c | 8 +- drivers/usb/storage/alauda.c | 9 +- drivers/usb/typec/tcpm/tcpm.c | 1 + drivers/vdpa/vdpa_user/vduse_dev.c | 14 +- fs/btrfs/block-group.c | 11 +- fs/btrfs/disk-io.c | 10 +- fs/cifs/cifsfs.c | 2 +- fs/cifs/smb2transport.c | 2 +- fs/f2fs/super.c | 2 - fs/jfs/xattr.c | 4 +- fs/ksmbd/mgmt/share_config.c | 6 +- fs/nfs/read.c | 4 - fs/nfsd/nfsfh.c | 4 +- fs/nilfs2/dir.c | 59 +++-- fs/nilfs2/segment.c | 3 + fs/ocfs2/aops.c | 5 + fs/ocfs2/file.c | 2 + fs/ocfs2/journal.c | 17 ++ fs/ocfs2/journal.h | 2 + fs/ocfs2/namei.c | 2 +- fs/ocfs2/ocfs2_trace.h | 2 + fs/open.c | 4 +- fs/proc/vmcore.c | 2 + fs/udf/udftime.c | 11 +- include/kvm/arm_vgic.h | 2 +- include/linux/cma.h | 9 + include/linux/compat.h | 2 +- include/linux/efi.h | 10 +- include/linux/filter.h | 5 +- include/linux/i2c.h | 26 +- include/linux/iommu.h | 2 +- include/linux/kcov.h | 2 + include/linux/mdio.h | 12 + include/linux/mod_devicetable.h | 2 + include/linux/nvme.h | 4 +- include/linux/pci.h | 9 + include/linux/skbuff.h | 2 + include/linux/syscalls.h | 8 +- include/net/bluetooth/hci_core.h | 36 ++- include/net/inet_connection_sock.h | 10 +- include/net/netfilter/nf_tables.h | 5 + include/net/request_sock.h | 2 + include/net/sock.h | 16 +- include/net/tcp.h | 2 +- include/scsi/scsi_transport_sas.h | 2 + include/trace/events/qdisc.h | 2 +- include/uapi/asm-generic/hugetlb_encode.h | 26 +- include/uapi/asm-generic/unistd.h | 2 +- kernel/bpf/core.c | 4 +- kernel/bpf/trampoline.c | 20 +- kernel/bpf/verifier.c | 8 +- kernel/cpu.c | 8 +- kernel/dma/contiguous.c | 4 +- kernel/events/core.c | 13 + kernel/gcov/gcc_4_7.c | 4 +- kernel/gen_kheaders.sh | 9 +- kernel/kcov.c | 1 + kernel/kprobes.c | 8 +- kernel/padata.c | 8 +- kernel/pid_namespace.c | 1 + kernel/rcu/rcutorture.c | 16 +- kernel/sys_ni.c | 2 +- kernel/time/tick-common.c | 42 ++-- kernel/trace/Kconfig | 4 +- kernel/trace/ftrace.c | 71 ++++-- kernel/trace/preemptirq_delay_test.c | 1 + mm/cma.c | 20 +- mm/memory-failure.c | 7 + net/batman-adv/originator.c | 29 +++ net/bluetooth/l2cap_core.c | 8 +- net/bpf/test_run.c | 6 + net/can/j1939/main.c | 6 +- net/can/j1939/transport.c | 21 +- net/core/drop_monitor.c | 20 +- net/core/filter.c | 3 + net/core/net_namespace.c | 9 +- net/core/netpoll.c | 2 +- net/core/skbuff.c | 24 ++ net/core/sock.c | 20 +- net/core/sock_map.c | 16 +- net/core/xdp.c | 4 +- net/dccp/ipv4.c | 7 +- net/dccp/ipv6.c | 7 +- net/ieee802154/socket.c | 4 +- net/ipv4/af_inet.c | 23 +- net/ipv4/cipso_ipv4.c | 12 +- net/ipv4/inet_connection_sock.c | 22 +- net/ipv4/raw.c | 2 +- net/ipv4/tcp.c | 16 +- net/ipv4/tcp_input.c | 50 +++- net/ipv4/tcp_minisocks.c | 5 +- net/ipv6/af_inet6.c | 24 +- net/ipv6/ip6_fib.c | 6 +- net/ipv6/ipv6_sockglue.c | 17 +- net/ipv6/route.c | 9 +- net/ipv6/seg6_iptunnel.c | 14 +- net/ipv6/seg6_local.c | 8 +- net/ipv6/tcp_ipv6.c | 9 +- net/ipv6/xfrm6_policy.c | 8 +- net/iucv/iucv.c | 26 +- net/mac80211/he.c | 10 +- net/mac80211/mesh_pathtbl.c | 13 + net/mac80211/sta_info.c | 4 +- net/mptcp/pm_netlink.c | 21 +- net/mptcp/protocol.c | 1 + net/ncsi/internal.h | 2 + net/ncsi/ncsi-manage.c | 95 ++++---- net/ncsi/ncsi-rsp.c | 4 +- net/netfilter/ipset/ip_set_core.c | 104 ++++---- net/netfilter/ipset/ip_set_list_set.c | 30 ++- net/netfilter/nf_tables_api.c | 8 +- net/netfilter/nft_lookup.c | 3 +- net/netlink/af_netlink.c | 4 - net/netrom/nr_timer.c | 3 +- net/packet/af_packet.c | 30 ++- net/sched/act_api.c | 66 +++-- net/sched/act_ct.c | 21 +- net/sched/sch_multiq.c | 2 +- net/sched/sch_taprio.c | 15 +- net/sctp/socket.c | 5 - net/smc/af_smc.c | 2 +- net/sunrpc/auth_gss/auth_gss.c | 4 +- net/tipc/node.c | 1 + net/unix/af_unix.c | 113 +++++---- net/unix/diag.c | 12 +- net/wireless/pmsr.c | 8 +- net/wireless/util.c | 7 +- net/xdp/xsk.c | 4 - scripts/Makefile.dtbinst | 2 +- sound/pci/hda/patch_realtek.c | 1 + sound/soc/fsl/fsl-asoc-card.c | 3 +- sound/synth/emux/soundfont.c | 17 +- tools/include/asm-generic/hugetlb_encode.h | 26 +- tools/perf/Documentation/perf-script.txt | 7 +- tools/perf/builtin-script.c | 24 +- tools/testing/selftests/arm64/tags/tags_test.c | 4 + .../selftests/bpf/prog_tests/btf_map_in_map.c | 26 +- tools/testing/selftests/bpf/test_tc_tunnel.sh | 13 +- .../ftrace/test.d/kprobe/kprobe_eventname.tc | 3 +- tools/testing/selftests/net/mptcp/mptcp_join.sh | 5 +- tools/testing/selftests/vm/compaction_test.c | 108 +++++---- 364 files changed, 3886 insertions(+), 2550 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 9/356 wifi: mac80211: correctly parse Spatial Reuse Parameter Set element
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lingbo Kong <[email protected]>
[ Upstream commit a26d8dc5227f449a54518a8b40733a54c6600a8b ]
Currently, the way of parsing Spatial Reuse Parameter Set element is incorrect and some members of struct ieee80211_he_obss_pd are not assigned.
To address this issue, it must be parsed in the order of the elements of Spatial Reuse Parameter Set defined in the IEEE Std 802.11ax specification.
The diagram of the Spatial Reuse Parameter Set element (IEEE Std 802.11ax -2021-9.4.2.252).
-------------------------------------------------------------------------
| | | | |Non-SRG| SRG | SRG | SRG | SRG | |Element|Length| Element | SR |OBSS PD|OBSS PD|OBSS PD| BSS |Partial| | ID | | ID |Control| Max | Min | Max |Color | BSSID | | | |Extension| | Offset| Offset|Offset |Bitmap|Bitmap |
-------------------------------------------------------------------------
--- net/mac80211/he.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/mac80211/he.c +8 -2
@@ -223,15 +223,21 @@ ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif,if (!he_spr_ie_elem)return ; + + he_obss_pd->sr_ctrl = he_spr_ie_elem->he_sr_control; data = he_spr_ie_elem->optional;if (he_spr_ie_elem->he_sr_control &IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT ) - data++; + he_obss_pd->non_srg_max_offset = *data++; +if (he_spr_ie_elem->he_sr_control &IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT ) { - he_obss_pd->max_offset = *data++; he_obss_pd->min_offset = *data++; + he_obss_pd->max_offset = *data++; +memcpy (he_obss_pd->bss_color_bitmap, data,8 ); + data +=8 ; +memcpy (he_obss_pd->partial_bssid_bitmap, data,8 ); he_obss_pd->enable = true; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 18/356 net/sched: taprio: always validate TCA_TAPRIO_ATTR_PRIOMAP
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit f921a58ae20852d188f70842431ce6519c4fdc36 ]
If one TCA_TAPRIO_ATTR_PRIOMAP attribute has been provided, taprio_parse_mqprio_opt() must validate it, or userspace can inject arbitrary data to the kernel, the second time taprio_change() is called.
First call (with valid attributes) sets dev->num_tc to a non zero value.
Second call (with arbitrary mqprio attributes)
returns early from taprio_parse_mqprio_opt()
and bad things can happen.
--- net/sched/sch_taprio.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
net/sched/sch_taprio.c +6 -9
@@ -947,16 +947,13 @@ static int taprio_parse_mqprio_opt(struct net_device *dev, {int i, j; -if (!qopt && !dev->num_tc) { -NL_SET_ERR_MSG (extack,"'mqprio' configuration is necessary" ); -return -EINVAL ; - } - -/* If num_tc is already set, it means that the user already -* configured the mqprio part -*/ -if (dev->num_tc) +if (!qopt) { +if (!dev->num_tc) { +NL_SET_ERR_MSG (extack,"'mqprio' configuration is necessary" ); +return -EINVAL ; + }return 0 ; + }/* Verify num_tc is not out of max range */ if (qopt->num_tc >TC_MAX_QUEUE ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 19/356 ptp: Fix error message on failed pin verification
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Kolacinski <[email protected]>
[ Upstream commit 323a359f9b077f382f4483023d096a4d316fd135 ]
On failed verification of PTP clock pin, error message prints channel number instead of pin index after "pin", which is incorrect.
Fix error message by adding channel number to the message and printing pin number instead of channel number.
--- drivers/ptp/ptp_chardev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ptp/ptp_chardev.c +2 -1
@@ -84,7 +84,8 @@ int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin, }if (info->verify (info, pin, func, chan)) { -pr_err ("driver cannot use function %u on pin %u\n" , func, chan); +pr_err ("driver cannot use function %u and channel %u on pin %u\n" , + func, chan, pin);return -EOPNOTSUPP ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 20/356 af_unix: Set sk->sk_state under unix_state_lock() for truly disconencted peer.
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 26bfb8b57063f52b867f9b6c8d1742fcb5bd656c ]
When a SOCK_DGRAM socket connect()s to another socket, the both sockets' sk->sk_state are changed to TCP_ESTABLISHED so that we can register them to BPF SOCKMAP.
When the socket disconnects from the peer by connect(AF_UNSPEC), the state is set back to TCP_CLOSE.
Then, the peer's state is also set to TCP_CLOSE, but the update is done locklessly and unconditionally.
Let's say socket A connect()ed to B, B connect()ed to C, and A disconnects from B.
After the first two connect()s, all three sockets' sk->sk_state are TCP_ESTABLISHED:
$ ss -xa Netid State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess u_dgr ESTAB 0 0 @A 641 * 642 u_dgr ESTAB 0 0 @B 642 * 643 u_dgr ESTAB 0 0 @C 643 * 0
And after the disconnect, B's state is TCP_CLOSE even though it's still connected to C and C's state is TCP_ESTABLISHED.
$ ss -xa Netid State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess u_dgr UNCONN 0 0 @A 641 * 0 u_dgr UNCONN 0 0 @B 642 * 643 u_dgr ESTAB 0 0 @C 643 * 0
In this case, we cannot register B to SOCKMAP.
So, when a socket disconnects from the peer, we should not set TCP_CLOSE to the peer if the peer is connected to yet another socket, and this must be done under unix_state_lock().
Note that we use WRITE_ONCE() for sk->sk_state as there are many lockless readers. These data-races will be fixed in the following patches.
--- net/unix/af_unix.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/unix/af_unix.c +8 -2
@@ -495,7 +495,6 @@ static void unix_dgram_disconnected(struct sock *sk, struct sock *other)sk_error_report (other); } } - other->sk_state =TCP_CLOSE ; }static void unix_sock_destructor (struct sock *sk)
@@ -1277,8 +1276,15 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,unix_state_double_unlock (sk, other); -if (other != old_peer) +if (other != old_peer) {unix_dgram_disconnected (sk, old_peer); + +unix_state_lock (old_peer); +if (!unix_peer (old_peer)) +WRITE_ONCE (old_peer->sk_state,TCP_CLOSE ); +unix_state_unlock (old_peer); + } +sock_put (old_peer); }else {unix_peer (sk) = other;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 21/356 af_unix: Annodate data-races around sk->sk_state for writers.
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 942238f9735a4a4ebf8274b218d9a910158941d1 ]
sk->sk_state is changed under unix_state_lock(), but it's read locklessly in many places.
This patch adds WRITE_ONCE() on the writer side.
We will add READ_ONCE() to the lockless readers in the following patches.
--- net/unix/af_unix.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
net/unix/af_unix.c +8 -6
@@ -542,7 +542,7 @@ static void unix_release_sock(struct sock *sk, int embrion) u->path.dentry =NULL ; u->path.mnt =NULL ; state = sk->sk_state; - sk->sk_state =TCP_CLOSE ; +WRITE_ONCE (sk->sk_state,TCP_CLOSE ); skpair =unix_peer (sk);unix_peer (sk) =NULL ;
@@ -664,7 +664,8 @@ static int unix_listen(struct socket *sock, int backlog)if (backlog > sk->sk_max_ack_backlog)wake_up_interruptible_all (&u->peer_wait); sk->sk_max_ack_backlog = backlog; - sk->sk_state =TCP_LISTEN ; +WRITE_ONCE (sk->sk_state,TCP_LISTEN ); +/* set credentials so connect can copy them */ init_peercred (sk); err =0 ;
@@ -1254,7 +1255,8 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,if (err) goto out_unlock; - sk->sk_state = other->sk_state =TCP_ESTABLISHED ; +WRITE_ONCE (sk->sk_state,TCP_ESTABLISHED ); +WRITE_ONCE (other->sk_state,TCP_ESTABLISHED ); }else {/* * 1003.1g breaking connected state with AF_UNSPEC
@@ -1271,7 +1273,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,unix_peer (sk) = other;if (!other) - sk->sk_state =TCP_CLOSE ; +WRITE_ONCE (sk->sk_state,TCP_CLOSE );unix_dgram_peer_wake_disconnect_wakeup (sk, old_peer);unix_state_double_unlock (sk, other);
@@ -1484,7 +1486,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,copy_peercred (sk, other); sock->state =SS_CONNECTED ; - sk->sk_state =TCP_ESTABLISHED ; +WRITE_ONCE (sk->sk_state,TCP_ESTABLISHED );sock_hold (newsk);smp_mb__after_atomic ();/* sock_hold() does an atomic_inc() */
@@ -1880,7 +1882,7 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,unix_peer (sk) =NULL ;unix_dgram_peer_wake_disconnect_wakeup (sk, other); - sk->sk_state =TCP_CLOSE ; +WRITE_ONCE (sk->sk_state,TCP_CLOSE );unix_state_unlock (sk);unix_dgram_disconnected (sk, other);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 22/356 af_unix: Annotate data-race of sk->sk_state in unix_inq_len().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 3a0f38eb285c8c2eead4b3230c7ac2983707599d ]
ioctl(SIOCINQ) calls unix_inq_len() that checks sk->sk_state first and returns -EINVAL if it's TCP_LISTEN.
Then, for SOCK_STREAM sockets, unix_inq_len() returns the number of bytes in recvq.
However, unix_inq_len() does not hold unix_state_lock(), and the concurrent listen() might change the state after checking sk->sk_state.
If the race occurs, 0 is returned for the listener, instead of -EINVAL, because the length of skb with embryo is 0.
We could hold unix_state_lock() in unix_inq_len(), but it's overkill given the result is true for pre-listen() TCP_CLOSE state.
So, let's use READ_ONCE() for sk->sk_state in unix_inq_len().
--- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.c +1 -1
@@ -2957,7 +2957,7 @@ long unix_inq_len(struct sock *sk)struct sk_buff *skb;long amount =0 ; -if (sk->sk_state ==TCP_LISTEN ) +if (READ_ONCE (sk->sk_state) ==TCP_LISTEN )return -EINVAL ;spin_lock (&sk->sk_receive_queue.lock);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 23/356 af_unix: Annotate data-races around sk->sk_state in unix_write_space() and poll().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit eb0718fb3e97ad0d6f4529b810103451c90adf94 ]
unix_poll() and unix_dgram_poll() read sk->sk_state locklessly and calls unix_writable() which also reads sk->sk_state without holding unix_state_lock().
Let's use READ_ONCE() in unix_poll() and unix_dgram_poll() and pass it to unix_writable().
While at it, we remove TCP_SYN_SENT check in unix_dgram_poll() as that state does not exist for AF_UNIX socket since the code was added.
--- net/unix/af_unix.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
net/unix/af_unix.c +12 -13
@@ -455,9 +455,9 @@ static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other)return 0 ; } -static int unix_writable (const struct sock *sk) +static int unix_writable (const struct sock *sk,unsigned char state) { -return sk->sk_state !=TCP_LISTEN && +return state !=TCP_LISTEN && (refcount_read (&sk->sk_wmem_alloc) <<2 ) <= sk->sk_sndbuf; }
@@ -466,7 +466,7 @@ static void unix_write_space(struct sock *sk)struct socket_wq *wq;rcu_read_lock (); -if (unix_writable (sk)) { +if (unix_writable (sk,READ_ONCE (sk->sk_state))) { wq =rcu_dereference (sk->sk_wq);if (skwq_has_sleeper (wq)) wake_up_interruptible_sync_poll(&wq->wait,
@@ -3069,12 +3069,14 @@ static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned lonstatic __poll_t unix_poll (struct file *file,struct socket *sock,poll_table *wait) {struct sock *sk = sock->sk; +unsigned char state;__poll_t mask;u8 shutdown;sock_poll_wait (file, sock, wait); mask =0 ; shutdown =READ_ONCE (sk->sk_shutdown); + state =READ_ONCE (sk->sk_state);/* exceptional events? */ if (sk->sk_err)
@@ -3096,14 +3098,14 @@ static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wa/* Connection-based need to check for termination and startup */ if ((sk->sk_type ==SOCK_STREAM || sk->sk_type ==SOCK_SEQPACKET ) && - sk->sk_state ==TCP_CLOSE ) + state ==TCP_CLOSE ) mask |=EPOLLHUP ;/* * we set writable also when the other side has shut down the * connection. This prevents stuck sockets. */ -if (unix_writable (sk)) +if (unix_writable (sk, state)) mask |=EPOLLOUT |EPOLLWRNORM |EPOLLWRBAND ;return mask;
@@ -3114,12 +3116,14 @@ static __poll_t unix_dgram_poll(struct file *file, struct socket *sock, {struct sock *sk = sock->sk, *other;unsigned int writable; +unsigned char state;__poll_t mask;u8 shutdown;sock_poll_wait (file, sock, wait); mask =0 ; shutdown =READ_ONCE (sk->sk_shutdown); + state =READ_ONCE (sk->sk_state);/* exceptional events? */ if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue))
@@ -3138,19 +3142,14 @@ static __poll_t unix_dgram_poll(struct file *file, struct socket *sock, mask |=EPOLLIN |EPOLLRDNORM ;/* Connection-based need to check for termination and startup */ -if (sk->sk_type ==SOCK_SEQPACKET ) { -if (sk->sk_state ==TCP_CLOSE ) - mask |=EPOLLHUP ; -/* connection hasn't started yet? */ -if (sk->sk_state ==TCP_SYN_SENT ) -return mask; - } +if (sk->sk_type ==SOCK_SEQPACKET && state ==TCP_CLOSE ) + mask |=EPOLLHUP ;/* No write status requested, avoid expensive OUT tests. */ if (!(poll_requested_events (wait) & (EPOLLWRBAND |EPOLLWRNORM |EPOLLOUT )))return mask; - writable =unix_writable (sk); + writable =unix_writable (sk, state);if (writable) {unix_state_lock (sk);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 24/356 net: inline sock_prot_inuse_add()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 2a12ae5d433df3d3c3f1a930799ec09cb2b8058f ]
sock_prot_inuse_add() is very small, we can inline it.
Stable-dep-of: a9bf9c7dc6a5 ("af_unix: Annotate data-race of sk->sk_state in unix_stream_connect().")
--- include/net/sock.h | 14 +++++++++++--- net/core/sock.c | 11 ----------- 2 files changed, 11 insertions(+), 14 deletions(-)
include/net/sock.h +11 -3
@@ -1460,13 +1460,21 @@ proto_memory_pressure(struct proto *prot)#ifdef CONFIG_PROC_FS +#define PROTO_INUSE_NR 64/* should be enough for the first time */ +struct prot_inuse { +int val[PROTO_INUSE_NR ]; +};/* Called with local bh disabled */ -void sock_prot_inuse_add (struct net *net,struct proto *prot,int inc); +static inline void sock_prot_inuse_add (const struct net *net, +const struct proto *prot,int val) +{ +__this_cpu_add (net->core.prot_inuse->val[prot->inuse_idx], val); +}int sock_prot_inuse_get (struct net *net,struct proto *proto);int sock_inuse_get (struct net *net);#else -static inline void sock_prot_inuse_add (struct net *net,struct proto *prot, -int inc) +static inline void sock_prot_inuse_add (const struct net *net, +const struct proto *prot,int val) { }#endif
net/core/sock.c +0 -11
@@ -3497,19 +3497,8 @@ void sk_get_meminfo(const struct sock *sk, u32 *mem) }#ifdef CONFIG_PROC_FS -#define PROTO_INUSE_NR 64/* should be enough for the first time */ -struct prot_inuse { -int val[PROTO_INUSE_NR ]; -}; - static DECLARE_BITMAP(proto_inuse_idx, PROTO_INUSE_NR); -void sock_prot_inuse_add (struct net *net,struct proto *prot,int val) -{ -__this_cpu_add (net->core.prot_inuse->val[prot->inuse_idx], val); -} -EXPORT_SYMBOL_GPL (sock_prot_inuse_add); -int sock_prot_inuse_get (struct net *net,struct proto *prot) {int cpu, idx = prot->inuse_idx;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 25/356 net: drop nopreempt requirement on sock_prot_inuse_add()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit b3cb764aa1d753cf6a58858f9e2097ba71e8100b ]
This is distracting really, let's make this simpler, because many callers had to take care of this by themselves, even if on x86 this adds more code than really needed.
Stable-dep-of: a9bf9c7dc6a5 ("af_unix: Annotate data-race of sk->sk_state in unix_stream_connect().")
--- include/net/sock.h | 4 ++-- net/ieee802154/socket.c | 4 ++-- net/ipv4/raw.c | 2 +- net/ipv6/ipv6_sockglue.c | 8 ++++---- net/netlink/af_netlink.c | 4 ---- net/packet/af_packet.c | 4 ---- net/sctp/socket.c | 5 ----- net/smc/af_smc.c | 2 +- net/unix/af_unix.c | 4 ---- net/xdp/xsk.c | 4 ---- 10 files changed, 10 insertions(+), 31 deletions(-)
include/net/sock.h +2 -2
@@ -1464,11 +1464,11 @@ proto_memory_pressure(struct proto *prot)struct prot_inuse {int val[PROTO_INUSE_NR ]; }; -/* Called with local bh disabled */ +static inline void sock_prot_inuse_add (const struct net *net,const struct proto *prot,int val) { -__this_cpu_add (net->core.prot_inuse->val[prot->inuse_idx], val); +this_cpu_add (net->core.prot_inuse->val[prot->inuse_idx], val); }int sock_prot_inuse_get (struct net *net,struct proto *proto);int sock_inuse_get (struct net *net);
net/ieee802154/socket.c +2 -2
@@ -174,8 +174,8 @@ static int raw_hash(struct sock *sk) {write_lock_bh (&raw_lock);sk_add_node (sk, &raw_head); -sock_prot_inuse_add (sock_net (sk), sk->sk_prot,1 );write_unlock_bh (&raw_lock); +sock_prot_inuse_add (sock_net (sk), sk->sk_prot,1 );return 0 ; }
@@ -458,8 +458,8 @@ static int dgram_hash(struct sock *sk) {write_lock_bh (&dgram_lock);sk_add_node (sk, &dgram_head); -sock_prot_inuse_add (sock_net (sk), sk->sk_prot,1 );write_unlock_bh (&dgram_lock); +sock_prot_inuse_add (sock_net (sk), sk->sk_prot,1 );return 0 ; }
net/ipv4/raw.c +1 -1
@@ -99,8 +99,8 @@ int raw_hash_sk(struct sock *sk)write_lock_bh (&h->lock);sk_add_node (sk, head); -sock_prot_inuse_add (sock_net (sk), sk->sk_prot,1 );write_unlock_bh (&h->lock); +sock_prot_inuse_add (sock_net (sk), sk->sk_prot,1 );return 0 ; }
net/ipv6/ipv6_sockglue.c +4 -4
@@ -471,10 +471,10 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,if (sk->sk_protocol ==IPPROTO_TCP ) {struct inet_connection_sock *icsk =inet_csk (sk); -local_bh_disable (); +sock_prot_inuse_add (net, sk->sk_prot,-1 );sock_prot_inuse_add (net, &tcp_prot,1 ); -local_bh_enable (); + sk->sk_prot = &tcp_prot; icsk->icsk_af_ops = &ipv4_specific; sk->sk_socket->ops = &inet_stream_ops;
@@ -485,10 +485,10 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,if (sk->sk_protocol ==IPPROTO_UDPLITE ) prot = &udplite_prot; -local_bh_disable (); +sock_prot_inuse_add (net, sk->sk_prot,-1 );sock_prot_inuse_add (net, prot,1 ); -local_bh_enable (); + sk->sk_prot = prot; sk->sk_socket->ops = &inet_dgram_ops; sk->sk_family =PF_INET ;
net/netlink/af_netlink.c +0 -4
@@ -711,9 +711,7 @@ static int netlink_create(struct net *net, struct socket *sock, int protocol,if (err <0 ) goto out_module; -local_bh_disable ();sock_prot_inuse_add (net, &netlink_proto,1 ); -local_bh_enable (); nlk =nlk_sk (sock->sk); nlk->module = module;
@@ -813,9 +811,7 @@ static int netlink_release(struct socket *sock)netlink_table_ungrab (); } -local_bh_disable ();sock_prot_inuse_add (sock_net (sk), &netlink_proto,-1 ); -local_bh_enable ();call_rcu (&nlk->rcu, deferred_put_nlk_sk);return 0 ; }
net/packet/af_packet.c +0 -4
@@ -3092,9 +3092,7 @@ static int packet_release(struct socket *sock)sk_del_node_init_rcu (sk);mutex_unlock (&net->packet.sklist_lock); -preempt_disable ();sock_prot_inuse_add (net, sk->sk_prot,-1 ); -preempt_enable ();spin_lock (&po->bind_lock);unregister_prot_hook (sk, false);
@@ -3361,9 +3359,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,sk_add_node_tail_rcu (sk, &net->packet.sklist);mutex_unlock (&net->packet.sklist_lock); -preempt_disable ();sock_prot_inuse_add (net, &packet_proto,1 ); -preempt_enable ();return 0 ; out2:
net/sctp/socket.c +0 -5
@@ -5073,12 +5073,9 @@ static int sctp_init_sock(struct sock *sk)SCTP_DBG_OBJCNT_INC (sock); -local_bh_disable ();sk_sockets_allocated_inc (sk);sock_prot_inuse_add (net, sk->sk_prot,1 ); -local_bh_enable (); -return 0 ; }
@@ -5104,10 +5101,8 @@ static void sctp_destroy_sock(struct sock *sk)list_del (&sp->auto_asconf_list); }sctp_endpoint_free (sp->ep); -local_bh_disable ();sk_sockets_allocated_dec (sk);sock_prot_inuse_add (sock_net (sk), sk->sk_prot,-1 ); -local_bh_enable (); }/* Triggered when there are no references on the socket anymore */
net/smc/af_smc.c +1 -1
@@ -88,8 +88,8 @@ int smc_hash_sk(struct sock *sk)write_lock_bh (&h->lock);sk_add_node (sk, head); -sock_prot_inuse_add (sock_net (sk), sk->sk_prot,1 );write_unlock_bh (&h->lock); +sock_prot_inuse_add (sock_net (sk), sk->sk_prot,1 );return 0 ; }
net/unix/af_unix.c +0 -4
@@ -515,9 +515,7 @@ static void unix_sock_destructor(struct sock *sk)unix_release_addr (u->addr);atomic_long_dec (&unix_nr_socks); -local_bh_disable ();sock_prot_inuse_add (sock_net (sk), sk->sk_prot,-1 ); -local_bh_enable ();#ifdef UNIX_REFCNT_DEBUG pr_debug ("UNIX %p is destroyed, %ld are still alive.\n" , sk,atomic_long_read (&unix_nr_socks));
@@ -890,9 +888,7 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern,memset (&u->scm_stat,0 ,sizeof (struct scm_stat ));unix_insert_socket (unix_sockets_unbound (sk), sk); -local_bh_disable ();sock_prot_inuse_add (sock_net (sk), sk->sk_prot,1 ); -local_bh_enable ();return sk;
net/xdp/xsk.c +0 -4
@@ -842,9 +842,7 @@ static int xsk_release(struct socket *sock)sk_del_node_init_rcu (sk);mutex_unlock (&net->xdp.lock); -local_bh_disable ();sock_prot_inuse_add (net, sk->sk_prot,-1 ); -local_bh_enable ();xsk_delete_from_maps (xs);mutex_lock (&xs->mutex);
@@ -1465,9 +1463,7 @@ static int xsk_create(struct net *net, struct socket *sock, int protocol,sk_add_node_rcu (sk, &net->xdp.list);mutex_unlock (&net->xdp.lock); -local_bh_disable ();sock_prot_inuse_add (net, &xsk_proto,1 ); -local_bh_enable ();return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 26/356 af_unix: Annotate data-race of sk->sk_state in unix_stream_connect().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit a9bf9c7dc6a5899c01cb8f6e773a66315a5cd4b7 ]
As small optimisation, unix_stream_connect() prefetches the client's sk->sk_state without unix_state_lock() and checks if it's TCP_CLOSE.
Later, sk->sk_state is checked again under unix_state_lock().
Let's use READ_ONCE() for the first check and TCP_CLOSE directly for the second check.
--- net/unix/af_unix.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/unix/af_unix.c +2 -5
@@ -1331,7 +1331,6 @@ static int unix_stream_connect(struct sostruct sock *other =NULL ;struct sk_buff *skb =NULL ;unsigned int hash; -int st;int err;long timeo;
@@ -1413,9 +1412,7 @@ restart:Well, and we have to recheck the state after socket locked. */ - st = sk->sk_state; - -switch (st) { +switch (READ_ONCE (sk->sk_state)) {case TCP_CLOSE :/* This is ok... continue with connect */ break ;
@@ -1430,7 +1427,7 @@ restart:unix_state_lock_nested (sk,U_LOCK_SECOND ); -if (sk->sk_state != st) { +if (sk->sk_state !=TCP_CLOSE ) {unix_state_unlock (sk);unix_state_unlock (other);sock_put (other);
Greg Kroah-Hartman
maintainerPATCH 27/356 af_unix: Annotate data-races around sk->sk_state in sendmsg() and recvmsg().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 8a34d4e8d9742a24f74998f45a6a98edd923319b ]
The following functions read sk->sk_state locklessly and proceed only if the state is TCP_ESTABLISHED.
* unix_stream_sendmsg
* unix_stream_read_generic
* unix_seqpacket_sendmsg
* unix_seqpacket_recvmsg
Let's use READ_ONCE() there.
--- net/unix/af_unix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/unix/af_unix.c +4 -4
@@ -2051,7 +2051,7 @@ static int unix_stream_sendmsg(struct so }if (msg->msg_namelen) { - err = sk->sk_state ==TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP ; + err =READ_ONCE (sk->sk_state) ==TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP ; goto out_err; }else { err = -ENOTCONN ;
@@ -2263,7 +2263,7 @@ static int unix_seqpacket_sendmsg(structif (err)return err; -if (sk->sk_state !=TCP_ESTABLISHED ) +if (READ_ONCE (sk->sk_state) !=TCP_ESTABLISHED )return -ENOTCONN ;if (msg->msg_namelen)
@@ -2277,7 +2277,7 @@ static int unix_seqpacket_recvmsg(struct {struct sock *sk = sock->sk; -if (sk->sk_state !=TCP_ESTABLISHED ) +if (READ_ONCE (sk->sk_state) !=TCP_ESTABLISHED )return -ENOTCONN ;return unix_dgram_recvmsg (sock, msg, size, flags);
@@ -2624,7 +2624,7 @@ static int unix_stream_read_generic(strusize_t size = state->size;unsigned int last_len; -if (unlikely (sk->sk_state !=TCP_ESTABLISHED )) { +if (unlikely (READ_ONCE (sk->sk_state) !=TCP_ESTABLISHED )) { err = -EINVAL ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 10/356 net/ncsi: Simplify Kconfig/dts control flow
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Delevoryas <[email protected]>
[ Upstream commit c797ce168930ce3d62a9b7fc4d7040963ee6a01e ]
Background:
1. CONFIG_NCSI_OEM_CMD_KEEP_PHY
If this is enabled, we send an extra OEM Intel command in the probe sequence immediately after discovering a channel (e.g. after "Clear Initial State").
2. CONFIG_NCSI_OEM_CMD_GET_MAC
If this is enabled, we send one of 3 OEM "Get MAC Address" commands from Broadcom, Mellanox (Nvidida), and Intel in the *configuration* sequence for a channel.
3. mellanox,multi-host (or mlx,multi-host)
Introduced by this patch:
https://lore.kernel.org/all/[email protected]/
Which was actually originally from [email protected]:
https://github.com/facebook/openbmc-linux/commit/9f132a10ec48db84613519258cd8a317fb9c8f1b
Cosmo claimed that the Nvidia ConnectX-4 and ConnectX-6 NIC's don't respond to Get Version ID, et. al in the probe sequence unless you send the Set MC Affinity command first.
Problem Statement:
We've been using a combination of #ifdef code blocks and IS_ENABLED() conditions to conditionally send these OEM commands.
It makes adding any new code around these commands hard to understand.
Solution:
In this patch, I just want to remove the conditionally compiled blocks of code, and always use IS_ENABLED(...) to do dynamic control flow.
I don't think the small amount of code this adds to non-users of the OEM Kconfigs is a big deal.
Stable-dep-of: e85e271dec02 ("net/ncsi: Fix the multi thread manner of NCSI driver")
--- net/ncsi/ncsi-manage.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
net/ncsi/ncsi-manage.c +3 -17
@@ -689,8 +689,6 @@ static int set_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc,return 0 ; } -#if IS_ENABLED (CONFIG_NCSI_OEM_CMD_KEEP_PHY ) -static int ncsi_oem_keep_phy_intel (struct ncsi_cmd_arg *nca) {unsigned char data[NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN ];
@@ -716,10 +714,6 @@ static int ncsi_oem_keep_phy_intel(struct ncsi_cmd_arg *nca)return ret; } -#endif - -#if IS_ENABLED (CONFIG_NCSI_OEM_CMD_GET_MAC ) -/* NCSI OEM Command APIs */ static int ncsi_oem_gma_handler_bcm (struct ncsi_cmd_arg *nca) {
@@ -856,8 +850,6 @@ static int ncsi_gma_handler(struct ncsi_cmd_arg *nca, unsigned int mf_id)return nch->handler (nca); } -#endif /* CONFIG_NCSI_OEM_CMD_GET_MAC */ -/* Determine if a given channel from the channel_queue should be used for Tx */ static bool ncsi_channel_is_tx (struct ncsi_dev_priv *ndp,struct ncsi_channel *nc)
@@ -1039,20 +1031,18 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) goto error; } - nd->state = ncsi_dev_state_config_oem_gma; + nd->state =IS_ENABLED (CONFIG_NCSI_OEM_CMD_GET_MAC ) + ? ncsi_dev_state_config_oem_gma + : ncsi_dev_state_config_clear_vids;break ;case ncsi_dev_state_config_oem_gma: nd->state = ncsi_dev_state_config_clear_vids; - ret =-1 ; -#if IS_ENABLED (CONFIG_NCSI_OEM_CMD_GET_MAC ) nca.type =NCSI_PKT_CMD_OEM ; nca.package = np->id; nca.channel = nc->id; ndp->pending_req_num =1 ; ret =ncsi_gma_handler (&nca, nc->version.mf_id); -#endif /* CONFIG_NCSI_OEM_CMD_GET_MAC */ -if (ret <0 )schedule_work (&ndp->work);
@@ -1404,7 +1394,6 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)schedule_work (&ndp->work);break ; -#if IS_ENABLED (CONFIG_NCSI_OEM_CMD_GET_MAC )case ncsi_dev_state_probe_mlx_gma: ndp->pending_req_num =1 ;
@@ -1429,7 +1418,6 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp) nd->state = ncsi_dev_state_probe_cis;break ; -#endif /* CONFIG_NCSI_OEM_CMD_GET_MAC */ case ncsi_dev_state_probe_cis: ndp->pending_req_num =NCSI_RESERVED_CHANNEL ;
@@ -1447,7 +1435,6 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)if (IS_ENABLED (CONFIG_NCSI_OEM_CMD_KEEP_PHY )) nd->state = ncsi_dev_state_probe_keep_phy;break ; -#if IS_ENABLED (CONFIG_NCSI_OEM_CMD_KEEP_PHY )case ncsi_dev_state_probe_keep_phy: ndp->pending_req_num =1 ;
@@ -1460,7 +1447,6 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp) nd->state = ncsi_dev_state_probe_gvi;break ; -#endif /* CONFIG_NCSI_OEM_CMD_KEEP_PHY */ case ncsi_dev_state_probe_gvi:case ncsi_dev_state_probe_gc:case ncsi_dev_state_probe_gls:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 28/356 af_unix: Annotate data-race of sk->sk_state in unix_stream_read_skb().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit af4c733b6b1aded4dc808fafece7dfe6e9d2ebb3 ]
unix_stream_read_skb() is called from sk->sk_data_ready() context where unix_state_lock() is not held.
Let's use READ_ONCE() there.
--- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.c +1 -1
@@ -2600,7 +2600,7 @@ static struct sk_buff *manage_oob(structstatic int unix_stream_read_sock (struct sock *sk,read_descriptor_t *desc,sk_read_actor_t recv_actor) { -if (unlikely (sk->sk_state !=TCP_ESTABLISHED )) +if (unlikely (READ_ONCE (sk->sk_state) !=TCP_ESTABLISHED ))return -ENOTCONN ;return unix_read_sock (sk, desc, recv_actor);
Greg Kroah-Hartman
maintainerPATCH 29/356 af_unix: Annotate data-races around sk->sk_state in UNIX_DIAG.
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 0aa3be7b3e1f8f997312cc4705f8165e02806f8f ]
While dumping AF_UNIX sockets via UNIX_DIAG, sk->sk_state is read locklessly.
Let's use READ_ONCE() there.
Note that the result could be inconsistent if the socket is dumped during the state change. This is common for other SOCK_DIAG and similar interfaces.
--- net/unix/diag.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/unix/diag.c +4 -4
@@ -64,7 +64,7 @@ static int sk_diag_dump_icons(struct socu32 *buf;int i; -if (sk->sk_state ==TCP_LISTEN ) { +if (READ_ONCE (sk->sk_state) ==TCP_LISTEN ) {spin_lock (&sk->sk_receive_queue.lock); attr = nla_reserve(nlskb, UNIX_DIAG_ICONS,
@@ -102,7 +102,7 @@ static int sk_diag_show_rqlen(struct soc {struct unix_diag_rqlen rql; -if (sk->sk_state ==TCP_LISTEN ) { +if (READ_ONCE (sk->sk_state) ==TCP_LISTEN ) { rql.udiag_rqueue = sk->sk_receive_queue.qlen; rql.udiag_wqueue = sk->sk_max_ack_backlog; }else {
@@ -135,7 +135,7 @@ static int sk_diag_fill(struct sock *sk, rep =nlmsg_data (nlh); rep->udiag_family =AF_UNIX ; rep->udiag_type = sk->sk_type; - rep->udiag_state = sk->sk_state; + rep->udiag_state =READ_ONCE (sk->sk_state); rep->pad =0 ; rep->udiag_ino = sk_ino;sock_diag_save_cookie (sk, rep->udiag_cookie);
@@ -218,7 +218,7 @@ static int unix_diag_dump(struct sk_buffcontinue ;if (num < s_num) goto next; -if (!(req->udiag_states & (1 << sk->sk_state))) +if (!(req->udiag_states & (1 <<READ_ONCE (sk->sk_state)))) goto next; if (sk_diag_dump(sk, skb, req, sk_user_ns(skb->sk), NETLINK_CB(cb->skb).portid,
Greg Kroah-Hartman
maintainerPATCH 30/356 af_unix: Annotate data-race of net->unx.sysctl_max_dgram_qlen.
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit bd9f2d05731f6a112d0c7391a0d537bfc588dbe6 ]
net->unx.sysctl_max_dgram_qlen is exposed as a sysctl knob and can be changed concurrently.
Let's use READ_ONCE() in unix_create1().
--- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.c +1 -1
@@ -873,7 +873,7 @@ static struct sock *unix_create1(struct sk->sk_allocation =GFP_KERNEL_ACCOUNT ; sk->sk_write_space = unix_write_space; - sk->sk_max_ack_backlog = net->unx.sysctl_max_dgram_qlen; + sk->sk_max_ack_backlog =READ_ONCE (net->unx.sysctl_max_dgram_qlen); sk->sk_destruct = unix_sock_destructor; u =unix_sk (sk); u->inflight =0 ;
Greg Kroah-Hartman
maintainerPATCH 31/356 af_unix: Use unix_recvq_full_lockless() in unix_stream_connect().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 45d872f0e65593176d880ec148f41ad7c02e40a7 ]
Once sk->sk_state is changed to TCP_LISTEN, it never changes.
unix_accept() takes advantage of this characteristics; it does not hold the listener's unix_state_lock() and only acquires recvq lock to pop one skb.
It means unix_state_lock() does not prevent the queue length from changing in unix_stream_connect().
Thus, we need to use unix_recvq_full_lockless() to avoid data-race.
Now we remove unix_recvq_full() as no one uses it.
Note that we can remove READ_ONCE() for sk->sk_max_ack_backlog in unix_recvq_full_lockless() because of the following reasons:
(1) For SOCK_DGRAM, it is a written-once field in unix_create1()
(2) For SOCK_STREAM and SOCK_SEQPACKET, it is changed under the listener's unix_state_lock() in unix_listen(), and we hold the lock in unix_stream_connect()
--- net/unix/af_unix.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
net/unix/af_unix.c +2 -8
@@ -190,15 +190,9 @@ static inline int unix_may_send(struct sreturn unix_peer (osk) ==NULL ||unix_our_peer (sk, osk); } -static inline int unix_recvq_full (const struct sock *sk) -{ -return skb_queue_len (&sk->sk_receive_queue) > sk->sk_max_ack_backlog; -} -static inline int unix_recvq_full_lockless (const struct sock *sk) { -return skb_queue_len_lockless (&sk->sk_receive_queue) > -READ_ONCE (sk->sk_max_ack_backlog); +return skb_queue_len_lockless (&sk->sk_receive_queue) > sk->sk_max_ack_backlog; }struct sock *unix_peer_get (struct sock *s)
@@ -1387,7 +1381,7 @@ restart:if (other->sk_shutdown &RCV_SHUTDOWN ) goto out_unlock; -if (unix_recvq_full (other)) { +if (unix_recvq_full_lockless (other)) { err = -EAGAIN ;if (!timeo) goto out_unlock;
Greg Kroah-Hartman
maintainerPATCH 32/356 af_unix: annotate lockless accesses to sk->sk_err
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit cc04410af7de348234ac36a5f50c4ce416efdb4b ]
unix_poll() and unix_dgram_poll() read sk->sk_err
without any lock held.
Add relevant READ_ONCE()/WRITE_ONCE() annotations.
Stable-dep-of: 83690b82d228 ("af_unix: Use skb_queue_empty_lockless() in unix_release_sock().")
--- net/unix/af_unix.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/unix/af_unix.c +5 -4
@@ -485,7 +485,7 @@ static void unix_dgram_disconnected(stru* when peer was not connected to us. */ if (!sock_flag (other,SOCK_DEAD ) &&unix_peer (other) == sk) { - other->sk_err =ECONNRESET ; +WRITE_ONCE (other->sk_err,ECONNRESET );sk_error_report (other); } }
@@ -556,7 +556,7 @@ static void unix_release_sock(struct soc/* No more writes */ WRITE_ONCE (skpair->sk_shutdown,SHUTDOWN_MASK );if (!skb_queue_empty (&sk->sk_receive_queue) || embrion) - skpair->sk_err =ECONNRESET ; +WRITE_ONCE (skpair->sk_err,ECONNRESET );unix_state_unlock (skpair); skpair->sk_state_change (skpair);sk_wake_async (skpair,SOCK_WAKE_WAITD ,POLL_HUP );
@@ -3066,7 +3066,7 @@ static __poll_t unix_poll(struct file *f state =READ_ONCE (sk->sk_state);/* exceptional events? */ -if (sk->sk_err) +if (READ_ONCE (sk->sk_err)) mask |=EPOLLERR ;if (shutdown ==SHUTDOWN_MASK ) mask |=EPOLLHUP ;
@@ -3113,7 +3113,8 @@ static __poll_t unix_dgram_poll(struct f state =READ_ONCE (sk->sk_state);/* exceptional events? */ -if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) +if (READ_ONCE (sk->sk_err) || + !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR | (sock_flag (sk,SOCK_SELECT_ERR_QUEUE ) ?EPOLLPRI :0 );
Greg Kroah-Hartman
maintainerPATCH 33/356 af_unix: Use skb_queue_empty_lockless() in unix_release_sock().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 83690b82d228b3570565ebd0b41873933238b97f ]
If the socket type is SOCK_STREAM or SOCK_SEQPACKET, unix_release_sock() checks the length of the peer socket's recvq under unix_state_lock().
However, unix_stream_read_generic() calls skb_unlink() after releasing the lock. Also, for SOCK_SEQPACKET, __skb_try_recv_datagram() unlinks skb without unix_state_lock().
Thues, unix_state_lock() does not protect qlen.
Let's use skb_queue_empty_lockless() in unix_release_sock().
--- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.c +1 -1
@@ -555,7 +555,7 @@ static void unix_release_sock(struct socunix_state_lock (skpair);/* No more writes */ WRITE_ONCE (skpair->sk_shutdown,SHUTDOWN_MASK ); -if (!skb_queue_empty (&sk->sk_receive_queue) || embrion) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue) || embrion)WRITE_ONCE (skpair->sk_err,ECONNRESET );unix_state_unlock (skpair); skpair->sk_state_change (skpair);
Greg Kroah-Hartman
maintainerPATCH 34/356 af_unix: Use skb_queue_len_lockless() in sk_diag_show_rqlen().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 5d915e584d8408211d4567c22685aae8820bfc55 ]
We can dump the socket queue length via UNIX_DIAG by specifying UDIAG_SHOW_RQLEN.
If sk->sk_state is TCP_LISTEN, we return the recv queue length, but here we do not hold recvq lock.
Let's use skb_queue_len_lockless() in sk_diag_show_rqlen().
--- net/unix/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/diag.c +1 -1
@@ -103,7 +103,7 @@ static int sk_diag_show_rqlen(struct socstruct unix_diag_rqlen rql;if (READ_ONCE (sk->sk_state) ==TCP_LISTEN ) { - rql.udiag_rqueue = sk->sk_receive_queue.qlen; + rql.udiag_rqueue =skb_queue_len_lockless (&sk->sk_receive_queue); rql.udiag_wqueue = sk->sk_max_ack_backlog; }else { rql.udiag_rqueue = (u32 )unix_inq_len (sk);
Greg Kroah-Hartman
maintainerPATCH 35/356 af_unix: Annotate data-race of sk->sk_shutdown in sk_diag_fill().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit efaf24e30ec39ebbea9112227485805a48b0ceb1 ]
While dumping sockets via UNIX_DIAG, we do not hold unix_state_lock().
Let's use READ_ONCE() to read sk->sk_shutdown.
--- net/unix/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/diag.c +1 -1
@@ -164,7 +164,7 @@ static int sk_diag_fill(struct sock *sk, sock_diag_put_meminfo(sk, skb, UNIX_DIAG_MEMINFO)) goto out_nlmsg_trim; -if (nla_put_u8 (skb,UNIX_DIAG_SHUTDOWN , sk->sk_shutdown)) +if (nla_put_u8 (skb,UNIX_DIAG_SHUTDOWN ,READ_ONCE (sk->sk_shutdown))) goto out_nlmsg_trim; if ((req->udiag_show & UDIAG_SHOW_UID) &&
Greg Kroah-Hartman
maintainerPATCH 36/356 ipv6: fix possible race in __fib6_drop_pcpu_from()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit b01e1c030770ff3b4fe37fc7cc6bca03f594133f ]
syzbot found a race in __fib6_drop_pcpu_from() [1]
If compiler reads more than once (*ppcpu_rt), second read could read NULL, if another cpu clears the value in rt6_get_pcpu_route().
Add a READ_ONCE() to prevent this race.
Also add rcu_read_lock()/rcu_read_unlock() because we rely on RCU protection while dereferencing pcpu_rt.
[1]
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000012: 0000 [#1] PREEMPT SMP KASAN PTI KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097] CPU: 0 PID: 7543 Comm: kworker/u8:17 Not tainted 6.10.0-rc1-syzkaller-00013-g2bfcfd584ff5 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Workqueue: netns cleanup_net RIP: 0010:__fib6_drop_pcpu_from.part.0+0x10a/0x370 net/ipv6/ip6_fib.c:984 Code: f8 48 c1 e8 03 80 3c 28 00 0f 85 16 02 00 00 4d 8b 3f 4d 85 ff 74 31 e8 74 a7 fa f7 49 8d bf 90 00 00 00 48 89 f8 48 c1 e8 03 <80> 3c 28 00 0f 85 1e 02 00 00 49 8b 87 90 00 00 00 48 8b 0c 24 48 RSP: 0018:ffffc900040df070 EFLAGS: 00010206 RAX: 0000000000000012 RBX: 0000000000000001 RCX: ffffffff89932e16 RDX: ffff888049dd1e00 RSI: ffffffff89932d7c RDI: 0000000000000091 RBP: dffffc0000000000 R08: 0000000000000005 R09: 0000000000000007 R10: 0000000000000001 R11: 0000000000000006 R12: ffff88807fa080b8 R13: fffffbfff1a9a07d R14: ffffed100ff41022 R15: 0000000000000001 FS: 0000000000000000(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b32c26000 CR3: 000000005d56e000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> __fib6_drop_pcpu_from net/ipv6/ip6_fib.c:966 [inline] fib6_drop_pcpu_from net/ipv6/ip6_fib.c:1027 [inline] fib6_purge_rt+0x7f2/0x9f0 net/ipv6/ip6_fib.c:1038 fib6_del_route net/ipv6/ip6_fib.c:1998 [inline] fib6_del+0xa70/0x17b0 net/ipv6/ip6_fib.c:2043 fib6_clean_node+0x426/0x5b0 net/ipv6/ip6_fib.c:2205 fib6_walk_continue+0x44f/0x8d0 net/ipv6/ip6_fib.c:2127 fib6_walk+0x182/0x370 net/ipv6/ip6_fib.c:2175 fib6_clean_tree+0xd7/0x120 net/ipv6/ip6_fib.c:2255 __fib6_clean_all+0x100/0x2d0 net/ipv6/ip6_fib.c:2271 rt6_sync_down_dev net/ipv6/route.c:4906 [inline] rt6_disable_ip+0x7ed/0xa00 net/ipv6/route.c:4911 addrconf_ifdown.isra.0+0x117/0x1b40 net/ipv6/addrconf.c:3855 addrconf_notify+0x223/0x19e0 net/ipv6/addrconf.c:3778 notifier_call_chain+0xb9/0x410 kernel/notifier.c:93 call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:1992 call_netdevice_notifiers_extack net/core/dev.c:2030 [inline] call_netdevice_notifiers net/core/dev.c:2044 [inline] dev_close_many+0x333/0x6a0 net/core/dev.c:1585 unregister_netdevice_many_notify+0x46d/0x19f0 net/core/dev.c:11193 unregister_netdevice_many net/core/dev.c:11276 [inline] default_device_exit_batch+0x85b/0xae0 net/core/dev.c:11759 ops_exit_list+0x128/0x180 net/core/net_namespace.c:178 cleanup_net+0x5b7/0xbf0 net/core/net_namespace.c:640 process_one_work+0x9fb/0x1b60 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
--- net/ipv6/ip6_fib.c | 6 +++++- net/ipv6/route.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
net/ipv6/ip6_fib.c +5 -1
@@ -961,6 +961,7 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,if (!fib6_nh->rt6i_pcpu)return ; +rcu_read_lock ();/* release the reference to this fib entry from * all of its cached pcpu routes */
@@ -969,7 +970,9 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,struct rt6_info *pcpu_rt; ppcpu_rt =per_cpu_ptr (fib6_nh->rt6i_pcpu, cpu); - pcpu_rt = *ppcpu_rt; + +/* Paired with xchg() in rt6_get_pcpu_route() */ + pcpu_rt =READ_ONCE (*ppcpu_rt);/* only dropping the 'from' reference if the cached route * is using 'match'. The cached pcpu_rt->from only changes
@@ -983,6 +986,7 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,fib6_info_release (from); } } +rcu_read_unlock (); }struct fib6_nh_pcpu_arg {
net/ipv6/route.c +1 -0
@@ -1398,6 +1398,7 @@ static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res)struct rt6_info *prev, **p; p =this_cpu_ptr (res->nh->rt6i_pcpu); +/* Paired with READ_ONCE() in __fib6_drop_pcpu_from() */ prev =xchg (p,NULL );if (prev) {dst_dev_put (&prev->dst);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 37/356 usb: gadget: f_fs: use io_data->status consistently
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Keeping <[email protected]>
[ Upstream commit b566d38857fcb6777f25b674b90a831eec0817a2 ]
Commit fb1f16d74e26 ("usb: gadget: f_fs: change ep->status safe in ffs_epfile_io()") added a new ffs_io_data::status field to fix lifetime issues in synchronous requests.
While there are no similar lifetime issues for asynchronous requests (the separate ep member in ffs_io_data avoids them) using the status field means the USB request can be freed earlier and that there is more consistency between the synchronous and asynchronous I/O paths.
Stable-dep-of: 24729b307eef ("usb: gadget: f_fs: Fix race between aio_cancel() and AIO request complete")
--- drivers/usb/gadget/function/f_fs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/function/f_fs.c +4 -4
@@ -830,8 +830,7 @@ static void ffs_user_copy_worker(struct work_struct *work) { struct ffs_io_data *io_data = container_of(work, struct ffs_io_data, work); -int ret = io_data->req->status ? io_data->req->status : - io_data->req->actual; +int ret = io_data->status;bool kiocb_has_eventfd = io_data->kiocb->ki_flags &IOCB_EVENTFD ;if (io_data->read && ret >0 ) {
@@ -845,8 +844,6 @@ static void ffs_user_copy_worker(struct work_struct *work)if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd)eventfd_signal (io_data->ffs->ffs_eventfd,1 ); -usb_ep_free_request (io_data->ep, io_data->req); -if (io_data->read)kfree (io_data->to_free);ffs_free_buffer (io_data);
@@ -861,6 +858,9 @@ static void ffs_epfile_async_io_complete(struct usb_ep *_ep,ENTER (); + io_data->status = req->status ? req->status : req->actual; +usb_ep_free_request (_ep, req); +INIT_WORK (&io_data->work, ffs_user_copy_worker);queue_work (ffs->io_completion_wq, &io_data->work); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 11/356 net/ncsi: Fix the multi thread manner of NCSI driver
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: DelphineCCChiu <[email protected]>
[ Upstream commit e85e271dec0270982afed84f70dc37703fcc1d52 ]
Currently NCSI driver will send several NCSI commands back to back without waiting the response of previous NCSI command or timeout in some state when NIC have multi channel. This operation against the single thread manner defined by NCSI SPEC(section 6.3.2.3 in DSP0222_1.1.1)
According to NCSI SPEC(section 6.2.13.1 in DSP0222_1.1.1), we should probe one channel at a time by sending NCSI commands (Clear initial state, Get version ID, Get capabilities...), than repeat this steps until the max number of channels which we got from NCSI command (Get capabilities) has been probed.
--- net/ncsi/internal.h | 2 ++ net/ncsi/ncsi-manage.c | 73 +++++++++++++++++++++--------------------- net/ncsi/ncsi-rsp.c | 4 ++- 3 files changed, 41 insertions(+), 38 deletions(-)
net/ncsi/internal.h +2 -0
@@ -325,6 +325,7 @@ struct ncsi_dev_priv {spinlock_t lock;/* Protect the NCSI device */ unsigned int package_probe_id;/* Current ID during probe */ unsigned int package_num;/* Number of packages */ +unsigned int channel_probe_id;/* Current cahnnel ID during probe */ struct list_head packages;/* List of packages */ struct ncsi_channel *hot_channel;/* Channel was ever active */ struct ncsi_request requests[256 ];/* Request table */
@@ -343,6 +344,7 @@ struct ncsi_dev_priv {bool multi_package;/* Enable multiple packages */ bool mlx_multi_host;/* Enable multi host Mellanox */ u32 package_whitelist;/* Packages to configure */ +unsigned char channel_count;/* Num of channels to probe */ };struct ncsi_cmd_arg {
net/ncsi/ncsi-manage.c +36 -37
128 lines not on this page · raw message
net/ncsi/ncsi-rsp.c +3 -1
@@ -795,12 +795,13 @@ static int ncsi_rsp_handler_gc(struct ncsi_request *nr)struct ncsi_rsp_gc_pkt *rsp;struct ncsi_dev_priv *ndp = nr->ndp;struct ncsi_channel *nc; +struct ncsi_package *np;size_t size;/* Find the channel */ rsp = (struct ncsi_rsp_gc_pkt *)skb_network_header (nr->rsp);ncsi_find_package_and_channel (ndp, rsp->rsp.common.channel, -NULL , &nc); + &np, &nc);if (!nc)return -ENODEV ;
@@ -835,6 +836,7 @@ static int ncsi_rsp_handler_gc(struct ncsi_request *nr)*/ nc->vlan_filter.bitmap =U64_MAX ; nc->vlan_filter.n_vids = rsp->vlan_cnt; + np->ndp->channel_count = rsp->channel_cnt;return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 38/356 usb: gadget: f_fs: Fix race between aio_cancel() and AIO request complete
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wesley Cheng <[email protected]>
[ Upstream commit 24729b307eefcd7c476065cd7351c1a018082c19 ]
FFS based applications can utilize the aio_cancel() callback to dequeue pending USB requests submitted to the UDC. There is a scenario where the FFS application issues an AIO cancel call, while the UDC is handling a soft disconnect. For a DWC3 based implementation, the callstack looks like the following:
DWC3 Gadget FFS Applicationdwc3_gadget_soft_disconnect() ...
--> dwc3_stop_active_transfers()
--> dwc3_gadget_giveback(-ESHUTDOWN)
--> ffs_epfile_async_io_complete() ffs_aio_cancel()
--> usb_ep_free_request() --> usb_ep_dequeue()There is currently no locking implemented between the AIO completion handler and AIO cancel, so the issue occurs if the completion routine is running in parallel to an AIO cancel call coming from the FFS application. As the completion call frees the USB request (io_data->req) the FFS application is also referencing it for the usb_ep_dequeue() call. This can lead to accessing a stale/hanging pointer.
commit b566d38857fc ("usb: gadget: f_fs: use io_data->status consistently") relocated the usb_ep_free_request() into ffs_epfile_async_io_complete(). However, in order to properly implement locking to mitigate this issue, the spinlock can't be added to ffs_epfile_async_io_complete(), as usb_ep_dequeue() (if successfully dequeuing a USB request) will call the function driver's completion handler in the same context. Hence, leading into a deadlock.
Fix this issue by moving the usb_ep_free_request() back to ffs_user_copy_worker(), and ensuring that it explicitly sets io_data->req to NULL after freeing it within the ffs->eps_lock. This resolves the race condition above, as the ffs_aio_cancel() routine will not continue attempting to dequeue a request that has already been freed, or the ffs_user_copy_work() not freeing the USB request until the AIO cancel is done referencing it.
This fix depends on
commit b566d38857fc ("usb: gadget: f_fs: use io_data->status consistently")
--- drivers/usb/gadget/function/f_fs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_fs.c +6 -1
@@ -832,6 +832,7 @@ static void ffs_user_copy_worker(struct work_struct *work) work);int ret = io_data->status;bool kiocb_has_eventfd = io_data->kiocb->ki_flags &IOCB_EVENTFD ; +unsigned long flags;if (io_data->read && ret >0 ) {kthread_use_mm (io_data->mm);
@@ -844,6 +845,11 @@ static void ffs_user_copy_worker(struct work_struct *work)if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd)eventfd_signal (io_data->ffs->ffs_eventfd,1 ); +spin_lock_irqsave (&io_data->ffs->eps_lock, flags); +usb_ep_free_request (io_data->ep, io_data->req); + io_data->req =NULL ; +spin_unlock_irqrestore (&io_data->ffs->eps_lock, flags); +if (io_data->read)kfree (io_data->to_free);ffs_free_buffer (io_data);
@@ -859,7 +865,6 @@ static void ffs_epfile_async_io_complete(struct usb_ep *_ep,ENTER (); io_data->status = req->status ? req->status : req->actual; -usb_ep_free_request (_ep, req);INIT_WORK (&io_data->work, ffs_user_copy_worker);queue_work (ffs->io_completion_wq, &io_data->work);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 39/356 iio: accel: mxc4005: Reset chip on probe() and resume()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 6b8cffdc4a31e4a72f75ecd1bc13fbf0dafee390 ]
On some designs the chip is not properly reset when powered up at boot or after a suspend/resume cycle.
Use the sw-reset feature to ensure that the chip is in a clean state after probe() / resume() and in the case of resume() restore the settings (scale, trigger-enabled).
--- drivers/iio/accel/mxc4005.c | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
drivers/iio/accel/mxc4005.c +68 -0
@@ -5,6 +5,7 @@* Copyright (c) 2014, Intel Corporation. */ +#include <linux/delay.h> #include <linux/module.h> #include <linux/i2c.h> #include <linux/iio/iio.h>
@@ -36,6 +37,7 @@#define MXC4005_REG_INT_CLR1 0x01#define MXC4005_REG_INT_CLR1_BIT_DRDYC 0x01 +#define MXC4005_REG_INT_CLR1_SW_RST 0x10#define MXC4005_REG_CONTROL 0x0D#define MXC4005_REG_CONTROL_MASK_FSR GENMASK(6, 5)
@@ -43,6 +45,9 @@#define MXC4005_REG_DEVICE_ID 0x0E +/* Datasheet does not specify a reset time, this is a conservative guess */ +#define MXC4005_RESET_TIME_US 2000 +enum mxc4005_axis {AXIS_X ,AXIS_Y ,
@@ -66,6 +71,8 @@ struct mxc4005_data {s64 timestamp__aligned(8) ; } scan;bool trigger_enabled; +unsigned int control; +unsigned int int_mask1; };/*
@@ -349,6 +356,7 @@ static int mxc4005_set_trigger_state(struct iio_trigger *trig,return ret; } + data->int_mask1 = val; data->trigger_enabled = state;mutex_unlock (&data->mutex);
@@ -384,6 +392,13 @@ static int mxc4005_chip_init(struct mxc4005_data *data)dev_dbg (data->dev,"MXC4005 chip id %02x\n" , reg); + ret =regmap_write (data->regmap,MXC4005_REG_INT_CLR1 , +MXC4005_REG_INT_CLR1_SW_RST ); +if (ret <0 ) +return dev_err_probe (data->dev, ret,"resetting chip\n" ); + +fsleep (MXC4005_RESET_TIME_US ); + ret =regmap_write (data->regmap,MXC4005_REG_INT_MASK0 ,0 );if (ret <0 )return dev_err_probe (data->dev, ret,"writing INT_MASK0\n" );
@@ -480,6 +495,58 @@ static int mxc4005_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } +static int mxc4005_suspend (struct device *dev) +{ +struct iio_dev *indio_dev =dev_get_drvdata (dev); +struct mxc4005_data *data =iio_priv (indio_dev); +int ret; + +/* Save control to restore it on resume */ + ret =regmap_read (data->regmap,MXC4005_REG_CONTROL , &data->control); +if (ret <0 ) +dev_err (data->dev,"failed to read reg_control\n" ); + +return ret; +} + +static int mxc4005_resume (struct device *dev) +{ +struct iio_dev *indio_dev =dev_get_drvdata (dev); +struct mxc4005_data *data =iio_priv (indio_dev); +int ret; + + ret =regmap_write (data->regmap,MXC4005_REG_INT_CLR1 , +MXC4005_REG_INT_CLR1_SW_RST ); +if (ret) { +dev_err (data->dev,"failed to reset chip: %d\n" , ret); +return ret; + } + +fsleep (MXC4005_RESET_TIME_US ); + + ret =regmap_write (data->regmap,MXC4005_REG_CONTROL , data->control); +if (ret) { +dev_err (data->dev,"failed to restore control register\n" ); +return ret; + } + + ret =regmap_write (data->regmap,MXC4005_REG_INT_MASK0 ,0 ); +if (ret) { +dev_err (data->dev,"failed to restore interrupt 0 mask\n" ); +return ret; + } + + ret =regmap_write (data->regmap,MXC4005_REG_INT_MASK1 , data->int_mask1); +if (ret) { +dev_err (data->dev,"failed to restore interrupt 1 mask\n" ); +return ret; + } + +return 0 ; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(mxc4005_pm_ops, mxc4005_suspend, mxc4005_resume); +static const struct acpi_device_id mxc4005_acpi_match[] = { {"MXC4005" ,0 }, {"MXC6655" ,0 },
@@ -498,6 +565,7 @@ static struct i2c_driver mxc4005_driver = { .driver = { .name = MXC4005_DRV_NAME, .acpi_match_table = ACPI_PTR(mxc4005_acpi_match), + .pm = pm_sleep_ptr(&mxc4005_pm_ops), }, .probe = mxc4005_probe, .id_table = mxc4005_id,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 40/356 drm/amd/display: Handle Y carry-over in VCP X.Y calculation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Shen <[email protected]>
[ Upstream commit 3626a6aebe62ce7067cdc460c0c644e9445386bb ]
[Why/How]
Theoretically rare corner case where ceil(Y) results in rounding up to an integer. If this happens, the 1 should be carried over to the X value.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +6 -0
@@ -644,6 +644,12 @@ void enc1_stream_encoder_set_throttled_vcp_size( x), 26)); +// If y rounds up to integer, carry it over to x. +if (y >>26 ) { + x +=1 ; + y =0 ; + } +REG_SET_2 (DP_MSE_RATE_CNTL ,0 ,DP_MSE_RATE_X , x,DP_MSE_RATE_Y , y);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 12/356 ipv6: sr: block BH in seg6_output_core() and seg6_input_core()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit c0b98ac1cc104f48763cdb27b1e9ac25fd81fc90 ]
As explained in commit 1378817486d6 ("tipc: block BH before using dst_cache"), net/core/dst_cache.c helpers need to be called with BH disabled.
Disabling preemption in seg6_output_core() is not good enough, because seg6_output_core() is called from process context, lwtunnel_output() only uses rcu_read_lock().
We might be interrupted by a softirq, re-enter seg6_output_core() and corrupt dst_cache data structures.
Fix the race by using local_bh_disable() instead of preempt_disable().
Apply a similar change in seg6_input_core().
--- net/ipv6/seg6_iptunnel.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
net/ipv6/seg6_iptunnel.c +6 -8
@@ -332,9 +332,8 @@ static int seg6_input_core(struct net *net, struct sock *sk, slwt =seg6_lwt_lwtunnel (orig_dst->lwtstate); -preempt_disable (); +local_bh_disable (); dst =dst_cache_get (&slwt->cache); -preempt_enable ();skb_dst_drop (skb);
@@ -342,14 +341,13 @@ static int seg6_input_core(struct net *net, struct sock *sk,ip6_route_input (skb); dst =skb_dst (skb);if (!dst->error) { -preempt_disable ();dst_cache_set_ip6 (&slwt->cache, dst, &ipv6_hdr (skb)->saddr); -preempt_enable (); } }else {skb_dst_set (skb, dst); } +local_bh_enable (); err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev));if (unlikely (err))
@@ -405,9 +403,9 @@ static int seg6_output_core(struct net *net, struct sock *sk, slwt =seg6_lwt_lwtunnel (orig_dst->lwtstate); -preempt_disable (); +local_bh_disable (); dst =dst_cache_get (&slwt->cache); -preempt_enable (); +local_bh_enable ();if (unlikely (!dst)) {struct ipv6hdr *hdr =ipv6_hdr (skb);
@@ -427,9 +425,9 @@ static int seg6_output_core(struct net *net, struct sock *sk, goto drop; } -preempt_disable (); +local_bh_disable ();dst_cache_set_ip6 (&slwt->cache, dst, &fl6.saddr); -preempt_enable (); +local_bh_enable (); }skb_dst_drop (skb);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 13/356 bpf: Set run context for rawtp test_run callback
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit d0d1df8ba18abc57f28fb3bc053b2bf319367f2c ]
syzbot reported crash when rawtp program executed through the test_run interface calls bpf_get_attach_cookie helper or any other helper that touches task->bpf_ctx pointer.
Setting the run context (task->bpf_ctx pointer) for test_run callback.
--- net/bpf/test_run.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/bpf/test_run.c +6 -0
@@ -326,10 +326,16 @@ static void __bpf_prog_test_run_raw_tp(void *data) {struct bpf_raw_tp_test_run_info *info = data; +struct bpf_trace_run_ctx run_ctx = {}; +struct bpf_run_ctx *old_run_ctx; + + old_run_ctx =bpf_set_run_ctx (&run_ctx.run_ctx);rcu_read_lock (); info->retval =bpf_prog_run (info->prog, info->ctx);rcu_read_unlock (); + +bpf_reset_run_ctx (old_run_ctx); } int bpf_prog_test_run_raw_tp(struct bpf_prog *prog,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 14/356 octeontx2-af: Always allocate PF entries from low prioriy zone
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subbaraya Sundeep <[email protected]>
[ Upstream commit 8b0f7410942cdc420c4557eda02bfcdf60ccec17 ]
PF mcam entries has to be at low priority always so that VF can install longest prefix match rules at higher priority. This was taken care currently but when priority allocation wrt reference entry is requested then entries are allocated from mid-zone instead of low priority zone. Fix this and always allocate entries from low priority zone for PFs.
--- .../ethernet/marvell/octeontx2/af/rvu_npc.c | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +22 -11
@@ -2459,7 +2459,17 @@ static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc,* - when available free entries are less. * Lower priority ones out of avaialble free entries are always * chosen when 'high vs low' question arises. +* +* For a VF base MCAM match rule is set by its PF. And all the +* further MCAM rules installed by VF on its own are +* concatenated with the base rule set by its PF. Hence PF entries +* should be at lower priority compared to VF entries. Otherwise +* base rule is hit always and rules installed by VF will be of +* no use. Hence if the request is from PF then allocate low +* priority entries. */ +if (!(pcifunc &RVU_PFVF_FUNC_MASK )) + goto lprio_alloc;/* Get the search range for priority allocation request */ if (req->priority) {
@@ -2468,17 +2478,6 @@ static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc, goto alloc; } -/* For a VF base MCAM match rule is set by its PF. And all the -* further MCAM rules installed by VF on its own are -* concatenated with the base rule set by its PF. Hence PF entries -* should be at lower priority compared to VF entries. Otherwise -* base rule is hit always and rules installed by VF will be of -* no use. Hence if the request is from PF and NOT a priority -* allocation request then allocate low priority entries. -*/ -if (!(pcifunc &RVU_PFVF_FUNC_MASK )) - goto lprio_alloc; -/* Find out the search range for non-priority allocation request * * Get MCAM free entry count in middle zone.
@@ -2508,6 +2507,18 @@ static int npc_mcam_alloc_entries(struct npc_mcam *mcam, u16 pcifunc, reverse = true; start =0 ; end = mcam->bmap_entries; +/* Ensure PF requests are always at bottom and if PF requests +* for higher/lower priority entry wrt reference entry then +* honour that criteria and start search for entries from bottom +* and not in mid zone. +*/ +if (!(pcifunc &RVU_PFVF_FUNC_MASK ) && + req->priority ==NPC_MCAM_HIGHER_PRIO ) + end = req->ref_entry; + +if (!(pcifunc &RVU_PFVF_FUNC_MASK ) && + req->priority ==NPC_MCAM_LOWER_PRIO ) + start = req->ref_entry; } alloc:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 15/356 net: sched: sch_multiq: fix possible OOB write in multiq_tune()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangyu Hua <[email protected]>
[ Upstream commit affc18fdc694190ca7575b9a86632a73b9fe043d ]
q->bands will be assigned to qopt->bands to execute subsequent code logic after kmalloc. So the old q->bands should not be used in kmalloc. Otherwise, an out-of-bounds write will occur.
--- net/sched/sch_multiq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_multiq.c +1 -1
@@ -185,7 +185,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt, qopt->bands =qdisc_dev (sch)->real_num_tx_queues; - removed =kmalloc (sizeof (*removed) * (q->max_bands - q->bands), + removed =kmalloc (sizeof (*removed) * (q->max_bands - qopt->bands),GFP_KERNEL );if (!removed)return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 16/356 vxlan: Fix regression when dropping packets due to invalid src addresses
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 1cd4bc987abb2823836cbb8f887026011ccddc8a ]
Commit f58f45c1e5b9 ("vxlan: drop packets from invalid src-address") has recently been added to vxlan mainly in the context of source address snooping/learning so that when it is enabled, an entry in the FDB is not being created for an invalid address for the corresponding tunnel endpoint.
Before commit f58f45c1e5b9 vxlan was similarly behaving as geneve in that it passed through whichever macs were set in the L2 header. It turns out that this change in behavior breaks setups, for example, Cilium with netkit in L3 mode for Pods as well as tunnel mode has been passing before the change in f58f45c1e5b9 for both vxlan and geneve. After mentioned change it is only passing for geneve as in case of vxlan packets are dropped due to vxlan_set_mac() returning false as source and destination macs are zero which for E/W traffic via tunnel is totally fine.
Fix it by only opting into the is_valid_ether_addr() check in vxlan_set_mac() when in fact source address snooping/learning is actually enabled in vxlan. This is done by moving the check into vxlan_snoop(). With this change, the Cilium connectivity test suite passes again for both tunnel flavors.
--- drivers/net/vxlan/vxlan_core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/vxlan/vxlan_core.c +4 -0
@@ -1493,6 +1493,10 @@ static bool vxlan_snoop(struct net_device *dev,struct vxlan_fdb *f;u32 ifindex =0 ; +/* Ignore packets from invalid src-address */ +if (!is_valid_ether_addr (src_mac)) +return true; +#if IS_ENABLED (CONFIG_IPV6 )if (src_ip->sa.sa_family ==AF_INET6 && (ipv6_addr_type (&src_ip->sin6.sin6_addr) &IPV6_ADDR_LINKLOCAL ))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 17/356 tcp: count CLOSE-WAIT sockets for TCP_MIB_CURRESTAB
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Xing <[email protected]>
[ Upstream commit a46d0ea5c94205f40ecf912d1bb7806a8a64704f ]
According to RFC 1213, we should also take CLOSE-WAIT sockets into consideration:
"tcpCurrEstab OBJECT-TYPE
...
The number of TCP connections for which the current state is either ESTABLISHED or CLOSE- WAIT."
After this, CurrEstab counter will display the total number of ESTABLISHED and CLOSE-WAIT sockets.
The logic of counting
When we increment the counter?
a) if we change the state to ESTABLISHED.
b) if we change the state from SYN-RECEIVED to CLOSE-WAIT.
When we decrement the counter?
a) if the socket leaves ESTABLISHED and will never go into CLOSE-WAIT, say, on the client side, changing from ESTABLISHED to FIN-WAIT-1.
b) if the socket leaves CLOSE-WAIT, say, on the server side, changing from CLOSE-WAIT to LAST-ACK.
Please note: there are two chances that old state of socket can be changed to CLOSE-WAIT in tcp_fin(). One is SYN-RECV, the other is ESTABLISHED. So we have to take care of the former case.
--- net/ipv4/tcp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/ipv4/tcp.c +5 -1
@@ -2619,6 +2619,10 @@ void tcp_set_state(struct sock *sk, int state)if (oldstate !=TCP_ESTABLISHED )TCP_INC_STATS (sock_net (sk),TCP_MIB_CURRESTAB );break ; +case TCP_CLOSE_WAIT : +if (oldstate ==TCP_SYN_RECV ) +TCP_INC_STATS (sock_net (sk),TCP_MIB_CURRESTAB ); +break ;case TCP_CLOSE :if (oldstate ==TCP_CLOSE_WAIT || oldstate ==TCP_ESTABLISHED )
@@ -2630,7 +2634,7 @@ void tcp_set_state(struct sock *sk, int state)inet_put_port (sk); fallthrough;default : -if (oldstate ==TCP_ESTABLISHED ) +if (oldstate ==TCP_ESTABLISHED || oldstate ==TCP_CLOSE_WAIT )TCP_DEC_STATS (sock_net (sk),TCP_MIB_CURRESTAB ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 8/356 wifi: iwlwifi: mvm: dont read past the mfuart notifcation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 4bb95f4535489ed830cf9b34b0a891e384d1aee4 ]
In case the firmware sends a notification that claims it has more data than it has, we will read past that was allocated for the notification. Remove the print of the buffer, we won't see it by default. If needed, we can see the content with tracing.
This was reported by KFENCE.
--- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/fw.c +0 -10
@@ -95,20 +95,10 @@ void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, {struct iwl_rx_packet *pkt =rxb_addr (rxb);struct iwl_mfu_assert_dump_notif *mfu_dump_notif = (void *)pkt->data; -__le32 *dump_data = mfu_dump_notif->data; -int n_words =le32_to_cpu (mfu_dump_notif->data_size) /sizeof (__le32); -int i;if (mfu_dump_notif->index_num ==0 )IWL_INFO (mvm,"MFUART assert id 0x%x occurred\n" ,le32_to_cpu (mfu_dump_notif->assert_id)); - -for (i =0 ; i < n_words; i++) -IWL_DEBUG_INFO (mvm, -"MFUART assert dump, dword %u: 0x%08x\n" , -le16_to_cpu (mfu_dump_notif->index_num) * - n_words + i, -le32_to_cpu (dump_data[i])); } static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 42/356 drm/amd/display: drop unnecessary NULL checks in debugfs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Kodanev <[email protected]>
[ Upstream commit f8e12e770e8049917f82387033b3cf44bc43b915 ]
pipe_ctx pointer cannot be NULL when getting the address of an element of the pipe_ctx array. Moreover, the MAX_PIPES is defined as 6, so pipe_ctx is not NULL after the loop either.
Detected using the static analysis tool - Svace.
Stable-dep-of: 892b41b16f61 ("drm/amd/display: Fix incorrect DSC instance for MST")
--- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 72 +++++-------------- 1 file changed, 16 insertions(+), 56 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +16 -56
@@ -1315,16 +1315,11 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx) { -kfree (rd_buf); -return -ENXIO ; - } - dsc = pipe_ctx->stream_res.dsc;if (dsc) dsc->funcs->dsc_read_state (dsc, &dsc_state);
@@ -1421,12 +1416,12 @@ static ssize_t dp_dsc_clock_en_write(struct file *f, const char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx || !pipe_ctx->stream) +if (!pipe_ctx->stream) goto done;// Get CRTC state
@@ -1506,16 +1501,11 @@ static ssize_t dp_dsc_slice_width_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx) { -kfree (rd_buf); -return -ENXIO ; - } - dsc = pipe_ctx->stream_res.dsc;if (dsc) dsc->funcs->dsc_read_state (dsc, &dsc_state);
@@ -1610,12 +1600,12 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, const char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx || !pipe_ctx->stream) +if (!pipe_ctx->stream) goto done;// Safely get CRTC state
@@ -1695,16 +1685,11 @@ static ssize_t dp_dsc_slice_height_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx) { -kfree (rd_buf); -return -ENXIO ; - } - dsc = pipe_ctx->stream_res.dsc;if (dsc) dsc->funcs->dsc_read_state (dsc, &dsc_state);
@@ -1799,12 +1784,12 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, const char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx || !pipe_ctx->stream) +if (!pipe_ctx->stream) goto done;// Get CRTC state
@@ -1880,16 +1865,11 @@ static ssize_t dp_dsc_bits_per_pixel_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx) { -kfree (rd_buf); -return -ENXIO ; - } - dsc = pipe_ctx->stream_res.dsc;if (dsc) dsc->funcs->dsc_read_state (dsc, &dsc_state);
@@ -1981,12 +1961,12 @@ static ssize_t dp_dsc_bits_per_pixel_write(struct file *f, const char __user *bufor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx || !pipe_ctx->stream) +if (!pipe_ctx->stream) goto done;// Get CRTC state
@@ -2060,16 +2040,11 @@ static ssize_t dp_dsc_pic_width_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx) { -kfree (rd_buf); -return -ENXIO ; - } - dsc = pipe_ctx->stream_res.dsc;if (dsc) dsc->funcs->dsc_read_state (dsc, &dsc_state);
@@ -2121,16 +2096,11 @@ static ssize_t dp_dsc_pic_height_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx) { -kfree (rd_buf); -return -ENXIO ; - } - dsc = pipe_ctx->stream_res.dsc;if (dsc) dsc->funcs->dsc_read_state (dsc, &dsc_state);
@@ -2197,16 +2167,11 @@ static ssize_t dp_dsc_chunk_size_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx) { -kfree (rd_buf); -return -ENXIO ; - } - dsc = pipe_ctx->stream_res.dsc;if (dsc) dsc->funcs->dsc_read_state (dsc, &dsc_state);
@@ -2273,16 +2238,11 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && +if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link)break ; } -if (!pipe_ctx) { -kfree (rd_buf); -return -ENXIO ; - } - dsc = pipe_ctx->stream_res.dsc;if (dsc) dsc->funcs->dsc_read_state (dsc, &dsc_state);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 51/356 Bluetooth: btqca: Add WCN3988 support
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
[ Upstream commit f904feefe60c28b6852d5625adc4a2c39426a2d9 ]
Add support for the Bluetooth chip codenamed APACHE which is part of WCN3988.
The firmware for this chip has a slightly different naming scheme compared to most others. For ROM Version 0x0200 we need to use apbtfw10.tlv + apnv10.bin and for ROM version 0x201 apbtfw11.tlv + apnv11.bin
Stable-dep-of: cda0d6a198e2 ("Bluetooth: qca: fix info leak when fetching fw build id")
--- drivers/bluetooth/btqca.c | 13 +++++++++++-- drivers/bluetooth/btqca.h | 12 ++++++++++-- drivers/bluetooth/hci_qca.c | 12 ++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-)
drivers/bluetooth/btqca.c +11 -2
@@ -595,11 +595,17 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,/* Firmware files to download are based on ROM version. * ROM version is derived from last two bytes of soc_ver. */ - rom_ver = ((soc_ver &0x00000f00 ) >>0x04 ) | (soc_ver &0x0000000f ); +if (soc_type ==QCA_WCN3988 ) + rom_ver = ((soc_ver &0x00000f00 ) >>0x05 ) | (soc_ver &0x0000000f ); +else + rom_ver = ((soc_ver &0x00000f00 ) >>0x04 ) | (soc_ver &0x0000000f );/* Download rampatch file */ config.type =TLV_TYPE_PATCH ; -if (qca_is_wcn399x (soc_type)) { +if (soc_type ==QCA_WCN3988 ) { +snprintf (config.fwname,sizeof (config.fwname), +"qca/apbtfw%02x.tlv" , rom_ver); + }else if (qca_is_wcn399x (soc_type)) {snprintf (config.fwname,sizeof (config.fwname),"qca/crbtfw%02x.tlv" , rom_ver); }else if (soc_type ==QCA_QCA6390 ) {
@@ -634,6 +640,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,if (firmware_name)snprintf (config.fwname,sizeof (config.fwname),"qca/%s" , firmware_name); +else if (soc_type ==QCA_WCN3988 ) +snprintf (config.fwname,sizeof (config.fwname), +"qca/apnv%02x.bin" , rom_ver);else if (qca_is_wcn399x (soc_type)) {if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) { snprintf(config.fwname, sizeof(config.fwname),
drivers/bluetooth/btqca.h +10 -2
@@ -140,6 +140,7 @@ enum qca_btsoc_type {QCA_INVALID =-1 ,QCA_AR3002 ,QCA_ROME , +QCA_WCN3988 ,QCA_WCN3990 ,QCA_WCN3998 , QCA_WCN3991,
@@ -160,8 +161,15 @@ int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);int qca_send_pre_shutdown_cmd (struct hci_dev *hdev);static inline bool qca_is_wcn399x (enum qca_btsoc_type soc_type) { -return soc_type ==QCA_WCN3990 || soc_type ==QCA_WCN3991 || - soc_type ==QCA_WCN3998 ; +switch (soc_type) { +case QCA_WCN3988 : +case QCA_WCN3990 : +case QCA_WCN3991 : +case QCA_WCN3998 : +return true; +default : +return false; + } }static inline bool qca_is_wcn6750 (enum qca_btsoc_type soc_type) {
drivers/bluetooth/hci_qca.c +12 -0
@@ -1834,6 +1834,17 @@ static const struct hci_uart_proto qca_proto = { .dequeue = qca_dequeue, }; +static const struct qca_device_data qca_soc_data_wcn3988__maybe_unused = { + .soc_type =QCA_WCN3988 , + .vregs = (struct qca_vreg []) { + {"vddio" ,15000 }, + {"vddxo" ,80000 }, + {"vddrf" ,300000 }, + {"vddch0" ,450000 }, + }, + .num_vregs =4 , +}; +static const struct qca_device_data qca_soc_data_wcn3990__maybe_unused = { .soc_type =QCA_WCN3990 , .vregs = (struct qca_vreg []) {
@@ -2359,6 +2370,7 @@ static const struct of_device_id qca_bluetooth_of_match[] = { { .compatible = "qcom,qca6174-bt" }, { .compatible = "qcom,qca6390-bt", .data = &qca_soc_data_qca6390}, { .compatible = "qcom,qca9377-bt" }, + { .compatible = "qcom,wcn3988-bt", .data = &qca_soc_data_wcn3988}, { .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data_wcn3990}, { .compatible = "qcom,wcn3991-bt", .data = &qca_soc_data_wcn3991}, { .compatible = "qcom,wcn3998-bt", .data = &qca_soc_data_wcn3998},
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 52/356 Bluetooth: qca: use switch case for soc type behavior
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Armstrong <[email protected]>
[ Upstream commit 691d54d0f7cb14baac1ff4af210d13c0e4897e27 ]
Use switch/case to handle soc type specific behaviour, the permit dropping the qca_is_xxx() inline functions and make the code clearer and easier to update for new SoCs.
Stable-dep-of: cda0d6a198e2 ("Bluetooth: qca: fix info leak when fetching fw build id")
--- drivers/bluetooth/btqca.c | 87 +++++++++----- drivers/bluetooth/btqca.h | 36 ------ drivers/bluetooth/hci_qca.c | 233 +++++++++++++++++++++++++++--------- 3 files changed, 236 insertions(+), 120 deletions(-)
drivers/bluetooth/btqca.c +57 -30
@@ -602,26 +602,34 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,/* Download rampatch file */ config.type =TLV_TYPE_PATCH ; -if (soc_type ==QCA_WCN3988 ) { -snprintf (config.fwname,sizeof (config.fwname), -"qca/apbtfw%02x.tlv" , rom_ver); - }else if (qca_is_wcn399x (soc_type)) { +switch (soc_type) { +case QCA_WCN3990 : +case QCA_WCN3991 : +case QCA_WCN3998 :snprintf (config.fwname,sizeof (config.fwname),"qca/crbtfw%02x.tlv" , rom_ver); - }else if (soc_type ==QCA_QCA6390 ) { +break ; +case QCA_WCN3988 : +snprintf (config.fwname,sizeof (config.fwname), +"qca/apbtfw%02x.tlv" , rom_ver); +break ; +case QCA_QCA6390 :snprintf (config.fwname,sizeof (config.fwname),"qca/htbtfw%02x.tlv" , rom_ver); - }else if (soc_type ==QCA_WCN6750 ) { +break ; +case QCA_WCN6750 :/* Choose mbn file by default.If mbn file is not found * then choose tlv file */ config.type =ELF_TYPE_PATCH ;snprintf (config.fwname,sizeof (config.fwname),"qca/msbtfw%02x.mbn" , rom_ver); - }else if (soc_type ==QCA_WCN6855 ) { +break ; +case QCA_WCN6855 :snprintf (config.fwname,sizeof (config.fwname),"qca/hpbtfw%02x.tlv" , rom_ver); - }else { +break ; +default :snprintf (config.fwname,sizeof (config.fwname),"qca/rampatch_%08x.bin" , soc_ver); }
@@ -637,33 +645,44 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,/* Download NVM configuration */ config.type =TLV_TYPE_NVM ; -if (firmware_name) +if (firmware_name) {snprintf (config.fwname,sizeof (config.fwname),"qca/%s" , firmware_name); -else if (soc_type ==QCA_WCN3988 ) -snprintf (config.fwname,sizeof (config.fwname), -"qca/apnv%02x.bin" , rom_ver); -else if (qca_is_wcn399x (soc_type)) { -if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) { + }else { +switch (soc_type) { +case QCA_WCN3990 : +case QCA_WCN3991 : +case QCA_WCN3998 : +if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) { +snprintf (config.fwname,sizeof (config.fwname), +"qca/crnv%02xu.bin" , rom_ver); + }else { +snprintf (config.fwname,sizeof (config.fwname), +"qca/crnv%02x.bin" , rom_ver); + } +break ; +case QCA_WCN3988 :snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02xu.bin" , rom_ver); - }else { +"qca/apnv%02x.bin" , rom_ver); +break ; +case QCA_QCA6390 : +snprintf (config.fwname,sizeof (config.fwname), +"qca/htnv%02x.bin" , rom_ver); +break ; +case QCA_WCN6750 :snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02x.bin" , rom_ver); +"qca/msnv%02x.bin" , rom_ver); +break ; +case QCA_WCN6855 : +snprintf (config.fwname,sizeof (config.fwname), +"qca/hpnv%02x.bin" , rom_ver); +break ; + +default : +snprintf (config.fwname,sizeof (config.fwname), +"qca/nvm_%08x.bin" , soc_ver); } } -else if (soc_type ==QCA_QCA6390 ) -snprintf (config.fwname,sizeof (config.fwname), -"qca/htnv%02x.bin" , rom_ver); -else if (soc_type ==QCA_WCN6750 ) -snprintf (config.fwname,sizeof (config.fwname), -"qca/msnv%02x.bin" , rom_ver); -else if (soc_type ==QCA_WCN6855 ) -snprintf (config.fwname,sizeof (config.fwname), -"qca/hpnv%02x.bin" , rom_ver); -else -snprintf (config.fwname,sizeof (config.fwname), -"qca/nvm_%08x.bin" , soc_ver); err =qca_download_firmware (hdev, &config, soc_type, rom_ver);if (err <0 ) {
@@ -671,16 +690,24 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,return err; } -if (soc_type >=QCA_WCN3991 ) { +switch (soc_type) { +case QCA_WCN3991 : +case QCA_QCA6390 : +case QCA_WCN6750 : +case QCA_WCN6855 : err =qca_disable_soc_logging (hdev);if (err <0 )return err; +break ; +default : +break ; }/* WCN399x and WCN6750 supports the Microsoft vendor extension with 0xFD70 as the * VsMsftOpCode. */ switch (soc_type) { +case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 :
drivers/bluetooth/btqca.h +0 -36
@@ -159,27 +159,6 @@ int qca_read_soc_version(struct hci_dev *hdev, struct qca_btsoc_version *ver, enum qca_btsoc_type);int qca_set_bdaddr (struct hci_dev *hdev,const bdaddr_t *bdaddr);int qca_send_pre_shutdown_cmd (struct hci_dev *hdev); -static inline bool qca_is_wcn399x (enum qca_btsoc_type soc_type) -{ -switch (soc_type) { -case QCA_WCN3988 : -case QCA_WCN3990 : -case QCA_WCN3991 : -case QCA_WCN3998 : -return true; -default : -return false; - } -} -static inline bool qca_is_wcn6750 (enum qca_btsoc_type soc_type) -{ -return soc_type ==QCA_WCN6750 ; -} -static inline bool qca_is_wcn6855 (enum qca_btsoc_type soc_type) -{ -return soc_type ==QCA_WCN6855 ; -} -#else static inline int qca_set_bdaddr_rome (struct hci_dev *hdev,const bdaddr_t *bdaddr)
@@ -207,21 +186,6 @@ static inline int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)return -EOPNOTSUPP ; } -static inline bool qca_is_wcn399x (enum qca_btsoc_type soc_type) -{ -return false; -} - -static inline bool qca_is_wcn6750 (enum qca_btsoc_type soc_type) -{ -return false; -} - -static inline bool qca_is_wcn6855 (enum qca_btsoc_type soc_type) -{ -return false; -} -static inline int qca_send_pre_shutdown_cmd (struct hci_dev *hdev) {return -EOPNOTSUPP ;
drivers/bluetooth/hci_qca.c +179 -54
372 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 53/356 Bluetooth: qca: add support for QCA2066
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Jiang <[email protected]>
[ Upstream commit a7f8dedb4be2cc930a29af24427b885405ecd15d ]
This patch adds support for QCA2066 firmware patch and NVM downloading. as the RF performance of QCA2066 SOC chip from different foundries may vary. Therefore we use different NVM to configure them based on board ID.
Changes in v2
- optimize the function qca_generate_hsp_nvm_name
- remove redundant debug code for function qca_read_fw_board_id
Stable-dep-of: cda0d6a198e2 ("Bluetooth: qca: fix info leak when fetching fw build id")
--- drivers/bluetooth/btqca.c | 68 +++++++++++++++++++++++++++++++++++++ drivers/bluetooth/btqca.h | 5 ++- drivers/bluetooth/hci_qca.c | 11 ++++++ 3 files changed, 83 insertions(+), 1 deletion(-)
drivers/bluetooth/btqca.c +68 -0
@@ -160,6 +160,44 @@ static int qca_send_reset(struct hci_dev *hdev)return 0 ; } +static int qca_read_fw_board_id (struct hci_dev *hdev,u16 *bid) +{ +u8 cmd; +struct sk_buff *skb; +struct edl_event_hdr *edl; +int err =0 ; + + cmd =EDL_GET_BID_REQ_CMD ; + skb =__hci_cmd_sync_ev (hdev,EDL_PATCH_CMD_OPCODE ,EDL_PATCH_CMD_LEN , + &cmd,0 ,HCI_INIT_TIMEOUT ); +if (IS_ERR (skb)) { + err =PTR_ERR (skb); +bt_dev_err (hdev,"Reading QCA board ID failed (%d)" , err); +return err; + } + + edl =skb_pull_data (skb,sizeof (*edl)); +if (!edl) { +bt_dev_err (hdev,"QCA read board ID with no header" ); + err = -EILSEQ ; + goto out; + } + +if (edl->cresp !=EDL_CMD_REQ_RES_EVT || + edl->rtype !=EDL_GET_BID_REQ_CMD ) { +bt_dev_err (hdev,"QCA Wrong packet: %d %d" , edl->cresp, edl->rtype); + err = -EIO ; + goto out; + } + + *bid = (edl->data[1 ] <<8 ) + edl->data[2 ]; +bt_dev_dbg (hdev,"%s: bid = %x" , __func__, *bid); + +out: +kfree_skb (skb); +return err; +} +int qca_send_pre_shutdown_cmd (struct hci_dev *hdev) {struct sk_buff *skb;
@@ -575,6 +613,23 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr) }EXPORT_SYMBOL_GPL (qca_set_bdaddr_rome); +static void qca_generate_hsp_nvm_name (char *fwname,size_t max_size, +struct qca_btsoc_version ver,u8 rom_ver,u16 bid) +{ +const char *variant; + +/* hsp gf chip */ +if ((le32_to_cpu (ver.soc_id) &QCA_HSP_GF_SOC_MASK ) ==QCA_HSP_GF_SOC_ID ) + variant ="g" ; +else + variant ="" ; + +if (bid ==0x0 ) +snprintf (fwname, max_size,"qca/hpnv%02x%s.bin" , rom_ver, variant); +else +snprintf (fwname, max_size,"qca/hpnv%02x%s.%x" , rom_ver, variant, bid); +} +int qca_uart_setup (struct hci_dev *hdev,uint8_t baudrate,enum qca_btsoc_type soc_type,struct qca_btsoc_version ver,const char *firmware_name)
@@ -583,6 +638,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,int err;u8 rom_ver =0 ;u32 soc_ver; +u16 boardid =0 ;bt_dev_dbg (hdev,"QCA setup on UART" );
@@ -613,6 +669,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,snprintf (config.fwname,sizeof (config.fwname),"qca/apbtfw%02x.tlv" , rom_ver);break ; +case QCA_QCA2066 : +snprintf (config.fwname,sizeof (config.fwname), +"qca/hpbtfw%02x.tlv" , rom_ver); +break ;case QCA_QCA6390 :snprintf (config.fwname,sizeof (config.fwname),"qca/htbtfw%02x.tlv" , rom_ver);
@@ -643,6 +703,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,/* Give the controller some time to get ready to receive the NVM */ msleep (10 ); +if (soc_type ==QCA_QCA2066 ) +qca_read_fw_board_id (hdev, &boardid); +/* Download NVM configuration */ config.type =TLV_TYPE_NVM ;if (firmware_name) {
@@ -665,6 +728,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,snprintf (config.fwname,sizeof (config.fwname),"qca/apnv%02x.bin" , rom_ver);break ; +case QCA_QCA2066 : +qca_generate_hsp_nvm_name (config.fwname, +sizeof (config.fwname), ver, rom_ver, boardid); +break ;case QCA_QCA6390 :snprintf (config.fwname,sizeof (config.fwname),"qca/htnv%02x.bin" , rom_ver);
@@ -692,6 +759,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,switch (soc_type) {case QCA_WCN3991 : +case QCA_QCA2066 :case QCA_QCA6390 :case QCA_WCN6750 :case QCA_WCN6855 :
drivers/bluetooth/btqca.h +4 -1
@@ -12,6 +12,7 @@#define EDL_PATCH_VER_REQ_CMD (0x19)#define EDL_PATCH_TLV_REQ_CMD (0x1E)#define EDL_GET_BUILD_INFO_CMD (0x20) +#define EDL_GET_BID_REQ_CMD (0x23)#define EDL_NVM_ACCESS_SET_REQ_CMD (0x01)#define MAX_SIZE_PER_TLV_SEGMENT (243)#define QCA_PRE_SHUTDOWN_CMD (0xFC08)
@@ -45,7 +46,8 @@ ((le32_to_cpu(soc_id) << 16) | (le16_to_cpu(rom_ver)))#define QCA_FW_BUILD_VER_LEN 255 - +#define QCA_HSP_GF_SOC_ID 0x1200 +#define QCA_HSP_GF_SOC_MASK 0x0000ff00enum qca_baudrate {QCA_BAUDRATE_115200 =0 ,
@@ -144,6 +146,7 @@ enum qca_btsoc_type {QCA_WCN3990 ,QCA_WCN3998 ,QCA_WCN3991 , +QCA_QCA2066 ,QCA_QCA6390 ,QCA_WCN6750 , QCA_WCN6855,
drivers/bluetooth/hci_qca.c +11 -0
@@ -1801,6 +1801,10 @@ static int qca_setup(struct hci_uart *hu)set_bit (HCI_QUIRK_SIMULTANEOUS_DISCOVERY , &hdev->quirks);switch (soc_type) { +case QCA_QCA2066 : + soc_name ="qca2066" ; +break ; +case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1981,6 +1985,11 @@ static const struct qca_device_data qca_soc_data_wcn3998 __maybe_unused = { .num_vregs = 4, }; +static const struct qca_device_data qca_soc_data_qca2066__maybe_unused = { + .soc_type =QCA_QCA2066 , + .num_vregs =0 , +}; +static const struct qca_device_data qca_soc_data_qca6390__maybe_unused = { .soc_type =QCA_QCA6390 , .num_vregs =0 ,
@@ -2492,6 +2501,7 @@ static SIMPLE_DEV_PM_OPS(qca_pm_ops, qca_suspend, qca_resume);#ifdef CONFIG_OF static const struct of_device_id qca_bluetooth_of_match[] = { + { .compatible ="qcom,qca2066-bt" , .data = &qca_soc_data_qca2066}, { .compatible ="qcom,qca6174-bt" }, { .compatible ="qcom,qca6390-bt" , .data = &qca_soc_data_qca6390}, { .compatible = "qcom,qca9377-bt" },
@@ -2508,6 +2518,7 @@ MODULE_DEVICE_TABLE(of, qca_bluetooth_of_match);#ifdef CONFIG_ACPI static const struct acpi_device_id qca_bluetooth_acpi_match[] = { + {"QCOM2066" , (kernel_ulong_t)&qca_soc_data_qca2066 }, {"QCOM6390" , (kernel_ulong_t)&qca_soc_data_qca6390 }, {"DLA16390" , (kernel_ulong_t)&qca_soc_data_qca6390 }, { "DLB16390", (kernel_ulong_t)&qca_soc_data_qca6390 },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 54/356 Bluetooth: qca: fix info leak when fetching fw build id
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit cda0d6a198e2a7ec6f176c36173a57bdd8af7af2 ]
Add the missing sanity checks and move the 255-byte build-id buffer off the stack to avoid leaking stack data through debugfs in case the build-info reply is malformed.
--- drivers/bluetooth/btqca.c | 25 +++++++++++++++++++++---- drivers/bluetooth/btqca.h | 1 - 2 files changed, 21 insertions(+), 5 deletions(-)
drivers/bluetooth/btqca.c +21 -4
@@ -98,7 +98,8 @@ static int qca_read_fw_build_info(struct hci_dev *hdev) {struct sk_buff *skb;struct edl_event_hdr *edl; -char cmd, build_label[QCA_FW_BUILD_VER_LEN ]; +char *build_label; +char cmd;int build_lbl_len, err =0 ;bt_dev_dbg (hdev,"QCA read fw build info" );
@@ -113,6 +114,11 @@ static int qca_read_fw_build_info(struct hci_dev *hdev)return err; } +if (skb->len <sizeof (*edl)) { + err = -EILSEQ ; + goto out; + } + edl = (struct edl_event_hdr *)(skb->data);if (!edl) {bt_dev_err (hdev,"QCA read fw build info with no header" );
@@ -128,14 +134,25 @@ static int qca_read_fw_build_info(struct hci_dev *hdev) goto out; } +if (skb->len <sizeof (*edl) +1 ) { + err = -EILSEQ ; + goto out; + } + build_lbl_len = edl->data[0 ]; -if (build_lbl_len <=QCA_FW_BUILD_VER_LEN -1 ) { -memcpy (build_label, edl->data +1 , build_lbl_len); - *(build_label + build_lbl_len) ='\0' ; + +if (skb->len <sizeof (*edl) +1 + build_lbl_len) { + err = -EILSEQ ; + goto out; } + build_label =kstrndup (&edl->data[1 ], build_lbl_len,GFP_KERNEL ); +if (!build_label) + goto out; +hci_set_fw_info (hdev,"%s" , build_label); +kfree (build_label); out:kfree_skb (skb);return err;
drivers/bluetooth/btqca.h +0 -1
@@ -45,7 +45,6 @@#define get_soc_ver (soc_id, rom_ver) \ ((le32_to_cpu(soc_id) << 16) | (le16_to_cpu(rom_ver))) -#define QCA_FW_BUILD_VER_LEN 255#define QCA_HSP_GF_SOC_ID 0x1200#define QCA_HSP_GF_SOC_MASK 0x0000ff00
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 55/356 serial: sc16is7xx: replace hardcoded divisor value with BIT() macro
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 2e57cefc4477659527f7adab1f87cdbf60ef1ae6 ]
To better show why the limit is what it is, since we have only 16 bits for the divisor.
Stable-dep-of: 8492bd91aa05 ("serial: sc16is7xx: fix bug in sc16is7xx_set_baud() when using prescaler")
--- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sc16is7xx.c +1 -1
@@ -497,7 +497,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)u8 prescaler =0 ;unsigned long clk = port->uartclk, div = clk /16 / baud; -if (div >0xffff ) { +if (div >=BIT (16 )) { prescaler =SC16IS7XX_MCR_CLKSEL_BIT ; div /=4 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 56/356 serial: sc16is7xx: fix bug in sc16is7xx_set_baud() when using prescaler
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 8492bd91aa055907c67ef04f2b56f6dadd1f44bf ]
When using a high speed clock with a low baud rate, the 4x prescaler is automatically selected if required. In that case, sc16is7xx_set_baud() properly configures the chip registers, but returns an incorrect baud rate by not taking into account the prescaler value. This incorrect baud rate is then fed to uart_update_timeout().
For example, with an input clock of 80MHz, and a selected baud rate of 50, sc16is7xx_set_baud() will return 200 instead of 50.
Fix this by first changing the prescaler variable to hold the selected prescaler value instead of the MCR bitfield. Then properly take into account the selected prescaler value in the return value computation.
Also add better documentation about the divisor value computation.
--- drivers/tty/serial/sc16is7xx.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/tty/serial/sc16is7xx.c +18 -5
@@ -490,16 +490,28 @@ static bool sc16is7xx_regmap_noinc(struct device *dev, unsigned int reg)return reg ==SC16IS7XX_RHR_REG ; } +/* +* Configure programmable baud rate generator (divisor) according to the +* desired baud rate. +* +* From the datasheet, the divisor is computed according to: +* +* XTAL1 input frequency +* ----------------------- +* prescaler +* divisor = --------------------------- +* baud-rate x sampling-rate +*/ static int sc16is7xx_set_baud (struct uart_port *port,int baud) {struct sc16is7xx_port *s =dev_get_drvdata (port->dev);u8 lcr; -u8 prescaler =0 ; +unsigned int prescaler =1 ;unsigned long clk = port->uartclk, div = clk /16 / baud;if (div >=BIT (16 )) { - prescaler =SC16IS7XX_MCR_CLKSEL_BIT ; - div /=4 ; + prescaler =4 ; + div /= prescaler; }/* In an amazing feat of design, the Enhanced Features Register shares
@@ -534,9 +546,10 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)mutex_unlock (&s->efr_lock); +/* If bit MCR_CLKSEL is set, the divide by 4 prescaler is activated. */ sc16is7xx_port_update (port,SC16IS7XX_MCR_REG ,SC16IS7XX_MCR_CLKSEL_BIT , - prescaler); + prescaler ==1 ?0 :SC16IS7XX_MCR_CLKSEL_BIT );/* Open the LCR divisors for configuration */ sc16is7xx_port_write(port, SC16IS7XX_LCR_REG,
@@ -551,7 +564,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)/* Put LCR back to the normal mode */ sc16is7xx_port_write (port,SC16IS7XX_LCR_REG , lcr); -return DIV_ROUND_CLOSEST (clk /16 , div); +return DIV_ROUND_CLOSEST ((clk / prescaler) /16 , div); } static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 57/356 x86/ibt,ftrace: Search for __fentry__ location
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit aebfd12521d9c7d0b502cf6d06314cfbcdccfe3b ]
Currently a lot of ftrace code assumes __fentry__ is at sym+0. However with Intel IBT enabled the first instruction of a function will most likely be ENDBR.
Change ftrace_location() to not only return the __fentry__ location when called for the __fentry__ location, but also when called for the sym+0 location.
Then audit/update all callsites of this function to consistently use these new semantics.
Stable-dep-of: e60b613df8b6 ("ftrace: Fix possible use-after-free issue in ftrace_location()")
--- arch/x86/kernel/kprobes/core.c | 11 ++------ kernel/bpf/trampoline.c | 20 +++----------- kernel/kprobes.c | 8 ++---- kernel/trace/ftrace.c | 48 ++++++++++++++++++++++++++++------ 4 files changed, 48 insertions(+), 39 deletions(-)
arch/x86/kernel/kprobes/core.c +2 -9
@@ -194,17 +194,10 @@ static unsigned long __recover_probed_insn(kprobe_opcode_t *buf, unsigned long addr) {struct kprobe *kp; -unsigned long faddr; +bool faddr; kp =get_kprobe ((void *)addr); - faddr =ftrace_location (addr); -/* -* Addresses inside the ftrace location are refused by -* arch_check_ftrace_location(). Something went terribly wrong -* if such an address is checked here. -*/ -if (WARN_ON (faddr && faddr != addr)) -return 0UL ; + faddr =ftrace_location (addr) == addr;/* * Use the current code if it is not modified by Kprobe * and it cannot be modified by ftrace.
kernel/bpf/trampoline.c +4 -16
@@ -108,18 +108,6 @@ static void bpf_trampoline_module_put(struct bpf_trampoline *tr) tr->mod =NULL ; } -static int is_ftrace_location (void *ip) -{ -long addr; - - addr =ftrace_location ((long )ip); -if (!addr) -return 0 ; -if (WARN_ON_ONCE (addr != (long )ip)) -return -EFAULT ; -return 1 ; -} -static int unregister_fentry (struct bpf_trampoline *tr,void *old_addr) {void *ip = tr->func.addr;
@@ -151,12 +139,12 @@ static int modify_fentry(struct bpf_trampoline *tr, void *old_addr, void *new_adstatic int register_fentry (struct bpf_trampoline *tr,void *new_addr) {void *ip = tr->func.addr; +unsigned long faddr;int ret; - ret =is_ftrace_location (ip); -if (ret <0 ) -return ret; - tr->func.ftrace_managed = ret; + faddr =ftrace_location ((unsigned long )ip); +if (faddr) + tr->func.ftrace_managed = true;if (bpf_trampoline_module_get (tr))return -ENOENT ;
kernel/kprobes.c +2 -6
@@ -1526,14 +1526,10 @@ static inline int warn_kprobe_rereg(struct kprobe *p)int __weak arch_check_ftrace_location (struct kprobe *p) { -unsigned long ftrace_addr; +unsigned long addr = (unsigned long )p->addr; - ftrace_addr =ftrace_location ((unsigned long )p->addr); -if (ftrace_addr) { +if (ftrace_location (addr) == addr) {#ifdef CONFIG_KPROBES_ON_FTRACE -/* Given address is not on the instruction boundary */ -if ((unsigned long )p->addr != ftrace_addr) -return -EILSEQ ; p->flags |=KPROBE_FLAG_FTRACE ;#else /* !CONFIG_KPROBES_ON_FTRACE */ return -EINVAL ;
kernel/trace/ftrace.c +40 -8
87 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 58/356 ftrace: Fix possible use-after-free issue in ftrace_location()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yejian <[email protected]>
[ Upstream commit e60b613df8b6253def41215402f72986fee3fc8d ]
KASAN reports a bug:
BUG: KASAN: use-after-free in ftrace_location+0x90/0x120 Read of size 8 at addr ffff888141d40010 by task insmod/424 CPU: 8 PID: 424 Comm: insmod Tainted: G W 6.9.0-rc2+ [...] Call Trace: <TASK> dump_stack_lvl+0x68/0xa0 print_report+0xcf/0x610 kasan_report+0xb5/0xe0 ftrace_location+0x90/0x120 register_kprobe+0x14b/0xa40 kprobe_init+0x2d/0xff0 [kprobe_example] do_one_initcall+0x8f/0x2d0 do_init_module+0x13a/0x3c0 load_module+0x3082/0x33d0 init_module_from_file+0xd2/0x130 __x64_sys_finit_module+0x306/0x440 do_syscall_64+0x68/0x140 entry_SYSCALL_64_after_hwframe+0x71/0x79
The root cause is that, in lookup_rec(), ftrace record of some address is being searched in ftrace pages of some module, but those ftrace pages at the same time is being freed in ftrace_release_mod() as the corresponding module is being deleted:
CPU1 | CPU2
register_kprobes() { | delete_module() {
check_kprobe_address_safe() { |
arch_check_ftrace_location() { |
ftrace_location() { |
lookup_rec() // USE! | ftrace_release_mod() // Free!To fix this issue:
1. Hold rcu lock as accessing ftrace pages in ftrace_location_range();
2. Use ftrace_location_range() instead of lookup_rec() in
ftrace_location();
3. Call synchronize_rcu() before freeing any ftrace pages both in ftrace_process_locs()/ftrace_release_mod()/ftrace_free_mem().
--- kernel/trace/ftrace.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-)
kernel/trace/ftrace.c +23 -16
@@ -1566,12 +1566,15 @@ static struct dyn_ftrace *lookup_rec(unsigned long start, unsigned long end)unsigned long ftrace_location_range (unsigned long start,unsigned long end) {struct dyn_ftrace *rec; +unsigned long ip =0 ; +rcu_read_lock (); rec =lookup_rec (start, end);if (rec) -return rec->ip; + ip = rec->ip; +rcu_read_unlock (); -return 0 ; +return ip; }/**
@@ -1584,25 +1587,22 @@ unsigned long ftrace_location_range(unsigned long start, unsigned long end)*/ unsigned long ftrace_location (unsigned long ip) { -struct dyn_ftrace *rec; +unsigned long loc;unsigned long offset;unsigned long size; - rec =lookup_rec (ip, ip); -if (!rec) { + loc =ftrace_location_range (ip, ip); +if (!loc) {if (!kallsyms_lookup_size_offset (ip, &size, &offset)) goto out;/* map sym+0 to __fentry__ */ if (!offset) - rec =lookup_rec (ip, ip + size -1 ); + loc =ftrace_location_range (ip, ip + size -1 ); } -if (rec) -return rec->ip; - out: -return 0 ; +return loc; }/**
@@ -6325,6 +6325,8 @@ static int ftrace_process_locs(struct module *mod,/* We should have used all pages unless we skipped some */ if (pg_unuse) {WARN_ON (!skipped); +/* Need to synchronize with ftrace_location_range() */ +synchronize_rcu ();ftrace_free_pages (pg_unuse); }return ret;
@@ -6507,6 +6509,9 @@ void ftrace_release_mod(struct module *mod) out_unlock:mutex_unlock (&ftrace_lock); +/* Need to synchronize with ftrace_location_range() */ +if (tmp_page) +synchronize_rcu ();for (pg = tmp_page; pg; pg = tmp_page) {/* Needs to be called outside of ftrace_lock */
@@ -6829,6 +6834,7 @@ void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr)unsigned long start = (unsigned long )(start_ptr);unsigned long end = (unsigned long )(end_ptr);struct ftrace_page **last_pg = &ftrace_pages_start; +struct ftrace_page *tmp_page =NULL ;struct ftrace_page *pg;struct dyn_ftrace *rec;struct dyn_ftrace key;
@@ -6872,12 +6878,8 @@ void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr) ftrace_update_tot_cnt--;if (!pg->index) { *last_pg = pg->next; -if (pg->records) { -free_pages ((unsigned long )pg->records, pg->order); - ftrace_number_of_pages -=1 << pg->order; - } - ftrace_number_of_groups--; -kfree (pg); + pg->next = tmp_page; + tmp_page = pg; pg = container_of(last_pg, struct ftrace_page, next);if (!(*last_pg)) ftrace_pages = pg;
@@ -6894,6 +6896,11 @@ void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr)clear_func_from_hashes (func);kfree (func); } +/* Need to synchronize with ftrace_location_range() */ +if (tmp_page) { +synchronize_rcu (); +ftrace_free_pages (tmp_page); + } }void __init ftrace_free_init_mem (void )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 59/356 mmc: davinci_mmc: Convert to platform remove callback returning void
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yangtao Li <[email protected]>
[ Upstream commit bc1711e8332da03648d8fe1950189237e66313af ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Stable-dep-of: 55c421b36448 ("mmc: davinci: Don't strip remove function when driver is builtin")
--- drivers/mmc/host/davinci_mmc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/host/davinci_mmc.c +2 -4
@@ -1347,7 +1347,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)return ret; } -static int __exit davinci_mmcsd_remove(struct platform_device *pdev) +static void __exit davinci_mmcsd_remove(struct platform_device *pdev) {struct mmc_davinci_host *host =platform_get_drvdata (pdev);
@@ -1356,8 +1356,6 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev)davinci_release_dma_channels (host);clk_disable_unprepare (host->clk);mmc_free_host (host->mmc); - -return 0 ; }#ifdef CONFIG_PM
@@ -1404,7 +1402,7 @@ static struct platform_driver davinci_mmcsd_driver = { .of_match_table = davinci_mmc_dt_ids, }, .probe = davinci_mmcsd_probe, - .remove = __exit_p(davinci_mmcsd_remove), + .remove_new = __exit_p(davinci_mmcsd_remove), .id_table = davinci_mmc_devtype, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 60/356 mmc: davinci: Dont strip remove function when driver is builtin
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 55c421b364482b61c4c45313a535e61ed5ae4ea3 ]
Using __exit for the remove function results in the remove callback being discarded with CONFIG_MMC_DAVINCI=y. When such a device gets unbound (e.g. using sysfs or hotplug), the driver is just removed without the cleanup being performed. This results in resource leaks. Fix it by compiling in the remove callback unconditionally.
This also fixes a W=1 modpost warning:
WARNING: modpost: drivers/mmc/host/davinci_mmc: section mismatch in
reference: davinci_mmcsd_driver+0x10 (section: .data) -> davinci_mmcsd_remove (section: .exit.text)
--- drivers/mmc/host/davinci_mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/davinci_mmc.c +2 -2
@@ -1347,7 +1347,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)return ret; } -static void __exit davinci_mmcsd_remove(struct platform_device *pdev) +static void davinci_mmcsd_remove (struct platform_device *pdev) {struct mmc_davinci_host *host =platform_get_drvdata (pdev);
@@ -1402,7 +1402,7 @@ static struct platform_driver davinci_mmcsd_driver = { .of_match_table = davinci_mmc_dt_ids, }, .probe = davinci_mmcsd_probe, - .remove_new = __exit_p(davinci_mmcsd_remove), + .remove_new = davinci_mmcsd_remove, .id_table = davinci_mmc_devtype, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 43/356 drm/amd/display: Fix incorrect DSC instance for MST
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hersen Wu <[email protected]>
[ Upstream commit 892b41b16f6163e6556545835abba668fcab4eea ]
[Why] DSC debugfs, such as dp_dsc_clock_en_read, use aconnector->dc_link to find pipe_ctx for display. Displays connected to MST hub share the same dc_link. DSC instance is from pipe_ctx. This causes incorrect DSC instance for display connected to MST hub.
[How] Add aconnector->sink check to find pipe_ctx.
--- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +36 -12
@@ -1316,7 +1316,9 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1417,7 +1419,9 @@ static ssize_t dp_dsc_clock_en_write(struct file *f, const char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1502,7 +1506,9 @@ static ssize_t dp_dsc_slice_width_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1601,7 +1607,9 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, const char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1686,7 +1694,9 @@ static ssize_t dp_dsc_slice_height_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1785,7 +1795,9 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, const char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1866,7 +1878,9 @@ static ssize_t dp_dsc_bits_per_pixel_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1962,7 +1976,9 @@ static ssize_t dp_dsc_bits_per_pixel_write(struct file *f, const char __user *bufor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -2041,7 +2057,9 @@ static ssize_t dp_dsc_pic_width_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -2097,7 +2115,9 @@ static ssize_t dp_dsc_pic_height_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -2168,7 +2188,9 @@ static ssize_t dp_dsc_chunk_size_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -2239,7 +2261,9 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 61/356 i2c: add fwnode APIs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <[email protected]>
[ Upstream commit 373c612d72461ddaea223592df31e62c934aae61 ]
Add fwnode APIs for finding and getting I2C adapters, which will be used by the SFP code. These are passed the fwnode corresponding to the adapter, and return the I2C adapter. It is the responsibility of the caller to find the appropriate fwnode.
We keep the DT and ACPI interfaces, but where appropriate, recode them to use the fwnode interfaces internally.
Stable-dep-of: 3f858bbf04db ("i2c: acpi: Unbind mux adapters before delete")
--- drivers/i2c/i2c-core-acpi.c | 13 +---- drivers/i2c/i2c-core-base.c | 98 +++++++++++++++++++++++++++++++++++++ drivers/i2c/i2c-core-of.c | 66 ------------------------- include/linux/i2c.h | 24 +++++++-- 4 files changed, 120 insertions(+), 81 deletions(-)
drivers/i2c/i2c-core-acpi.c +1 -12
@@ -421,18 +421,7 @@ EXPORT_SYMBOL_GPL(i2c_acpi_find_adapter_by_handle);static struct i2c_client *i2c_acpi_find_client_by_adev (struct acpi_device *adev) { -struct device *dev; -struct i2c_client *client; - - dev =bus_find_device_by_acpi_dev (&i2c_bus_type, adev); -if (!dev) -return NULL ; - - client =i2c_verify_client (dev); -if (!client) -put_device (dev); - -return client; +return i2c_find_device_by_fwnode (acpi_fwnode_handle (adev)); } static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,
drivers/i2c/i2c-core-base.c +98 -0
110 lines not on this page · raw message
drivers/i2c/i2c-core-of.c +0 -66
72 lines not on this page · raw message
include/linux/i2c.h +21 -3
@@ -954,15 +954,33 @@ int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr);#endif /* I2C */ +/* must call put_device() when done with returned i2c_client device */ +struct i2c_client *i2c_find_device_by_fwnode (struct fwnode_handle *fwnode); + +/* must call put_device() when done with returned i2c_adapter device */ +struct i2c_adapter *i2c_find_adapter_by_fwnode (struct fwnode_handle *fwnode); + +/* must call i2c_put_adapter() when done with returned i2c_adapter device */ +struct i2c_adapter *i2c_get_adapter_by_fwnode (struct fwnode_handle *fwnode); +#if IS_ENABLED (CONFIG_OF )/* must call put_device() when done with returned i2c_client device */ -struct i2c_client *of_find_i2c_device_by_node (struct device_node *node); +static inline struct i2c_client *of_find_i2c_device_by_node (struct device_node *node) +{ +return i2c_find_device_by_fwnode (of_fwnode_handle (node)); +}/* must call put_device() when done with returned i2c_adapter device */ -struct i2c_adapter *of_find_i2c_adapter_by_node (struct device_node *node); +static inline struct i2c_adapter *of_find_i2c_adapter_by_node (struct device_node *node) +{ +return i2c_find_adapter_by_fwnode (of_fwnode_handle (node)); +}/* must call i2c_put_adapter() when done with returned i2c_adapter device */ -struct i2c_adapter *of_get_i2c_adapter_by_node (struct device_node *node); +static inline struct i2c_adapter *of_get_i2c_adapter_by_node (struct device_node *node) +{ +return i2c_get_adapter_by_fwnode (of_fwnode_handle (node)); +}const struct of_device_id *i2c_of_match_device(const struct of_device_id *matches,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 62/356 i2c: acpi: Unbind mux adapters before delete
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hamish Martin <[email protected]>
[ Upstream commit 3f858bbf04dbac934ac279aaee05d49eb9910051 ]
There is an issue with ACPI overlay table removal specifically related to I2C multiplexers.
Consider an ACPI SSDT Overlay that defines a PCA9548 I2C mux on an existing I2C bus. When this table is loaded we see the creation of a device for the overall PCA9548 chip and 8 further devices - one i2c_adapter each for the mux channels. These are all bound to their ACPI equivalents via an eventual invocation of acpi_bind_one().
When we unload the SSDT overlay we run into the problem. The ACPI devices are deleted as normal via acpi_device_del_work_fn() and the acpi_device_del_list.
However, the following warning and stack trace is output as the deletion does not go smoothly:
------------[ cut here ]------------ kernfs: can not remove 'physical_node', no directory WARNING: CPU: 1 PID: 11 at fs/kernfs/dir.c:1674 kernfs_remove_by_name_ns+0xb9/0xc0 Modules linked in: CPU: 1 PID: 11 Comm: kworker/u128:0 Not tainted 6.8.0-rc6+ #1 Hardware name: congatec AG conga-B7E3/conga-B7E3, BIOS 5.13 05/16/2023 Workqueue: kacpi_hotplug acpi_device_del_work_fn RIP: 0010:kernfs_remove_by_name_ns+0xb9/0xc0 Code: e4 00 48 89 ef e8 07 71 db ff 5b b8 fe ff ff ff 5d 41 5c 41 5d e9 a7 55 e4 00 0f 0b eb a6 48 c7 c7 f0 38 0d 9d e8 97 0a d5 ff <0f> 0b eb dc 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 0018:ffff9f864008fb28 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff8ef90a8d4940 RCX: 0000000000000000 RDX: ffff8f000e267d10 RSI: ffff8f000e25c780 RDI: ffff8f000e25c780 RBP: ffff8ef9186f9870 R08: 0000000000013ffb R09: 00000000ffffbfff R10: 00000000ffffbfff R11: ffff8f000e0a0000 R12: ffff9f864008fb50 R13: ffff8ef90c93dd60 R14: ffff8ef9010d0958 R15: ffff8ef9186f98c8 FS: 0000000000000000(0000) GS:ffff8f000e240000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f48f5253a08 CR3: 00000003cb82e000 CR4: 00000000003506f0 Call Trace: <TASK> ? kernfs_remove_by_name_ns+0xb9/0xc0 ? __warn+0x7c/0x130 ? kernfs_remove_by_name_ns+0xb9/0xc0 ? report_bug+0x171/0x1a0 ? handle_bug+0x3c/0x70 ? exc_invalid_op+0x17/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? kernfs_remove_by_name_ns+0xb9/0xc0 ? kernfs_remove_by_name_ns+0xb9/0xc0 acpi_unbind_one+0x108/0x180 device_del+0x18b/0x490 ? srso_return_thunk+0x5/0x5f ? srso_return_thunk+0x5/0x5f device_unregister+0xd/0x30 i2c_del_adapter.part.0+0x1bf/0x250 i2c_mux_del_adapters+0xa1/0xe0 i2c_device_remove+0x1e/0x80 device_release_driver_internal+0x19a/0x200 bus_remove_device+0xbf/0x100 device_del+0x157/0x490 ? __pfx_device_match_fwnode+0x10/0x10 ? srso_return_thunk+0x5/0x5f device_unregister+0xd/0x30 i2c_acpi_notify+0x10f/0x140 notifier_call_chain+0x58/0xd0 blocking_notifier_call_chain+0x3a/0x60 acpi_device_del_work_fn+0x85/0x1d0 process_one_work+0x134/0x2f0 worker_thread+0x2f0/0x410 ? __pfx_worker_thread+0x10/0x10 kthread+0xe3/0x110 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x2f/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1b/0x30 </TASK> ---[ end trace 0000000000000000 ]---
...
repeated 7 more times, 1 for each channel of the mux
...
The issue is that the binding of the ACPI devices to their peer I2C adapters is not correctly cleaned up. Digging deeper into the issue we see that the deletion order is such that the ACPI devices matching the mux channel i2c adapters are deleted first during the SSDT overlay removal. For each of the channels we see a call to i2c_acpi_notify() with ACPI_RECONFIG_DEVICE_REMOVE but, because these devices are not actually i2c_clients, nothing is done for them.
Later on, after each of the mux channels has been dealt with, we come to delete the i2c_client representing the PCA9548 device. This is the call stack we see above, whereby the kernel cleans up the i2c_client including destruction of the mux and its channel adapters. At this point we do attempt to unbind from the ACPI peers but those peers no longer exist and so we hit the kernfs errors.
The fix is to augment i2c_acpi_notify() to handle i2c_adapters. But, given that the life cycle of the adapters is linked to the i2c_client, instead of deleting the i2c_adapters during the i2c_acpi_notify(), we just trigger unbinding of the ACPI device from the adapter device, and allow the clean up of the adapter to continue in the way it always has.
--- drivers/i2c/i2c-core-acpi.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/i2c/i2c-core-acpi.c +15 -4
@@ -424,6 +424,11 @@ static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev)return i2c_find_device_by_fwnode (acpi_fwnode_handle (adev)); } +static struct i2c_adapter *i2c_acpi_find_adapter_by_adev (struct acpi_device *adev) +{ +return i2c_find_adapter_by_fwnode (acpi_fwnode_handle (adev)); +} +static int i2c_acpi_notify (struct notifier_block *nb,unsigned long value,void *arg) {
@@ -450,11 +455,17 @@ static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,break ; client =i2c_acpi_find_client_by_adev (adev); -if (!client) -break ; +if (client) { +i2c_unregister_device (client); +put_device (&client->dev); + } + + adapter =i2c_acpi_find_adapter_by_adev (adev); +if (adapter) { +acpi_unbind_one (&adapter->dev); +put_device (&adapter->dev); + } -i2c_unregister_device (client); -put_device (&client->dev);break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 63/356 cma: factor out minimum alignment requirement
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit e16faf26780fc0c8dd693ea9ee8420a7706cb2f5 ]
Patch series "mm: enforce pageblock_order < MAX_ORDER".
Having pageblock_order >= MAX_ORDER seems to be able to happen in corner cases and some parts of the kernel are not prepared for it.
For example, Aneesh has shown [1] that such kernels can be compiled on ppc64 with 64k base pages by setting FORCE_MAX_ZONEORDER=8, which will run into a WARN_ON_ONCE(order >= MAX_ORDER) in comapction code right during boot.
We can get pageblock_order >= MAX_ORDER when the default hugetlb size is bigger than the maximum allocation granularity of the buddy, in which case we are no longer talking about huge pages but instead gigantic pages.
Having pageblock_order >= MAX_ORDER can only make alloc_contig_range() of such gigantic pages more likely to succeed.
Reliable use of gigantic pages either requires boot time allcoation or CMA, no need to overcomplicate some places in the kernel to optimize for corner cases that are broken in other areas of the kernel.
This patch (of 2):
Let's enforce pageblock_order < MAX_ORDER and simplify.
Especially patch #1 can be regarded a cleanup before:
[PATCH v5 0/6] Use pageblock_order for cma and alloc_contig_range alignment. [2]
[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]
Stable-dep-of: b174f139bdc8 ("mm/cma: drop incorrect alignment check in cma_init_reserved_mem")
--- arch/powerpc/include/asm/fadump-internal.h | 5 ----- arch/powerpc/kernel/fadump.c | 2 +- drivers/of/of_reserved_mem.c | 9 +++------ include/linux/cma.h | 9 +++++++++ kernel/dma/contiguous.c | 4 +--- mm/cma.c | 20 +++++--------------- 6 files changed, 19 insertions(+), 30 deletions(-)
arch/powerpc/include/asm/fadump-internal.h +0 -5
@@ -19,11 +19,6 @@#define memblock_num_regions (memblock_type) (memblock.memblock_type.cnt) -/* Alignment per CMA requirement. */ -#define FADUMP_CMA_ALIGNMENT (PAGE_SIZE << \ - max_t(unsigned long, MAX_ORDER - 1, \ - pageblock_order)) -/* FAD commands */ #define FADUMP_REGISTER 1#define FADUMP_UNREGISTER 2
arch/powerpc/kernel/fadump.c +1 -1
@@ -544,7 +544,7 @@ int __init fadump_reserve_mem(void)if (!fw_dump.nocma) { fw_dump.boot_memory_size =ALIGN (fw_dump.boot_memory_size, -FADUMP_CMA_ALIGNMENT ); +CMA_MIN_ALIGNMENT_BYTES ); }#endif
drivers/of/of_reserved_mem.c +3 -6
@@ -22,6 +22,7 @@#include <linux/slab.h> #include <linux/memblock.h> #include <linux/kmemleak.h> +#include <linux/cma.h> #include "of_private.h"
@@ -117,12 +118,8 @@ static int __init __reserved_mem_alloc_size(unsigned long node,if (IS_ENABLED (CONFIG_CMA ) &&of_flat_dt_is_compatible (node,"shared-dma-pool" ) &&of_get_flat_dt_prop (node,"reusable" ,NULL ) - && !nomap) { -unsigned long order = - max_t(unsigned long, MAX_ORDER - 1, pageblock_order); - - align =max (align, (phys_addr_t )PAGE_SIZE << order); - } + && !nomap) + align =max_t (phys_addr_t, align,CMA_MIN_ALIGNMENT_BYTES ); prop =of_get_flat_dt_prop (node,"alloc-ranges" , &len);if (prop) {
include/linux/cma.h +9 -0
@@ -20,6 +20,15 @@#define CMA_MAX_NAME 64 +/* +* TODO: once the buddy -- especially pageblock merging and alloc_contig_range() +* -- can deal with only some pageblocks of a higher-order page being +* MIGRATE_CMA, we can use pageblock_nr_pages. +*/ +#define CMA_MIN_ALIGNMENT_PAGES max_t(phys_addr_t, MAX_ORDER_NR_PAGES, \ + pageblock_nr_pages) +#define CMA_MIN_ALIGNMENT_BYTES (PAGE_SIZE * CMA_MIN_ALIGNMENT_PAGES) +struct cma ;extern unsigned long totalcma_pages;
kernel/dma/contiguous.c +1 -3
@@ -399,8 +399,6 @@ static const struct reserved_mem_ops rmem_cma_ops = {static int __init rmem_cma_setup (struct reserved_mem *rmem) { -phys_addr_t align =PAGE_SIZE <<max (MAX_ORDER -1 , pageblock_order); -phys_addr_t mask = align -1 ;unsigned long node = rmem->fdt_node;bool default_cma =of_get_flat_dt_prop (node,"linux,cma-default" ,NULL );struct cma *cma;
@@ -416,7 +414,7 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem) of_get_flat_dt_prop(node, "no-map", NULL))return -EINVAL ; -if ((rmem->base & mask) || (rmem->size & mask)) { +if (!IS_ALIGNED (rmem->base | rmem->size,CMA_MIN_ALIGNMENT_BYTES )) {pr_err ("Reserved memory: incorrect alignment of CMA region\n" );return -EINVAL ; }
mm/cma.c +5 -15
@@ -169,7 +169,6 @@ int __init cma_init_reserved_mem(phys_addr_t base, phys_addr_t size, struct cma **res_cma) {struct cma *cma; -phys_addr_t alignment;/* Sanity checks */ if (cma_area_count ==ARRAY_SIZE (cma_areas)) {
@@ -180,15 +179,12 @@ int __init cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,if (!size || !memblock_is_region_reserved (base, size))return -EINVAL ; -/* ensure minimal alignment required by mm core */ - alignment =PAGE_SIZE << - max_t(unsigned long, MAX_ORDER - 1, pageblock_order); -/* alignment should be aligned with order_per_bit */ -if (!IS_ALIGNED (alignment >>PAGE_SHIFT ,1 << order_per_bit)) +if (!IS_ALIGNED (CMA_MIN_ALIGNMENT_PAGES ,1 << order_per_bit))return -EINVAL ; -if (ALIGN (base, alignment) != base ||ALIGN (size, alignment) != size) +/* ensure minimal alignment required by mm core */ +if (!IS_ALIGNED (base | size,CMA_MIN_ALIGNMENT_BYTES ))return -EINVAL ;/*
@@ -263,14 +259,8 @@ int __init cma_declare_contiguous_nid(phys_addr_t base,if (alignment && !is_power_of_2 (alignment))return -EINVAL ; -/* -* Sanitise input arguments. -* Pages both ends in CMA area could be merged into adjacent unmovable -* migratetype page by page allocator's buddy algorithm. In the case, -* you couldn't get a contiguous memory, which is not what we want. -*/ - alignment =max (alignment, (phys_addr_t )PAGE_SIZE << - max_t(unsigned long, MAX_ORDER - 1, pageblock_order)); +/* Sanitise input arguments. */ + alignment =max_t (phys_addr_t, alignment,CMA_MIN_ALIGNMENT_BYTES );if (fixed && base & (alignment -1 )) { ret = -EINVAL ; pr_err("Region at %pa must be aligned to %pa bytes\n",
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 64/356 mm/cma: drop incorrect alignment check in cma_init_reserved_mem
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank van der Linden <[email protected]>
[ Upstream commit b174f139bdc8aaaf72f5b67ad1bd512c4868a87e ]
cma_init_reserved_mem uses IS_ALIGNED to check if the size represented by one bit in the cma allocation bitmask is aligned with CMA_MIN_ALIGNMENT_BYTES (pageblock size).
However, this is too strict, as this will fail if order_per_bit > pageblock_order, which is a valid configuration.
We could check IS_ALIGNED both ways, but since both numbers are powers of two, no check is needed at all.
--- mm/cma.c | 4 ---- 1 file changed, 4 deletions(-)
mm/cma.c +0 -4
@@ -179,10 +179,6 @@ int __init cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,if (!size || !memblock_is_region_reserved (base, size))return -EINVAL ; -/* alignment should be aligned with order_per_bit */ -if (!IS_ALIGNED (CMA_MIN_ALIGNMENT_PAGES ,1 << order_per_bit)) -return -EINVAL ; -/* ensure minimal alignment required by mm core */ if (!IS_ALIGNED (base | size,CMA_MIN_ALIGNMENT_BYTES ))return -EINVAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 65/356 selftests/mm: compaction_test: fix incorrect write of zero to nr_hugepages
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dev Jain <[email protected]>
[ Upstream commit 9ad665ef55eaad1ead1406a58a34f615a7c18b5e ]
Currently, the test tries to set nr_hugepages to zero, but that is not actually done because the file offset is not reset after read(). Fix that using lseek().
--- tools/testing/selftests/vm/compaction_test.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/vm/compaction_test.c +2 -0
@@ -103,6 +103,8 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size) goto close_fd; } +lseek (fd,0 ,SEEK_SET ); +/* Start with the initial condition of 0 huge pages*/ if (write (fd,"0" ,sizeof (char )) !=sizeof (char )) {perror ("Failed to write 0 to /proc/sys/vm/nr_hugepages\n" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 66/356 selftests/mm: conform test to TAP format output
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 9a21701edc41465de56f97914741bfb7bfc2517d ]
Conform the layout, informational and status messages to TAP. No functional change is intended other than the layout of output messages.
Stable-dep-of: d4202e66a4b1 ("selftests/mm: compaction_test: fix bogus test success on Aarch64")
--- tools/testing/selftests/vm/compaction_test.c | 91 ++++++++++---------- 1 file changed, 44 insertions(+), 47 deletions(-)
tools/testing/selftests/vm/compaction_test.c +44 -47
@@ -33,7 +33,7 @@ int read_memory_info(unsigned long *memfree, unsigned long *hugepagesize)FILE *cmdfile =popen (cmd,"r" );if (!(fgets (buffer,sizeof (buffer), cmdfile))) { -perror ("Failed to read meminfo\n" ); +ksft_print_msg ("Failed to read meminfo: %s\n" ,strerror (errno));return -1 ; }
@@ -44,7 +44,7 @@ int read_memory_info(unsigned long *memfree, unsigned long *hugepagesize) cmdfile =popen (cmd,"r" );if (!(fgets (buffer,sizeof (buffer), cmdfile))) { -perror ("Failed to read meminfo\n" ); +ksft_print_msg ("Failed to read meminfo: %s\n" ,strerror (errno));return -1 ; }
@@ -62,14 +62,14 @@ int prereq(void) fd =open ("/proc/sys/vm/compact_unevictable_allowed" ,O_RDONLY |O_NONBLOCK );if (fd <0 ) { -perror ("Failed to open\n" -"/proc/sys/vm/compact_unevictable_allowed\n" ); +ksft_print_msg ("Failed to open /proc/sys/vm/compact_unevictable_allowed: %s\n" , +strerror (errno));return -1 ; }if (read (fd, &allowed,sizeof (char )) !=sizeof (char )) { -perror ("Failed to read from\n" -"/proc/sys/vm/compact_unevictable_allowed\n" ); +ksft_print_msg ("Failed to read from /proc/sys/vm/compact_unevictable_allowed: %s\n" , +strerror (errno));close (fd);return -1 ; }
@@ -78,12 +78,13 @@ int prereq(void)if (allowed =='1' )return 0 ; +ksft_print_msg ("Compaction isn't allowed\n" );return -1 ; }int check_compaction (unsigned long mem_free,unsigned int hugepage_size) { -int fd; +int fd, ret =-1 ;int compaction_index =0 ;char initial_nr_hugepages[10 ] = {0 };char nr_hugepages[10 ] = {0 };
@@ -94,12 +95,14 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size) fd =open ("/proc/sys/vm/nr_hugepages" ,O_RDWR |O_NONBLOCK );if (fd <0 ) { -perror ("Failed to open /proc/sys/vm/nr_hugepages" ); +ksft_test_result_fail ("Failed to open /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno));return -1 ; }if (read (fd, initial_nr_hugepages,sizeof (initial_nr_hugepages)) <=0 ) { -perror ("Failed to read from /proc/sys/vm/nr_hugepages" ); +ksft_test_result_fail ("Failed to read from /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); goto close_fd; }
@@ -107,7 +110,8 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)/* Start with the initial condition of 0 huge pages*/ if (write (fd,"0" ,sizeof (char )) !=sizeof (char )) { -perror ("Failed to write 0 to /proc/sys/vm/nr_hugepages\n" ); +ksft_test_result_fail ("Failed to write 0 to /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); goto close_fd; }
@@ -116,14 +120,16 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)/* Request a large number of huge pages. The Kernel will allocate as much as it can */ if (write (fd,"100000" , (6 *sizeof (char ))) != (6 *sizeof (char ))) { -perror ("Failed to write 100000 to /proc/sys/vm/nr_hugepages\n" ); +ksft_test_result_fail ("Failed to write 100000 to /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); goto close_fd; }lseek (fd,0 ,SEEK_SET );if (read (fd, nr_hugepages,sizeof (nr_hugepages)) <=0 ) { -perror ("Failed to re-read from /proc/sys/vm/nr_hugepages\n" ); +ksft_test_result_fail ("Failed to re-read from /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); goto close_fd; }
@@ -131,67 +137,58 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)huge pages */ compaction_index = mem_free/(atoi (nr_hugepages) * hugepage_size); -if (compaction_index >3 ) { -printf ("No of huge pages allocated = %d\n" , - (atoi (nr_hugepages))); -fprintf (stderr,"ERROR: Less that 1/%d of memory is available\n" -"as huge pages\n" , compaction_index); - goto close_fd; - } - -printf ("No of huge pages allocated = %d\n" , - (atoi (nr_hugepages))); -lseek (fd,0 ,SEEK_SET );if (write (fd, initial_nr_hugepages,strlen (initial_nr_hugepages)) !=strlen (initial_nr_hugepages)) { -perror ("Failed to write value to /proc/sys/vm/nr_hugepages\n" ); +ksft_test_result_fail ("Failed to write value to /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); goto close_fd; } -close (fd); -return 0 ; +if (compaction_index >3 ) { +ksft_print_msg ("ERROR: Less that 1/%d of memory is available\n" +"as huge pages\n" , compaction_index); +ksft_test_result_fail ("No of huge pages allocated = %d\n" , (atoi (nr_hugepages))); + goto close_fd; + } + +ksft_test_result_pass ("Memory compaction succeeded. No of huge pages allocated = %d\n" , + (atoi (nr_hugepages))); + ret =0 ; close_fd:close (fd); -printf ("Not OK. Compaction test failed." ); -return -1 ; +return ret; }int main (int argc,char **argv) {struct rlimit lim; -struct map_list *list, *entry; +struct map_list *list =NULL , *entry;size_t page_size, i;void *map =NULL ;unsigned long mem_free =0 ;unsigned long hugepage_size =0 ;long mem_fragmentable_MB =0 ; -if (prereq () !=0 ) { -printf ("Either the sysctl compact_unevictable_allowed is not\n" -"set to 1 or couldn't read the proc file.\n" -"Skipping the test\n" ); -return KSFT_SKIP ; - } +ksft_print_header (); + +if (prereq () !=0 ) +return ksft_exit_pass (); + +ksft_set_plan (1 ); lim.rlim_cur =RLIM_INFINITY ; lim.rlim_max =RLIM_INFINITY ; -if (setrlimit (RLIMIT_MEMLOCK , &lim)) { -perror ("Failed to set rlimit:\n" ); -return -1 ; - } +if (setrlimit (RLIMIT_MEMLOCK , &lim)) +ksft_exit_fail_msg ("Failed to set rlimit: %s\n" ,strerror (errno)); page_size =getpagesize (); - list =NULL ; - -if (read_memory_info (&mem_free, &hugepage_size) !=0 ) { -printf ("ERROR: Cannot read meminfo\n" ); -return -1 ; - } +if (read_memory_info (&mem_free, &hugepage_size) !=0 ) +ksft_exit_fail_msg ("Failed to get meminfo\n" ); mem_fragmentable_MB = mem_free *0.8 /1024 ;
@@ -227,7 +224,7 @@ int main(int argc, char **argv) }if (check_compaction (mem_free, hugepage_size) ==0 ) -return 0 ; +return ksft_exit_pass (); -return -1 ; +return ksft_exit_fail (); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 67/356 selftests/mm: log a consistent test name for check_compaction
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit f3b7568c49420d2dcd251032c9ca1e069ec8a6c9 ]
Every test result report in the compaction test prints a distinct log messae, and some of the reports print a name that varies at runtime. This causes problems for automation since a lot of automation software uses the printed string as the name of the test, if the name varies from run to run and from pass to fail then the automation software can't identify that a test changed result or that the same tests are being run.
Refactor the logging to use a consistent name when printing the result of the test, printing the existing messages as diagnostic information instead so they are still available for people trying to interpret the results.
Stable-dep-of: d4202e66a4b1 ("selftests/mm: compaction_test: fix bogus test success on Aarch64")
--- tools/testing/selftests/vm/compaction_test.c | 35 +++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-)
tools/testing/selftests/vm/compaction_test.c +19 -16
@@ -95,14 +95,15 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size) fd =open ("/proc/sys/vm/nr_hugepages" ,O_RDWR |O_NONBLOCK );if (fd <0 ) { -ksft_test_result_fail ("Failed to open /proc/sys/vm/nr_hugepages: %s\n" , -strerror (errno)); -return -1 ; +ksft_print_msg ("Failed to open /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); + ret =-1 ; + goto out; }if (read (fd, initial_nr_hugepages,sizeof (initial_nr_hugepages)) <=0 ) { -ksft_test_result_fail ("Failed to read from /proc/sys/vm/nr_hugepages: %s\n" , -strerror (errno)); +ksft_print_msg ("Failed to read from /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); goto close_fd; }
@@ -110,8 +111,8 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)/* Start with the initial condition of 0 huge pages*/ if (write (fd,"0" ,sizeof (char )) !=sizeof (char )) { -ksft_test_result_fail ("Failed to write 0 to /proc/sys/vm/nr_hugepages: %s\n" , -strerror (errno)); +ksft_print_msg ("Failed to write 0 to /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); goto close_fd; }
@@ -120,16 +121,16 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)/* Request a large number of huge pages. The Kernel will allocate as much as it can */ if (write (fd,"100000" , (6 *sizeof (char ))) != (6 *sizeof (char ))) { -ksft_test_result_fail ("Failed to write 100000 to /proc/sys/vm/nr_hugepages: %s\n" , -strerror (errno)); +ksft_print_msg ("Failed to write 100000 to /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); goto close_fd; }lseek (fd,0 ,SEEK_SET );if (read (fd, nr_hugepages,sizeof (nr_hugepages)) <=0 ) { -ksft_test_result_fail ("Failed to re-read from /proc/sys/vm/nr_hugepages: %s\n" , -strerror (errno)); +ksft_print_msg ("Failed to re-read from /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); goto close_fd; }
@@ -141,24 +142,26 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)if (write (fd, initial_nr_hugepages,strlen (initial_nr_hugepages)) !=strlen (initial_nr_hugepages)) { -ksft_test_result_fail ("Failed to write value to /proc/sys/vm/nr_hugepages: %s\n" , -strerror (errno)); +ksft_print_msg ("Failed to write value to /proc/sys/vm/nr_hugepages: %s\n" , +strerror (errno)); goto close_fd; } +ksft_print_msg ("Number of huge pages allocated = %d\n" , +atoi (nr_hugepages)); +if (compaction_index >3 ) {ksft_print_msg ("ERROR: Less that 1/%d of memory is available\n" "as huge pages\n" , compaction_index); -ksft_test_result_fail ("No of huge pages allocated = %d\n" , (atoi (nr_hugepages))); goto close_fd; } -ksft_test_result_pass ("Memory compaction succeeded. No of huge pages allocated = %d\n" , - (atoi (nr_hugepages))); ret =0 ; close_fd:close (fd); + out: +ksft_test_result (ret ==0 ,"check_compaction\n" );return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 68/356 selftests/mm: compaction_test: fix bogus test success on Aarch64
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dev Jain <[email protected]>
[ Upstream commit d4202e66a4b1fe6968f17f9f09bbc30d08f028a1 ]
Patch series "Fixes for compaction_test", v2.
The compaction_test memory selftest introduces fragmentation in memory and then tries to allocate as many hugepages as possible. This series addresses some problems.
On Aarch64, if nr_hugepages == 0, then the test trivially succeeds since compaction_index becomes 0, which is less than 3, due to no division by zero exception being raised. We fix that by checking for division by zero.
Secondly, correctly set the number of hugepages to zero before trying to set a large number of them.
Now, consider a situation in which, at the start of the test, a non-zero number of hugepages have been already set (while running the entire selftests/mm suite, or manually by the admin). The test operates on 80% of memory to avoid OOM-killer invocation, and because some memory is already blocked by hugepages, it would increase the chance of OOM-killing. Also, since mem_free used in check_compaction() is the value before we set nr_hugepages to zero, the chance that the compaction_index will be small is very high if the preset nr_hugepages was high, leading to a bogus test success.
This patch (of 3):
Currently, if at runtime we are not able to allocate a huge page, the test will trivially pass on Aarch64 due to no exception being raised on division by zero while computing compaction_index. Fix that by checking for nr_hugepages == 0. Anyways, in general, avoid a division by zero by exiting the program beforehand. While at it, fix a typo, and handle the case where the number of hugepages may overflow an integer.
--- tools/testing/selftests/vm/compaction_test.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
tools/testing/selftests/vm/compaction_test.c +13 -7
@@ -82,12 +82,13 @@ int prereq(void)return -1 ; } -int check_compaction (unsigned long mem_free,unsigned int hugepage_size) +int check_compaction (unsigned long mem_free,unsigned long hugepage_size) { +unsigned long nr_hugepages_ul;int fd, ret =-1 ;int compaction_index =0 ; -char initial_nr_hugepages[10 ] = {0 }; -char nr_hugepages[10 ] = {0 }; +char initial_nr_hugepages[20 ] = {0 }; +char nr_hugepages[20 ] = {0 };/* We want to test with 80% of available memory. Else, OOM killer comes in to play */
@@ -136,7 +137,12 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)/* We should have been able to request at least 1/3 rd of the memory in huge pages */ - compaction_index = mem_free/(atoi (nr_hugepages) * hugepage_size); + nr_hugepages_ul =strtoul (nr_hugepages,NULL ,10 ); +if (!nr_hugepages_ul) { +ksft_print_msg ("ERROR: No memory is available as huge pages\n" ); + goto close_fd; + } + compaction_index = mem_free/(nr_hugepages_ul * hugepage_size);lseek (fd,0 ,SEEK_SET );
@@ -147,11 +153,11 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size) goto close_fd; } -ksft_print_msg ("Number of huge pages allocated = %d\n" , -atoi (nr_hugepages)); +ksft_print_msg ("Number of huge pages allocated = %lu\n" , + nr_hugepages_ul);if (compaction_index >3 ) { -ksft_print_msg ("ERROR: Less that 1/%d of memory is available\n" +ksft_print_msg ("ERROR: Less than 1/%d of memory is available\n" "as huge pages\n" , compaction_index); goto close_fd; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 69/356 wifi: ath10k: fix QCOM_RPROC_COMMON dependency
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 21ae74e1bf18331ae5e279bd96304b3630828009 ]
If ath10k_snoc is built-in, while Qualcomm remoteprocs are built as modules, compilation fails with:
/usr/bin/aarch64-linux-gnu-ld: drivers/net/wireless/ath/ath10k/snoc.o: in function `ath10k_modem_init':drivers/net/wireless/ath/ath10k/snoc.c:1534: undefined reference to qcom_register_ssr_notifier' /usr/bin/aarch64-linux-gnu-ld: drivers/net/wireless/ath/ath10k/snoc.o: in function ath10k_modem_deinit':drivers/net/wireless/ath/ath10k/snoc.c:1551: undefined reference to `qcom_unregister_ssr_notifier'
Add corresponding dependency to ATH10K_SNOC Kconfig entry so that it's built as module if QCOM_RPROC_COMMON is built as module too.
--- drivers/net/wireless/ath/ath10k/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath10k/Kconfig +1 -0
@@ -44,6 +44,7 @@ config ATH10K_SNOC tristate "Qualcomm ath10k SNOC support" depends on ATH10K depends on ARCH_QCOM || COMPILE_TEST + depends on QCOM_RPROC_COMMON || QCOM_RPROC_COMMON=n select QCOM_SCM select QCOM_QMI_HELPERS help
Greg Kroah-Hartman
maintainerPATCH 70/356 btrfs: fix leak of qgroup extent records after transaction abort
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit fb33eb2ef0d88e75564983ef057b44c5b7e4fded ]
Qgroup extent records are created when delayed ref heads are created and then released after accounting extents at btrfs_qgroup_account_extents(), called during the transaction commit path.
If a transaction is aborted we free the qgroup records by calling btrfs_qgroup_destroy_extent_records() at btrfs_destroy_delayed_refs(), unless we don't have delayed references. We are incorrectly assuming that no delayed references means we don't have qgroup extents records.
We can currently have no delayed references because we ran them all during a transaction commit and the transaction was aborted after that due to some error in the commit path.
So fix this by ensuring we btrfs_qgroup_destroy_extent_records() at btrfs_destroy_delayed_refs() even if we don't have any delayed references.
--- fs/btrfs/disk-io.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
fs/btrfs/disk-io.c +1 -9
@@ -4707,19 +4707,11 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, struct btrfs_fs_info *fs_info) {struct rb_node *node; -struct btrfs_delayed_ref_root *delayed_refs; +struct btrfs_delayed_ref_root *delayed_refs = &trans->delayed_refs;struct btrfs_delayed_ref_node *ref;int ret =0 ; - delayed_refs = &trans->delayed_refs; -spin_lock (&delayed_refs->lock); -if (atomic_read (&delayed_refs->num_entries) ==0 ) { -spin_unlock (&delayed_refs->lock); -btrfs_debug (fs_info,"delayed_refs has NO entry" ); -return ret; - } -while ((node =rb_first_cached (&delayed_refs->href_root)) !=NULL ) {struct btrfs_delayed_ref_head *head;struct rb_node *n;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 44/356 pvpanic: Keep single style across modules
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 33a430419456991480cde9d8889e5a27f6049df4 ]
We have different style on where we place module_*() and MODULE_*() macros. Inherit the style from the original module (now pvpanic-mmio.c).
Stable-dep-of: ee59be35d7a8 ("misc/pvpanic-pci: register attributes via pci_driver")
--- drivers/misc/pvpanic/pvpanic-pci.c | 14 ++++++-------- drivers/misc/pvpanic/pvpanic.c | 3 +-- 2 files changed, 7 insertions(+), 10 deletions(-)
drivers/misc/pvpanic/pvpanic-pci.c +6 -8
@@ -22,11 +22,6 @@ MODULE_AUTHOR("Mihai Carabas <[email protected]>");MODULE_DESCRIPTION ("pvpanic device driver " );MODULE_LICENSE ("GPL" ); -static const struct pci_device_id pvpanic_pci_id_tbl[] = { - {PCI_DEVICE (PCI_VENDOR_ID_REDHAT ,PCI_DEVICE_ID_REDHAT_PVPANIC )}, - {} -}; -static ssize_t capability_show (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -99,6 +94,12 @@ static int pvpanic_pci_probe(struct pci_dev *pdev,return devm_pvpanic_probe (&pdev->dev, pi); } +static const struct pci_device_id pvpanic_pci_id_tbl[] = { + {PCI_DEVICE (PCI_VENDOR_ID_REDHAT ,PCI_DEVICE_ID_REDHAT_PVPANIC )}, + {} +}; +MODULE_DEVICE_TABLE (pci, pvpanic_pci_id_tbl); +static struct pci_driver pvpanic_pci_driver = { .name ="pvpanic-pci" , .id_table = pvpanic_pci_id_tbl,
@@ -107,7 +108,4 @@ static struct pci_driver pvpanic_pci_driver = { .dev_groups = pvpanic_pci_dev_groups, }, }; - -MODULE_DEVICE_TABLE (pci, pvpanic_pci_id_tbl); -module_pci_driver (pvpanic_pci_driver);
drivers/misc/pvpanic/pvpanic.c +1 -2
@@ -107,6 +107,7 @@ static int pvpanic_init(void)return 0 ; } +module_init (pvpanic_init);static void pvpanic_exit (void ) {
@@ -114,6 +115,4 @@ static void pvpanic_exit(void) &pvpanic_panic_nb); } - -module_init (pvpanic_init);module_exit (pvpanic_exit);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 71/356 nilfs2: Remove check for PageError
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 79ea65563ad8aaab309d61eeb4d5019dd6cf5fa0 ]
If read_mapping_page() encounters an error, it returns an errno, not a page with PageError set, so this test is not needed.
Stable-dep-of: 7373a51e7998 ("nilfs2: fix nilfs_empty_dir() misjudgment and long loop on I/O errors")
--- fs/nilfs2/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/dir.c +1 -1
@@ -194,7 +194,7 @@ static struct page *nilfs_get_page(struct inode *dir, unsigned long n)if (!IS_ERR (page)) {kmap (page);if (unlikely (!PageChecked (page))) { -if (PageError (page) || !nilfs_check_page (page)) +if (!nilfs_check_page (page)) goto fail; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 72/356 nilfs2: return the mapped address from nilfs_get_page()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 09a46acb3697e50548bb265afa1d79163659dd85 ]
In prepartion for switching from kmap() to kmap_local(), return the kmap address from nilfs_get_page() instead of having the caller look up page_address().
Stable-dep-of: 7373a51e7998 ("nilfs2: fix nilfs_empty_dir() misjudgment and long loop on I/O errors")
--- fs/nilfs2/dir.c | 57 +++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 30 deletions(-)
fs/nilfs2/dir.c +27 -30
@@ -186,19 +186,24 @@ static bool nilfs_check_page(struct page *page)return false; } -static struct page *nilfs_get_page (struct inode *dir,unsigned long n) +static void *nilfs_get_page (struct inode *dir,unsigned long n, +struct page **pagep) {struct address_space *mapping = dir->i_mapping;struct page *page =read_mapping_page (mapping, n,NULL ); +void *kaddr; -if (!IS_ERR (page)) { -kmap (page); -if (unlikely (!PageChecked (page))) { -if (!nilfs_check_page (page)) - goto fail; - } +if (IS_ERR (page)) +return page; + + kaddr =kmap (page); +if (unlikely (!PageChecked (page))) { +if (!nilfs_check_page (page)) + goto fail; } -return page; + + *pagep = page; +return kaddr; fail:nilfs_put_page (page);
@@ -275,14 +280,14 @@ static int nilfs_readdir(struct file *file, struct dir_context *ctx)for ( ; n < npages; n++, offset =0 ) {char *kaddr, *limit;struct nilfs_dir_entry *de; -struct page *page =nilfs_get_page (inode, n); +struct page *page; -if (IS_ERR (page)) { + kaddr =nilfs_get_page (inode, n, &page); +if (IS_ERR (kaddr)) {nilfs_error (sb,"bad page in #%lu" , inode->i_ino); ctx->pos +=PAGE_SIZE - offset;return -EIO ; } - kaddr =page_address (page); de = (struct nilfs_dir_entry *)(kaddr + offset); limit = kaddr +nilfs_last_byte (inode, n) -NILFS_DIR_REC_LEN (1 );
@@ -345,11 +350,9 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr, start =0 ; n = start; do { - char *kaddr; + char *kaddr = nilfs_get_page(dir, n, &page); - page = nilfs_get_page(dir, n); - if (!IS_ERR(page)) { - kaddr = page_address(page); + if (!IS_ERR(kaddr)) { de = (struct nilfs_dir_entry *)kaddr; kaddr += nilfs_last_byte(dir, n) - reclen; while ((char *) de <= kaddr) {
@@ -387,15 +390,11 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr,struct nilfs_dir_entry *nilfs_dotdot (struct inode *dir,struct page **p) { -struct page *page =nilfs_get_page (dir,0 ); -struct nilfs_dir_entry *de =NULL ; +struct nilfs_dir_entry *de =nilfs_get_page (dir,0 , p); -if (!IS_ERR (page)) { - de =nilfs_next_entry ( - (struct nilfs_dir_entry *)page_address (page)); - *p = page; - } -return de; +if (IS_ERR (de)) +return NULL ; +return nilfs_next_entry (de); }ino_t nilfs_inode_by_name (struct inode *dir,const struct qstr *qstr)
@@ -459,12 +458,11 @@ int nilfs_add_link(struct dentry *dentry, struct inode *inode)for (n =0 ; n <= npages; n++) {char *dir_end; - page =nilfs_get_page (dir, n); - err =PTR_ERR (page); -if (IS_ERR (page)) + kaddr =nilfs_get_page (dir, n, &page); + err =PTR_ERR (kaddr); +if (IS_ERR (kaddr)) goto out;lock_page (page); - kaddr =page_address (page); dir_end = kaddr +nilfs_last_byte (dir, n); de = (struct nilfs_dir_entry *)kaddr; kaddr +=PAGE_SIZE - reclen;
@@ -627,11 +625,10 @@ int nilfs_empty_dir(struct inode *inode)char *kaddr;struct nilfs_dir_entry *de; - page =nilfs_get_page (inode, i); -if (IS_ERR (page)) + kaddr =nilfs_get_page (inode, i, &page); +if (IS_ERR (kaddr))continue ; - kaddr =page_address (page); de = (struct nilfs_dir_entry *)kaddr; kaddr +=nilfs_last_byte (inode, i) -NILFS_DIR_REC_LEN (1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 73/356 nilfs2: fix nilfs_empty_dir() misjudgment and long loop on I/O errors
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
[ Upstream commit 7373a51e7998b508af7136530f3a997b286ce81c ]
The error handling in nilfs_empty_dir() when a directory folio/page read fails is incorrect, as in the old ext2 implementation, and if the folio/page cannot be read or nilfs_check_folio() fails, it will falsely determine the directory as empty and corrupt the file system.
In addition, since nilfs_empty_dir() does not immediately return on a failed folio/page read, but continues to loop, this can cause a long loop with I/O if i_size of the directory's inode is also corrupted, causing the log writer thread to wait and hang, as reported by syzbot.
Fix these issues by making nilfs_empty_dir() immediately return a false value (0) if it fails to get a directory folio/page.
--- fs/nilfs2/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/dir.c +1 -1
@@ -627,7 +627,7 @@ int nilfs_empty_dir(struct inode *inode) kaddr =nilfs_get_page (inode, i, &page);if (IS_ERR (kaddr)) -continue ; +return 0 ; de = (struct nilfs_dir_entry *)kaddr; kaddr +=nilfs_last_byte (inode, i) -NILFS_DIR_REC_LEN (1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 74/356 USB: class: cdc-wdm: Fix CPU lockup caused by excessive log messages
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 22f00812862564b314784167a89f27b444f82a46 upstream.
The syzbot fuzzer found that the interrupt-URB completion callback in the cdc-wdm driver was taking too long, and the driver's immediate resubmission of interrupt URBs with -EPROTO status combined with the dummy-hcd emulation to cause a CPU lockup:
cdc_wdm 1-1:1.0: nonzero urb status received: -71cdc_wdm 1-1:1.0: wdm_int_callback - 0 bytes
watchdog: BUG: soft lockup - CPU#0 stuck for 26s! [syz-executor782:6625] CPU#0 Utilization every 4s during lockup: #1: 98% system, 0% softirq, 3% hardirq, 0% idle #2: 98% system, 0% softirq, 3% hardirq, 0% idle #3: 98% system, 0% softirq, 3% hardirq, 0% idle #4: 98% system, 0% softirq, 3% hardirq, 0% idle #5: 98% system, 1% softirq, 3% hardirq, 0% idle Modules linked in: irq event stamp: 73096 hardirqs last enabled at (73095): [<ffff80008037bc00>] console_emit_next_record kernel/printk/printk.c:2935 [inline] hardirqs last enabled at (73095): [<ffff80008037bc00>] console_flush_all+0x650/0xb74 kernel/printk/printk.c:2994 hardirqs last disabled at (73096): [<ffff80008af10b00>] __el1_irq arch/arm64/kernel/entry-common.c:533 [inline] hardirqs last disabled at (73096): [<ffff80008af10b00>] el1_interrupt+0x24/0x68 arch/arm64/kernel/entry-common.c:551 softirqs last enabled at (73048): [<ffff8000801ea530>] softirq_handle_end kernel/softirq.c:400 [inline] softirqs last enabled at (73048): [<ffff8000801ea530>] handle_softirqs+0xa60/0xc34 kernel/softirq.c:582 softirqs last disabled at (73043): [<ffff800080020de8>] __do_softirq+0x14/0x20 kernel/softirq.c:588 CPU: 0 PID: 6625 Comm: syz-executor782 Tainted: G W 6.10.0-rc2-syzkaller-g8867bbd4a056 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Testing showed that the problem did not occur if the two error messages -- the first two lines above -- were removed; apparently adding material to the kernel log takes a surprisingly large amount of time.
In any case, the best approach for preventing these lockups and to avoid spamming the log with thousands of error messages per second is to ratelimit the two dev_err() calls. Therefore we replace them with dev_err_ratelimited().
--- drivers/usb/class/cdc-wdm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/class/cdc-wdm.c +2 -2
@@ -266,14 +266,14 @@ static void wdm_int_callback(struct urbdev_err (&desc->intf->dev,"Stall on int endpoint\n" ); goto sw;/* halt is cleared in work */ default : -dev_err (&desc->intf->dev, +dev_err_ratelimited (&desc->intf->dev,"nonzero urb status received: %d\n" , status);break ; } }if (urb->actual_length <sizeof (struct usb_cdc_notification )) { -dev_err (&desc->intf->dev,"wdm_int_callback - %d bytes\n" , +dev_err_ratelimited (&desc->intf->dev,"wdm_int_callback - %d bytes\n" , urb->actual_length); goto exit; }
Greg Kroah-Hartman
maintainerPATCH 45/356 pvpanic: Indentation fixes here and there
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 84b0f12a953c4feff9994b1c4583ed18b441f482 ]
1) replace double spaces with single;
2) relax line width limitation a bit.
Stable-dep-of: ee59be35d7a8 ("misc/pvpanic-pci: register attributes via pci_driver")
--- drivers/misc/pvpanic/pvpanic-mmio.c | 7 +++---- drivers/misc/pvpanic/pvpanic-pci.c | 12 +++++------- drivers/misc/pvpanic/pvpanic.c | 11 ++++------- 3 files changed, 12 insertions(+), 18 deletions(-)
drivers/misc/pvpanic/pvpanic-mmio.c +3 -4
@@ -24,8 +24,7 @@ MODULE_AUTHOR("Hu Tao <[email protected]>");MODULE_DESCRIPTION ("pvpanic-mmio device driver" );MODULE_LICENSE ("GPL" ); -static ssize_t capability_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t capability_show (struct device *dev,struct device_attribute *attr,char *buf) {struct pvpanic_instance *pi =dev_get_drvdata (dev);
@@ -33,14 +32,14 @@ static ssize_t capability_show(struct device *dev, }static DEVICE_ATTR_RO (capability); -static ssize_t events_show (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t events_show (struct device *dev,struct device_attribute *attr,char *buf) {struct pvpanic_instance *pi =dev_get_drvdata (dev);return sysfs_emit (buf,"%x\n" , pi->events); } -static ssize_t events_store (struct device *dev,struct device_attribute *attr, +static ssize_t events_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {struct pvpanic_instance *pi =dev_get_drvdata (dev);
drivers/misc/pvpanic/pvpanic-pci.c +5 -7
@@ -19,11 +19,10 @@#define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011MODULE_AUTHOR ("Mihai Carabas <[email protected]>" ); -MODULE_DESCRIPTION ("pvpanic device driver " ); +MODULE_DESCRIPTION ("pvpanic device driver" );MODULE_LICENSE ("GPL" ); -static ssize_t capability_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t capability_show (struct device *dev,struct device_attribute *attr,char *buf) {struct pvpanic_instance *pi =dev_get_drvdata (dev);
@@ -31,14 +30,14 @@ static ssize_t capability_show(struct device *dev, }static DEVICE_ATTR_RO (capability); -static ssize_t events_show (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t events_show (struct device *dev,struct device_attribute *attr,char *buf) {struct pvpanic_instance *pi =dev_get_drvdata (dev);return sysfs_emit (buf,"%x\n" , pi->events); } -static ssize_t events_store (struct device *dev,struct device_attribute *attr, +static ssize_t events_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {struct pvpanic_instance *pi =dev_get_drvdata (dev);
@@ -65,8 +64,7 @@ static struct attribute *pvpanic_pci_dev_attrs[] = { };ATTRIBUTE_GROUPS (pvpanic_pci_dev); -static int pvpanic_pci_probe (struct pci_dev *pdev, -const struct pci_device_id *ent) +static int pvpanic_pci_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {struct pvpanic_instance *pi;void __iomem *base;
drivers/misc/pvpanic/pvpanic.c +4 -7
@@ -23,7 +23,7 @@#include "pvpanic.h" MODULE_AUTHOR ("Mihai Carabas <[email protected]>" ); -MODULE_DESCRIPTION ("pvpanic device driver " ); +MODULE_DESCRIPTION ("pvpanic device driver" );MODULE_LICENSE ("GPL" );static struct list_head pvpanic_list;
@@ -45,8 +45,7 @@ pvpanic_send_event(unsigned int event) }static int -pvpanic_panic_notify (struct notifier_block *nb,unsigned long code, -void *unused) +pvpanic_panic_notify (struct notifier_block *nb,unsigned long code,void *unused) {unsigned int event =PVPANIC_PANICKED ;
@@ -102,8 +101,7 @@ static int pvpanic_init(void)INIT_LIST_HEAD (&pvpanic_list);spin_lock_init (&pvpanic_lock); -atomic_notifier_chain_register (&panic_notifier_list, - &pvpanic_panic_nb); +atomic_notifier_chain_register (&panic_notifier_list, &pvpanic_panic_nb);return 0 ; }
@@ -111,8 +109,7 @@ module_init(pvpanic_init);static void pvpanic_exit (void ) { -atomic_notifier_chain_unregister (&panic_notifier_list, - &pvpanic_panic_nb); +atomic_notifier_chain_unregister (&panic_notifier_list, &pvpanic_panic_nb); }module_exit (pvpanic_exit);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 46/356 misc/pvpanic: deduplicate common code
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit c1426d392aebc51da4944d950d89e483e43f6f14 ]
pvpanic-mmio.c and pvpanic-pci.c share a lot of code. Refactor it into pvpanic.c where it doesn't have to be kept in sync manually and where the core logic can be understood more easily.
No functional change.
Stable-dep-of: ee59be35d7a8 ("misc/pvpanic-pci: register attributes via pci_driver")
--- drivers/misc/pvpanic/pvpanic-mmio.c | 58 +--------------------- drivers/misc/pvpanic/pvpanic-pci.c | 58 +--------------------- drivers/misc/pvpanic/pvpanic.c | 76 ++++++++++++++++++++++++++++- drivers/misc/pvpanic/pvpanic.h | 10 +--- 4 files changed, 80 insertions(+), 122 deletions(-)
drivers/misc/pvpanic/pvpanic-mmio.c +2 -56
@@ -24,52 +24,9 @@ MODULE_AUTHOR("Hu Tao <[email protected]>");MODULE_DESCRIPTION ("pvpanic-mmio device driver" );MODULE_LICENSE ("GPL" ); -static ssize_t capability_show (struct device *dev,struct device_attribute *attr,char *buf) -{ -struct pvpanic_instance *pi =dev_get_drvdata (dev); - -return sysfs_emit (buf,"%x\n" , pi->capability); -} -static DEVICE_ATTR_RO (capability); - -static ssize_t events_show (struct device *dev,struct device_attribute *attr,char *buf) -{ -struct pvpanic_instance *pi =dev_get_drvdata (dev); - -return sysfs_emit (buf,"%x\n" , pi->events); -} - -static ssize_t events_store (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) -{ -struct pvpanic_instance *pi =dev_get_drvdata (dev); -unsigned int tmp; -int err; - - err =kstrtouint (buf,16 , &tmp); -if (err) -return err; - -if ((tmp & pi->capability) != tmp) -return -EINVAL ; - - pi->events = tmp; - -return count; -} -static DEVICE_ATTR_RW (events); - -static struct attribute *pvpanic_mmio_dev_attrs[] = { - &dev_attr_capability.attr, - &dev_attr_events.attr, -NULL -}; -ATTRIBUTE_GROUPS (pvpanic_mmio_dev); -static int pvpanic_mmio_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct pvpanic_instance *pi;struct resource *res;void __iomem *base;
@@ -92,18 +49,7 @@ static int pvpanic_mmio_probe(struct platform_device *pdev)return -EINVAL ; } - pi =devm_kmalloc (dev,sizeof (*pi),GFP_KERNEL ); -if (!pi) -return -ENOMEM ; - - pi->base = base; - pi->capability =PVPANIC_PANICKED |PVPANIC_CRASH_LOADED ; - -/* initialize capability by RDPT */ - pi->capability &=ioread8 (base); - pi->events = pi->capability; - -return devm_pvpanic_probe (dev, pi); +return devm_pvpanic_probe (dev, base); }static const struct of_device_id pvpanic_mmio_match[] = {
@@ -123,7 +69,7 @@ static struct platform_driver pvpanic_mmio_driver = { .name = "pvpanic-mmio", .of_match_table = pvpanic_mmio_match, .acpi_match_table = pvpanic_device_ids, - .dev_groups = pvpanic_mmio_dev_groups, + .dev_groups = pvpanic_dev_groups, }, .probe = pvpanic_mmio_probe, };
drivers/misc/pvpanic/pvpanic-pci.c +2 -56
78 lines not on this page · raw message
drivers/misc/pvpanic/pvpanic.c +74 -2
97 lines not on this page · raw message
drivers/misc/pvpanic/pvpanic.h +2 -8
@@ -8,13 +8,7 @@#ifndef PVPANIC_H_ #define PVPANIC_H_ -struct pvpanic_instance { -void __iomem *base; -unsigned int capability; -unsigned int events; -struct list_head list; -}; - -int devm_pvpanic_probe (struct device *dev,struct pvpanic_instance *pi); +int devm_pvpanic_probe (struct device *dev,void __iomem *base); +extern const struct attribute_group *pvpanic_dev_groups[];#endif /* PVPANIC_H_ */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 47/356 misc/pvpanic-pci: register attributes via pci_driver
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit ee59be35d7a8be7fcaa2d61fb89734ab5c25e4ee ]
In __pci_register_driver(), the pci core overwrites the dev_groups field of the embedded struct device_driver with the dev_groups from the outer struct pci_driver unconditionally.
Set dev_groups in the pci_driver to make sure it is used.
This was broken since the introduction of pvpanic-pci.
--- drivers/misc/pvpanic/pvpanic-pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/misc/pvpanic/pvpanic-pci.c +1 -3
@@ -48,8 +48,6 @@ static struct pci_driver pvpanic_pci_driver = { .name = "pvpanic-pci", .id_table = pvpanic_pci_id_tbl, .probe = pvpanic_pci_probe, - .driver = { - .dev_groups = pvpanic_dev_groups, - }, + .dev_groups = pvpanic_dev_groups, };module_pci_driver (pvpanic_pci_driver);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 48/356 skbuff: introduce skb_pull_data
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 13244cccc2b61ec715f0ac583d3037497004d4a5 ]
Like skb_pull but returns the original data pointer before pulling the data after performing a check against sbk->len.
This allows to change code that does "struct foo *p = (void *)skb->data;" which is hard to audit and error prone, to:
p = skb_pull_data(skb, sizeof(*p));
if (!p)
return;Which is both safer and cleaner.
Stable-dep-of: cda0d6a198e2 ("Bluetooth: qca: fix info leak when fetching fw build id")
--- include/linux/skbuff.h | 2 ++ net/core/skbuff.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+)
include/linux/skbuff.h +2 -0
@@ -2447,6 +2447,8 @@ static inline void *skb_pull_inline(struct sk_buff *skb, unsigned int len)return unlikely (len > skb->len) ?NULL :__skb_pull (skb, len); } +void *skb_pull_data (struct sk_buff *skb,size_t len); +void *__pskb_pull_tail (struct sk_buff *skb,int delta);static inline void *__pskb_pull (struct sk_buff *skb,unsigned int len)
net/core/skbuff.c +24 -0
@@ -2071,6 +2071,30 @@ void *skb_pull(struct sk_buff *skb, unsigned int len) }EXPORT_SYMBOL (skb_pull); +/** +* skb_pull_data - remove data from the start of a buffer returning its +* original position. +* @skb: buffer to use +* @len: amount of data to remove +* +* This function removes data from the start of a buffer, returning +* the memory to the headroom. A pointer to the original data in the buffer +* is returned after checking if there is enough data to pull. Once the +* data has been pulled future pushes will overwrite the old data. +*/ +void *skb_pull_data (struct sk_buff *skb,size_t len) +{ +void *data = skb->data; + +if (skb->len < len) +return NULL ; + +skb_pull (skb, len); + +return data; +} +EXPORT_SYMBOL (skb_pull_data); +/** * skb_trim - remove end from a buffer * @skb: buffer to alter
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 49/356 Bluetooth: hci_qca: mark OF related data as maybe unused
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 44fac8a2fd2f72ee98ee41e6bc9ecc7765b5d3cc ]
The driver can be compile tested with !CONFIG_OF making certain data unused:
drivers/bluetooth/hci_qca.c:1869:37: error: ‘qca_soc_data_wcn6750’ defined but not used [-Werror=unused-const-variable=] drivers/bluetooth/hci_qca.c:1853:37: error: ‘qca_soc_data_wcn3998’ defined but not used [-Werror=unused-const-variable=] drivers/bluetooth/hci_qca.c:1841:37: error: ‘qca_soc_data_wcn3991’ defined but not used [-Werror=unused-const-variable=] drivers/bluetooth/hci_qca.c:1830:37: error: ‘qca_soc_data_wcn3990’ defined but not used [-Werror=unused-const-variable=]
Stable-dep-of: cda0d6a198e2 ("Bluetooth: qca: fix info leak when fetching fw build id")
--- drivers/bluetooth/hci_qca.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/bluetooth/hci_qca.c +5 -5
@@ -1834,7 +1834,7 @@ static const struct hci_uart_proto qca_proto = { .dequeue = qca_dequeue, }; -static const struct qca_device_data qca_soc_data_wcn3990 = { +static const struct qca_device_data qca_soc_data_wcn3990__maybe_unused = { .soc_type =QCA_WCN3990 , .vregs = (struct qca_vreg []) { {"vddio" ,15000 },
@@ -1845,7 +1845,7 @@ static const struct qca_device_data qca_soc_data_wcn3990 = { .num_vregs = 4, }; -static const struct qca_device_data qca_soc_data_wcn3991 = { +static const struct qca_device_data qca_soc_data_wcn3991__maybe_unused = { .soc_type =QCA_WCN3991 , .vregs = (struct qca_vreg []) { {"vddio" ,15000 },
@@ -1857,7 +1857,7 @@ static const struct qca_device_data qca_soc_data_wcn3991 = { .capabilities = QCA_CAP_WIDEBAND_SPEECH | QCA_CAP_VALID_LE_STATES, }; -static const struct qca_device_data qca_soc_data_wcn3998 = { +static const struct qca_device_data qca_soc_data_wcn3998__maybe_unused = { .soc_type =QCA_WCN3998 , .vregs = (struct qca_vreg []) { {"vddio" ,10000 },
@@ -1868,13 +1868,13 @@ static const struct qca_device_data qca_soc_data_wcn3998 = { .num_vregs = 4, }; -static const struct qca_device_data qca_soc_data_qca6390 = { +static const struct qca_device_data qca_soc_data_qca6390__maybe_unused = { .soc_type =QCA_QCA6390 , .num_vregs =0 , .capabilities =QCA_CAP_WIDEBAND_SPEECH |QCA_CAP_VALID_LE_STATES , }; -static const struct qca_device_data qca_soc_data_wcn6750 = { +static const struct qca_device_data qca_soc_data_wcn6750__maybe_unused = { .soc_type =QCA_WCN6750 , .vregs = (struct qca_vreg []) { {"vddio" ,5000 },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 50/356 Bluetooth: btqca: use le32_to_cpu for ver.soc_id
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Min-Hua Chen <[email protected]>
[ Upstream commit 8153b738bc547878a017889d2b1cf8dd2de0e0c6 ]
Use le32_to_cpu for ver.soc_id to fix the following sparse warning.
drivers/bluetooth/btqca.c:640:24: sparse: warning: restricted __le32 degrades to integer
Stable-dep-of: cda0d6a198e2 ("Bluetooth: qca: fix info leak when fetching fw build id")
--- drivers/bluetooth/btqca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btqca.c +1 -1
@@ -635,7 +635,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,snprintf (config.fwname,sizeof (config.fwname),"qca/%s" , firmware_name); else if (qca_is_wcn399x(soc_type)) { -if (ver.soc_id ==QCA_WCN3991_SOC_ID ) { +if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) {snprintf (config.fwname,sizeof (config.fwname),"qca/crnv%02xu.bin" , rom_ver); }else {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 41/356 drm/amd/display: Clean up some inconsistent indenting
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiapeng Chong <[email protected]>
[ Upstream commit 1da2fcc435114ea5a65d7e15fc31b4d0ce11113c ]
Eliminate the follow smatch warning:
drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_srv.c:622 dmub_srv_cmd_execute() warn: inconsistent indenting.
Stable-dep-of: 892b41b16f61 ("drm/amd/display: Fix incorrect DSC instance for MST")
--- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +36 -36
@@ -1315,9 +1315,9 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx) {
@@ -1421,9 +1421,9 @@ static ssize_t dp_dsc_clock_en_write(struct file *f, const char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx || !pipe_ctx->stream)
@@ -1506,9 +1506,9 @@ static ssize_t dp_dsc_slice_width_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx) {
@@ -1610,9 +1610,9 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, const char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx || !pipe_ctx->stream)
@@ -1695,9 +1695,9 @@ static ssize_t dp_dsc_slice_height_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx) {
@@ -1799,9 +1799,9 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, const char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx || !pipe_ctx->stream)
@@ -1880,9 +1880,9 @@ static ssize_t dp_dsc_bits_per_pixel_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx) {
@@ -1981,9 +1981,9 @@ static ssize_t dp_dsc_bits_per_pixel_write(struct file *f, const char __user *bufor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx || !pipe_ctx->stream)
@@ -2060,9 +2060,9 @@ static ssize_t dp_dsc_pic_width_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx) {
@@ -2121,9 +2121,9 @@ static ssize_t dp_dsc_pic_height_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx) {
@@ -2197,9 +2197,9 @@ static ssize_t dp_dsc_chunk_size_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx) {
@@ -2273,9 +2273,9 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf,for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe_ctx && pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) -break ; +if (pipe_ctx && pipe_ctx->stream && + pipe_ctx->stream->link == aconnector->dc_link) +break ; }if (!pipe_ctx) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 76/356 mei: me: release irq in mei_me_pci_resume error path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Winkler <[email protected]>
commit 283cb234ef95d94c61f59e1cd070cd9499b51292 upstream.
The mei_me_pci_resume doesn't release irq on the error path, in case mei_start() fails.
--- drivers/misc/mei/pci-me.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/misc/mei/pci-me.c +3 -1
@@ -400,8 +400,10 @@ static int mei_me_pci_resume(struct devi } err =mei_restart (dev); -if (err) +if (err) { +free_irq (pdev->irq, dev);return err; + }/* Start timer if stopped in suspend */ schedule_delayed_work (&dev->timer_work,HZ );
Greg Kroah-Hartman
maintainerPATCH 85/356 clk: sifive: Do not register clkdevs for PRCI clocks
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Holland <[email protected]>
[ Upstream commit 2607133196c35f31892ee199ce7ffa717bea4ad1 ]
These clkdevs were unnecessary, because systems using this driver always look up clocks using the devicetree. And as Russell King points out[1], since the provided device name was truncated, lookups via clkdev would never match.
Recently, commit 8d532528ff6a ("clkdev: report over-sized strings when creating clkdev entries") caused clkdev registration to fail due to the truncation, and this now prevents the driver from probing. Fix the driver by removing the clkdev registration.
--- drivers/clk/sifive/sifive-prci.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/clk/sifive/sifive-prci.c +0 -8
@@ -4,7 +4,6 @@* Copyright (C) 2020 Zong Li */ -#include <linux/clkdev.h> #include <linux/delay.h> #include <linux/io.h> #include <linux/of_device.h>
@@ -541,13 +540,6 @@ static int __prci_register_clocks(struct device *dev, struct __prci_data *pd,return r; } - r =clk_hw_register_clkdev (&pic->hw, pic->name,dev_name (dev)); -if (r) { -dev_warn (dev,"Failed to register clkdev for %s: %d\n" , - init.name, r); -return r; - } - pd->hw_clks.hws[i] = &pic->hw; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 86/356 SUNRPC: return proper error from gss_wrap_req_priv
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Hanxiao <[email protected]>
[ Upstream commit 33c94d7e3cb84f6d130678d6d59ba475a6c489cf ]
don't return 0 if snd_buf->len really greater than snd_buf->buflen
--- net/sunrpc/auth_gss/auth_gss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sunrpc/auth_gss/auth_gss.c +3 -1
@@ -1855,8 +1855,10 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, offset = (u8 *)p - (u8 *)snd_buf->head[0 ].iov_base; maj_stat =gss_wrap (ctx->gc_gss_ctx, offset, snd_buf, inpages);/* slack space should prevent this ever happening: */ -if (unlikely (snd_buf->len > snd_buf->buflen)) +if (unlikely (snd_buf->len > snd_buf->buflen)) { + status = -EIO ; goto wrap_failed; + }/* We're assuming that when GSS_S_CONTEXT_EXPIRED, the encryption was * done anyway, so it's safe to put the request on the wire: */ if (maj_stat ==GSS_S_CONTEXT_EXPIRED )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 87/356 platform/x86: dell-smbios-base: Use sysfs_emit()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: ye xingchen <[email protected]>
[ Upstream commit bbfa903b4f9a0a76719f386367fed5e64187f577 ]
Replace the open-code with sysfs_emit() to simplify the code.
Stable-dep-of: 1981b296f858 ("platform/x86: dell-smbios: Fix wrong token data in sysfs")
--- drivers/platform/x86/dell/dell-smbios-base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-smbios-base.c +2 -2
@@ -441,7 +441,7 @@ static ssize_t location_show(struct device *dev, i =match_attribute (dev, attr);if (i >0 ) -return scnprintf (buf,PAGE_SIZE ,"%08x" , da_tokens[i].location); +return sysfs_emit (buf,"%08x" , da_tokens[i].location);return 0 ; }
@@ -455,7 +455,7 @@ static ssize_t value_show(struct device *dev, i =match_attribute (dev, attr);if (i >0 ) -return scnprintf (buf,PAGE_SIZE ,"%08x" , da_tokens[i].value); +return sysfs_emit (buf,"%08x" , da_tokens[i].value);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 88/356 platform/x86: dell-smbios: Fix wrong token data in sysfs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 1981b296f858010eae409548fd297659b2cc570e ]
When reading token data from sysfs on my Inspiron 3505, the token locations and values are wrong. This happens because match_attribute() blindly assumes that all entries in da_tokens have an associated entry in token_attrs.
This however is not true as soon as da_tokens[] contains zeroed token entries. Those entries are being skipped when initialising token_attrs, breaking the core assumption of match_attribute().
Fix this by defining an extra struct for each pair of token attributes and use container_of() to retrieve token information.
Tested on a Dell Inspiron 3050.
--- drivers/platform/x86/dell/dell-smbios-base.c | 91 ++++++++++----------------- 1 file changed, 35 insertions(+), 56 deletions(-)
drivers/platform/x86/dell/dell-smbios-base.c +35 -56
@@ -25,11 +25,16 @@ static u32 da_supported_commands;static int da_num_tokens;static struct platform_device *platform_device;static struct calling_interface_token *da_tokens; -static struct device_attribute *token_location_attrs; -static struct device_attribute *token_value_attrs; +static struct token_sysfs_data *token_entries;static struct attribute **token_attrs;static DEFINE_MUTEX (smbios_mutex); +struct token_sysfs_data { +struct device_attribute location_attr; +struct device_attribute value_attr; +struct calling_interface_token *token; +}; +struct smbios_device {struct list_head list;struct device *device;
@@ -416,47 +421,26 @@ static void __init find_tokens(const str } } -static int match_attribute (struct device *dev, -struct device_attribute *attr) -{ -int i; - -for (i =0 ; i < da_num_tokens *2 ; i++) { -if (!token_attrs[i]) -continue ; -if (strcmp (token_attrs[i]->name, attr->attr.name) ==0 ) -return i/2 ; - } -dev_dbg (dev,"couldn't match: %s\n" , attr->attr.name); -return -EINVAL ; -} -static ssize_t location_show (struct device *dev,struct device_attribute *attr,char *buf) { -int i; + struct token_sysfs_data *data = container_of(attr, struct token_sysfs_data, location_attr);if (!capable (CAP_SYS_ADMIN ))return -EPERM ; - i =match_attribute (dev, attr); -if (i >0 ) -return sysfs_emit (buf,"%08x" , da_tokens[i].location); -return 0 ; +return sysfs_emit (buf,"%08x" , data->token->location); }static ssize_t value_show (struct device *dev,struct device_attribute *attr,char *buf) { -int i; + struct token_sysfs_data *data = container_of(attr, struct token_sysfs_data, value_attr);if (!capable (CAP_SYS_ADMIN ))return -EPERM ; - i =match_attribute (dev, attr); -if (i >0 ) -return sysfs_emit (buf,"%08x" , da_tokens[i].value); -return 0 ; +return sysfs_emit (buf,"%08x" , data->token->value); }static struct attribute_group smbios_attribute_group = {
@@ -473,22 +457,15 @@ static int build_tokens_sysfs(struct pla {char *location_name;char *value_name; -size_t size;int ret;int i, j; -/* (number of tokens + 1 for null terminated */ - size =sizeof (struct device_attribute ) * (da_num_tokens +1 ); - token_location_attrs =kzalloc (size,GFP_KERNEL ); -if (!token_location_attrs) + token_entries =kcalloc (da_num_tokens,sizeof (*token_entries),GFP_KERNEL ); +if (!token_entries)return -ENOMEM ; - token_value_attrs =kzalloc (size,GFP_KERNEL ); -if (!token_value_attrs) - goto out_allocate_value;/* need to store both location and value + terminator*/ - size =sizeof (struct attribute *) * ((2 * da_num_tokens) +1 ); - token_attrs =kzalloc (size,GFP_KERNEL ); + token_attrs =kcalloc ((2 * da_num_tokens) +1 ,sizeof (*token_attrs),GFP_KERNEL );if (!token_attrs) goto out_allocate_attrs;
@@ -496,27 +473,32 @@ static int build_tokens_sysfs(struct pla/* skip empty */ if (da_tokens[i].tokenID ==0 )continue ; + + token_entries[i].token = &da_tokens[i]; +/* add location */ location_name =kasprintf (GFP_KERNEL ,"%04x_location" , da_tokens[i].tokenID);if (location_name ==NULL ) goto out_unwind_strings; -sysfs_attr_init (&token_location_attrs[i].attr); - token_location_attrs[i].attr.name = location_name; - token_location_attrs[i].attr.mode =0444 ; - token_location_attrs[i].show = location_show; - token_attrs[j++] = &token_location_attrs[i].attr; + +sysfs_attr_init (&token_entries[i].location_attr.attr); + token_entries[i].location_attr.attr.name = location_name; + token_entries[i].location_attr.attr.mode =0444 ; + token_entries[i].location_attr.show = location_show; + token_attrs[j++] = &token_entries[i].location_attr.attr;/* add value */ value_name =kasprintf (GFP_KERNEL ,"%04x_value" , da_tokens[i].tokenID);if (value_name ==NULL ) goto loop_fail_create_value; -sysfs_attr_init (&token_value_attrs[i].attr); - token_value_attrs[i].attr.name = value_name; - token_value_attrs[i].attr.mode =0444 ; - token_value_attrs[i].show = value_show; - token_attrs[j++] = &token_value_attrs[i].attr; + +sysfs_attr_init (&token_entries[i].value_attr.attr); + token_entries[i].value_attr.attr.name = value_name; + token_entries[i].value_attr.attr.mode =0444 ; + token_entries[i].value_attr.show = value_show; + token_attrs[j++] = &token_entries[i].value_attr.attr;continue ; loop_fail_create_value:
@@ -532,14 +514,12 @@ loop_fail_create_value: out_unwind_strings:while (i--) { -kfree (token_location_attrs[i].attr.name); -kfree (token_value_attrs[i].attr.name); +kfree (token_entries[i].location_attr.attr.name); +kfree (token_entries[i].value_attr.attr.name); }kfree (token_attrs); out_allocate_attrs: -kfree (token_value_attrs); -out_allocate_value: -kfree (token_location_attrs); +kfree (token_entries);return -ENOMEM ; }
@@ -551,12 +531,11 @@ static void free_group(struct platform_dsysfs_remove_group (&pdev->dev.kobj, &smbios_attribute_group);for (i =0 ; i < da_num_tokens; i++) { -kfree (token_location_attrs[i].attr.name); -kfree (token_value_attrs[i].attr.name); +kfree (token_entries[i].location_attr.attr.name); +kfree (token_entries[i].value_attr.attr.name); }kfree (token_attrs); -kfree (token_value_attrs); -kfree (token_location_attrs); +kfree (token_entries); }static int __init dell_smbios_init (void )
Greg Kroah-Hartman
maintainerPATCH 89/356 gpio: tqmx86: fix typo in Kconfig label
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregor Herburger <[email protected]>
[ Upstream commit 8c219e52ca4d9a67cd6a7074e91bf29b55edc075 ]
Fix description for GPIO_TQMX86 from QTMX86 to TQMx86.
--- drivers/gpio/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/Kconfig +1 -1
@@ -1396,7 +1396,7 @@ config GPIO_TPS68470 drivers are loaded. config GPIO_TQMX86 - tristate "TQ-Systems QTMX86 GPIO" + tristate "TQ-Systems TQMx86 GPIO" depends on MFD_TQMX86 || COMPILE_TEST depends on HAS_IOPORT_MAP select GPIOLIB_IRQCHIP
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 90/356 gpio: tqmx86: store IRQ trigger type and unmask status separately
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Schiffer <[email protected]>
commit 08af509efdf8dad08e972b48de0e2c2a7919ea8b upstream.
irq_set_type() should not implicitly unmask the IRQ.
All accesses to the interrupt configuration register are moved to a new helper tqmx86_gpio_irq_config(). We also introduce the new rule that accessing irq_type must happen while locked, which will become significant for fixing EDGE_BOTH handling.
--- drivers/gpio/gpio-tqmx86.c | 46 +++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-)
drivers/gpio/gpio-tqmx86.c +26 -20
@@ -27,16 +27,20 @@#define TQMX86_GPIIC 3/* GPI Interrupt Configuration Register */ #define TQMX86_GPIIS 4/* GPI Interrupt Status Register */ +#define TQMX86_GPII_NONE 0#define TQMX86_GPII_FALLING BIT(0)#define TQMX86_GPII_RISING BIT(1)#define TQMX86_GPII_MASK (BIT(0) | BIT(1))#define TQMX86_GPII_BITS 2 +/* Stored in irq_type with GPII bits */ +#define TQMX86_INT_UNMASKED BIT(2)struct tqmx86_gpio_data {struct gpio_chip chip;struct irq_chip irq_chip;void __iomem *io_base;int irq; +/* Lock must be held for accessing output and irq_type fields */ raw_spinlock_t spinlock;u8 irq_type[TQMX86_NGPI ]; };
@@ -107,20 +111,30 @@ static int tqmx86_gpio_get_direction(strreturn GPIO_LINE_DIRECTION_OUT ; } +static void tqmx86_gpio_irq_config (struct tqmx86_gpio_data *gpio,int offset) + __must_hold(&gpio->spinlock) +{ +u8 type =TQMX86_GPII_NONE , gpiic; + +if (gpio->irq_type[offset] &TQMX86_INT_UNMASKED ) + type = gpio->irq_type[offset] &TQMX86_GPII_MASK ; + + gpiic =tqmx86_gpio_read (gpio,TQMX86_GPIIC ); + gpiic &= ~(TQMX86_GPII_MASK << (offset *TQMX86_GPII_BITS )); + gpiic |= type << (offset *TQMX86_GPII_BITS ); +tqmx86_gpio_write (gpio, gpiic,TQMX86_GPIIC ); +} +static void tqmx86_gpio_irq_mask (struct irq_data *data) {unsigned int offset = (data->hwirq -TQMX86_NGPO );struct tqmx86_gpio_data *gpio =gpiochip_get_data (irq_data_get_irq_chip_data (data));unsigned long flags; -u8 gpiic, mask; - - mask =TQMX86_GPII_MASK << (offset *TQMX86_GPII_BITS );raw_spin_lock_irqsave (&gpio->spinlock, flags); - gpiic =tqmx86_gpio_read (gpio,TQMX86_GPIIC ); - gpiic &= ~mask; -tqmx86_gpio_write (gpio, gpiic,TQMX86_GPIIC ); + gpio->irq_type[offset] &= ~TQMX86_INT_UNMASKED ; +tqmx86_gpio_irq_config (gpio, offset);raw_spin_unlock_irqrestore (&gpio->spinlock, flags); }
@@ -130,15 +144,10 @@ static void tqmx86_gpio_irq_unmask(strucstruct tqmx86_gpio_data *gpio =gpiochip_get_data (irq_data_get_irq_chip_data (data));unsigned long flags; -u8 gpiic, mask; - - mask =TQMX86_GPII_MASK << (offset *TQMX86_GPII_BITS );raw_spin_lock_irqsave (&gpio->spinlock, flags); - gpiic =tqmx86_gpio_read (gpio,TQMX86_GPIIC ); - gpiic &= ~mask; - gpiic |= gpio->irq_type[offset] << (offset *TQMX86_GPII_BITS ); -tqmx86_gpio_write (gpio, gpiic,TQMX86_GPIIC ); + gpio->irq_type[offset] |=TQMX86_INT_UNMASKED ; +tqmx86_gpio_irq_config (gpio, offset);raw_spin_unlock_irqrestore (&gpio->spinlock, flags); }
@@ -149,7 +158,7 @@ static int tqmx86_gpio_irq_set_type(struunsigned int offset = (data->hwirq -TQMX86_NGPO );unsigned int edge_type = type &IRQF_TRIGGER_MASK ;unsigned long flags; -u8 new_type, gpiic; +u8 new_type;switch (edge_type) {case IRQ_TYPE_EDGE_RISING :
@@ -165,13 +174,10 @@ static int tqmx86_gpio_irq_set_type(strureturn -EINVAL ;/* not supported */ } - gpio->irq_type[offset] = new_type; -raw_spin_lock_irqsave (&gpio->spinlock, flags); - gpiic =tqmx86_gpio_read (gpio,TQMX86_GPIIC ); - gpiic &= ~((TQMX86_GPII_MASK ) << (offset *TQMX86_GPII_BITS )); - gpiic |= new_type << (offset *TQMX86_GPII_BITS ); -tqmx86_gpio_write (gpio, gpiic,TQMX86_GPIIC ); + gpio->irq_type[offset] &= ~TQMX86_GPII_MASK ; + gpio->irq_type[offset] |= new_type; +tqmx86_gpio_irq_config (gpio, offset);raw_spin_unlock_irqrestore (&gpio->spinlock, flags);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 91/356 HID: core: remove unnecessary WARN_ON() in implement()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit 4aa2dcfbad538adf7becd0034a3754e1bd01b2b5 ]
Syzkaller hit a warning [1] in a call to implement() when trying to write a value into a field of smaller size in an output report.
Since implement() already has a warn message printed out with the help of hid_warn() and value in question gets trimmed with:
... value &= m; ...
WARN_ON may be considered superfluous. Remove it to suppress future syzkaller triggers.
[1]
WARNING: CPU: 0 PID: 5084 at drivers/hid/hid-core.c:1451 implement drivers/hid/hid-core.c:1451 [inline] WARNING: CPU: 0 PID: 5084 at drivers/hid/hid-core.c:1451 hid_output_report+0x548/0x760 drivers/hid/hid-core.c:1863 Modules linked in: CPU: 0 PID: 5084 Comm: syz-executor424 Not tainted 6.9.0-rc7-syzkaller-00183-gcf87f46fd34d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 RIP: 0010:implement drivers/hid/hid-core.c:1451 [inline] RIP: 0010:hid_output_report+0x548/0x760 drivers/hid/hid-core.c:1863 ... Call Trace: <TASK> __usbhid_submit_report drivers/hid/usbhid/hid-core.c:591 [inline] usbhid_submit_report+0x43d/0x9e0 drivers/hid/usbhid/hid-core.c:636 hiddev_ioctl+0x138b/0x1f00 drivers/hid/usbhid/hiddev.c:726 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:904 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
...
--- drivers/hid/hid-core.c | 1 - 1 file changed, 1 deletion(-)
drivers/hid/hid-core.c +0 -1
@@ -1446,7 +1446,6 @@ static void implement(const struct hid_device *hid, u8 *report,hid_warn (hid,"%s() called with too large value %d (n: %d)! (%s)\n" , __func__, value, n, current->comm); -WARN_ON (1 ); value &= m; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 92/356 iommu/amd: Introduce pci segment structure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasant Hegde <[email protected]>
[ Upstream commit 404ec4e4c169fb64da6b2a38b471c13ac0897c76 ]
Newer AMD systems can support multiple PCI segments, where each segment contains one or more IOMMU instances. However, an IOMMU instance can only support a single PCI segment.
Current code assumes that system contains only one pci segment (segment 0) and creates global data structures such as device table, rlookup table, etc.
Introducing per PCI segment data structure, which contains segment specific data structures. This will eventually replace the global data structures.
Also update amd_iommu->pci_seg variable to point to PCI segment structure instead of PCI segment ID.
Stable-dep-of: a295ec52c862 ("iommu/amd: Fix sysfs leak in iommu init")
--- drivers/iommu/amd/amd_iommu_types.h | 24 ++++++++++++++- drivers/iommu/amd/init.c | 46 ++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 2 deletions(-)
drivers/iommu/amd/amd_iommu_types.h +23 -1
@@ -450,6 +450,11 @@ extern bool amd_iommu_irq_remap;/* kmem_cache to get tables with 128 byte alignement */ extern struct kmem_cache *amd_iommu_irq_cache; +/* Make iterating over all pci segment easier */ +#define for_each_pci_segment (pci_seg) \ + list_for_each_entry((pci_seg), &amd_iommu_pci_seg_list, list) +#define for_each_pci_segment_safe (pci_seg, next) \ + list_for_each_entry_safe((pci_seg), (next), &amd_iommu_pci_seg_list, list)/* * Make iterating over all IOMMUs easier */
@@ -524,6 +529,17 @@ struct protection_domain {unsigned dev_iommu[MAX_IOMMUS ];/* per-IOMMU reference count */ }; +/* +* This structure contains information about one PCI segment in the system. +*/ +struct amd_iommu_pci_seg { +/* List with all PCI segments in the system */ +struct list_head list; + +/* PCI segment number */ +u16 id; +}; +/* * Structure where we save information about one hardware AMD IOMMU in the * system.
@@ -575,7 +591,7 @@ struct amd_iommu {u16 cap_ptr;/* pci domain of this IOMMU */ -u16 pci_seg; +struct amd_iommu_pci_seg *pci_seg;/* start of exclusion range of that IOMMU */ u64 exclusion_start;
@@ -703,6 +719,12 @@ extern struct list_head ioapic_map;extern struct list_head hpet_map;extern struct list_head acpihid_map; +/* +* List with all PCI segments in the system. This list is not locked because +* it is only written at driver initialization time +*/ +extern struct list_head amd_iommu_pci_seg_list; +/* * List with all IOMMUs in the system. This list is not locked because it is * only written and read at driver initialization or suspend time
drivers/iommu/amd/init.c +45 -1
78 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 93/356 iommu/amd: Fix sysfs leak in iommu init
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kun(llfl) <[email protected]>
[ Upstream commit a295ec52c8624883885396fde7b4df1a179627c3 ]
During the iommu initialization, iommu_init_pci() adds sysfs nodes. However, these nodes aren't remove in free_iommu_resources() subsequently.
--- drivers/iommu/amd/init.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/iommu/amd/init.c +9 -0
@@ -1493,8 +1493,17 @@ static void __init free_pci_segments(void) } } +static void __init free_sysfs (struct amd_iommu *iommu) +{ +if (iommu->iommu.dev) { +iommu_device_unregister (&iommu->iommu); +iommu_device_sysfs_remove (&iommu->iommu); + } +} +static void __init free_iommu_one (struct amd_iommu *iommu) { +free_sysfs (iommu);free_cwwb_sem (iommu);free_command_buffer (iommu);free_event_buffer (iommu);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 94/356 iommu: Return right value in iommu_sva_bind_device()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
[ Upstream commit 89e8a2366e3bce584b6c01549d5019c5cda1205e ]
iommu_sva_bind_device() should return either a sva bond handle or an ERR_PTR value in error cases. Existing drivers (idxd and uacce) only check the return value with IS_ERR(). This could potentially lead to a kernel NULL pointer dereference issue if the function returns NULL instead of an error pointer.
In reality, this doesn't cause any problems because iommu_sva_bind_device() only returns NULL when the kernel is not configured with CONFIG_IOMMU_SVA. In this case, iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_SVA) will return an error, and the device drivers won't call iommu_sva_bind_device() at all.
--- include/linux/iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iommu.h +1 -1
@@ -1038,7 +1038,7 @@ iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev)static inline struct iommu_sva *iommu_sva_bind_device (struct device *dev,struct mm_struct *mm,void *drvdata) { -return NULL ; +return ERR_PTR (-ENODEV ); }static inline void iommu_sva_unbind_device (struct iommu_sva *handle)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 77/356 jfs: xattr: fix buffer overflow for invalid xattr
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 7c55b78818cfb732680c4a72ab270cc2d2ee3d0f upstream.
When an xattr size is not what is expected, it is printed out to the kernel log in hex format as a form of debugging. But when that xattr size is bigger than the expected size, printing it out can cause an access off the end of the buffer.
Fix this all up by properly restricting the size of the debug hex dump in the kernel log.
--- fs/jfs/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/jfs/xattr.c +3 -1
@@ -557,9 +557,11 @@ static int ea_get(struct inode *inode, s size_check:if (EALIST_SIZE (ea_buf->xattr) != ea_size) { +int size =min_t (int,EALIST_SIZE (ea_buf->xattr), ea_size); +printk (KERN_ERR "ea_get: invalid extended attribute\n" );print_hex_dump (KERN_ERR ,"" ,DUMP_PREFIX_ADDRESS ,16 ,1 , - ea_buf->xattr, ea_size,1 ); + ea_buf->xattr, size,1 );ea_release (inode, ea_buf); rc = -EIO ; goto clean_up;
Greg Kroah-Hartman
maintainerPATCH 95/356 HID: logitech-dj: Fix memory leak in logi_dj_recv_switch_to_dj_mode()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: José Expósito <[email protected]>
[ Upstream commit ce3af2ee95170b7d9e15fff6e500d67deab1e7b3 ]
Fix a memory leak on logi_dj_recv_send_report() error path.
--- drivers/hid/hid-logitech-dj.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-dj.c +3 -1
@@ -1284,8 +1284,10 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,*/ msleep (50 ); -if (retval) +if (retval) { +kfree (dj_report);return retval; + } }/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 96/356 drm/vmwgfx: 3D disabled should not effect STDU memory limits
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Forbes <[email protected]>
[ Upstream commit fb5e19d2dd03eb995ccd468d599b2337f7f66555 ]
This limit became a hard cap starting with the change referenced below. Surface creation on the device will fail if the requested size is larger than this limit so altering the value arbitrarily will expose modes that are too large for the device's hard limits.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +0 -7
@@ -904,13 +904,6 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)vmw_read (dev_priv,SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB ); -/* -* Workaround for low memory 2D VMs to compensate for the -* allocation taken by fbdev -*/ -if (!(dev_priv->capabilities &SVGA_CAP_3D )) - mem_size *=3 ; - dev_priv->max_mob_pages = mem_size *1024 /PAGE_SIZE ; dev_priv->max_primary_mem =vmw_read (dev_priv,SVGA_REG_MAX_PRIMARY_MEM );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 97/356 net: sfp: Always call `sfp_sm_mod_remove()` on remove
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Csókás, Bence <[email protected]>
[ Upstream commit e96b2933152fd87b6a41765b2f58b158fde855b6 ]
If the module is in SFP_MOD_ERROR, sfp_sm_mod_remove() will not be run. As a consequence, sfp_hwmon_remove() is not getting run either, leaving a stale hwmon device behind. sfp_sm_mod_remove() itself checks sfp->sm_mod_state anyways, so this check was not really needed in the first place.
--- drivers/net/phy/sfp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/phy/sfp.c +1 -2
@@ -2004,8 +2004,7 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)/* Handle remove event globally, it resets this state machine */ if (event ==SFP_E_REMOVE ) { -if (sfp->sm_mod_state >SFP_MOD_PROBE ) -sfp_sm_mod_remove (sfp); +sfp_sm_mod_remove (sfp);sfp_sm_mod_next (sfp,SFP_MOD_EMPTY ,0 );return ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 98/356 net: hns3: fix kernel crash problem in concurrent scenario
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonglong Liu <[email protected]>
[ Upstream commit 12cda920212a49fa22d9e8b9492ac4ea013310a4 ]
When link status change, the nic driver need to notify the roce driver to handle this event, but at this time, the roce driver may uninit, then cause kernel crash.
To fix the problem, when link status change, need to check whether the roce registered, and when uninit, need to wait link update finish.
--- .../hisilicon/hns3/hns3pf/hclge_main.c | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +16 -5
@@ -2948,9 +2948,7 @@ static void hclge_push_link_status(struct hclge_dev *hdev)static void hclge_update_link_status (struct hclge_dev *hdev) { -struct hnae3_handle *rhandle = &hdev->vport[0 ].roce;struct hnae3_handle *handle = &hdev->vport[0 ].nic; -struct hnae3_client *rclient = hdev->roce_client;struct hnae3_client *client = hdev->nic_client;int state;int ret;
@@ -2974,8 +2972,15 @@ static void hclge_update_link_status(struct hclge_dev *hdev) client->ops->link_status_change (handle, state);hclge_config_mac_tnl_int (hdev, state); -if (rclient && rclient->ops->link_status_change) - rclient->ops->link_status_change (rhandle, state); + +if (test_bit (HCLGE_STATE_ROCE_REGISTERED , &hdev->state)) { +struct hnae3_handle *rhandle = &hdev->vport[0 ].roce; +struct hnae3_client *rclient = hdev->roce_client; + +if (rclient && rclient->ops->link_status_change) + rclient->ops->link_status_change (rhandle, + state); + }hclge_push_link_status (hdev); }
@@ -11431,6 +11436,12 @@ static int hclge_init_client_instance(struct hnae3_client *client,return ret; } +static bool hclge_uninit_need_wait (struct hclge_dev *hdev) +{ +return test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state) || +test_bit (HCLGE_STATE_LINK_UPDATING , &hdev->state); +} +static void hclge_uninit_client_instance (struct hnae3_client *client,struct hnae3_ae_dev *ae_dev) {
@@ -11439,7 +11450,7 @@ static void hclge_uninit_client_instance(struct hnae3_client *client,if (hdev->roce_client) {clear_bit (HCLGE_STATE_ROCE_REGISTERED , &hdev->state); -while (test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state)) +while (hclge_uninit_need_wait (hdev))msleep (HCLGE_WAIT_RESET_DONE ); hdev->roce_client->ops->uninit_instance (&vport->roce,0 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 99/356 net: hns3: add cond_resched() to hns3 ring buffer init process
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jie Wang <[email protected]>
[ Upstream commit 968fde83841a8c23558dfbd0a0c69d636db52b55 ]
Currently hns3 ring buffer init process would hold cpu too long with big Tx/Rx ring depth. This could cause soft lockup.
So this patch adds cond_resched() to the process. Then cpu can break to run other tasks instead of busy looping.
--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 ++++ drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 2 ++ 2 files changed, 6 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +4 -0
@@ -3342,6 +3342,9 @@ static int hns3_alloc_ring_buffers(struct hns3_enet_ring *ring) ret =hns3_alloc_and_attach_buffer (ring, i);if (ret) goto out_buffer_fail; + +if (!(i %HNS3_RESCHED_BD_NUM )) +cond_resched (); }return 0 ;
@@ -4887,6 +4890,7 @@ int hns3_init_all_ring(struct hns3_nic_priv *priv) }u64_stats_init (&priv->ring[i].syncp); +cond_resched (); }return 0 ;
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +2 -0
@@ -206,6 +206,8 @@ enum hns3_nic_state {#define HNS3_CQ_MODE_EQE 1U#define HNS3_CQ_MODE_CQE 0U +#define HNS3_RESCHED_BD_NUM 1024 +enum hns3_pkt_l2t_type {HNS3_L2_TYPE_UNICAST ,HNS3_L2_TYPE_MULTICAST ,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 100/356 liquidio: Adjust a NULL pointer handling path in lio_vf_rep_copy_packet
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit c44711b78608c98a3e6b49ce91678cd0917d5349 ]
In lio_vf_rep_copy_packet() pg_info->page is compared to a NULL value, but then it is unconditionally passed to skb_add_rx_frag() which looks strange and could lead to null pointer dereference.
lio_vf_rep_copy_packet() call trace looks like:
octeon_droq_process_packets
octeon_droq_fast_process_packets
octeon_droq_dispatch_pkt
octeon_create_recv_info
...search in the dispatch_list...
->disp_fn(rdisp->rinfo, ...)
lio_vf_rep_pkt_recv(struct octeon_recv_info *recv_info, ...)
In this path there is no code which sets pg_info->page to NULL. So this check looks unneeded and doesn't solve potential problem. But I guess the author had reason to add a check and I have no such card and can't do real test.
In addition, the code in the function liquidio_push_packet() in liquidio/lio_core.c does exactly the same.
Based on this, I consider the most acceptable compromise solution to adjust this issue by moving skb_add_rx_frag() into conditional scope.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c +5 -6
@@ -272,13 +272,12 @@ lio_vf_rep_copy_packet(struct octeon_device *oct, pg_info->page_offset;memcpy (skb->data, va,MIN_SKB_SIZE );skb_put (skb,MIN_SKB_SIZE ); +skb_add_rx_frag (skb,skb_shinfo (skb)->nr_frags, + pg_info->page, + pg_info->page_offset +MIN_SKB_SIZE , + len -MIN_SKB_SIZE , +LIO_RXBUFFER_SZ ); } - -skb_add_rx_frag (skb,skb_shinfo (skb)->nr_frags, - pg_info->page, - pg_info->page_offset +MIN_SKB_SIZE , - len -MIN_SKB_SIZE , -LIO_RXBUFFER_SZ ); }else {struct octeon_skb_page_info *pg_info = ((struct octeon_skb_page_info *)(skb->cb));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 101/356 drm/komeda: check for error-valued pointer
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amjad Ouled-Ameur <[email protected]>
[ Upstream commit b880018edd3a577e50366338194dee9b899947e0 ]
komeda_pipeline_get_state() may return an error-valued pointer, thus check the pointer for negative or null value before dereferencing.
--- drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +1 -1
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,u32 avail_scalers; pipe_st =komeda_pipeline_get_state (c->pipeline, state); -if (!pipe_st) +if (IS_ERR_OR_NULL (pipe_st))return NULL ; avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 102/356 drm/bridge/panel: Fix runtime warning on panel bridge release
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Miotk <[email protected]>
[ Upstream commit ce62600c4dbee8d43b02277669dd91785a9b81d9 ]
Device managed panel bridge wrappers are created by calling to drm_panel_bridge_add_typed() and registering a release handler for clean-up when the device gets unbound.
Since the memory for this bridge is also managed and linked to the panel device, the release function should not try to free that memory. Moreover, the call to devm_kfree() inside drm_panel_bridge_remove() will fail in this case and emit a warning because the panel bridge resource is no longer on the device resources list (it has been removed from there before the call to release handlers).
--- drivers/gpu/drm/bridge/panel.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/panel.c +5 -2
@@ -253,9 +253,12 @@ EXPORT_SYMBOL(drm_panel_bridge_remove);static void devm_drm_panel_bridge_release (struct device *dev,void *res) { -struct drm_bridge **bridge = res; +struct drm_bridge *bridge = *(struct drm_bridge **)res; -drm_panel_bridge_remove (*bridge); +if (!bridge) +return ; + +drm_bridge_remove (bridge); }/**
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 103/356 tcp: fix race in tcp_v6_syn_recv_sock()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d37fe4255abe8e7b419b90c5847e8ec2b8debb08 ]
tcp_v6_syn_recv_sock() calls ip6_dst_store() before inet_sk(newsk)->pinet6 has been set up.
This means ip6_dst_store() writes over the parent (listener) np->dst_cookie.
This is racy because multiple threads could share the same parent and their final np->dst_cookie could be wrong.
Move ip6_dst_store() call after inet_sk(newsk)->pinet6 has been changed and after the copy of parent ipv6_pinfo.
--- net/ipv6/tcp_ipv6.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/tcp_ipv6.c +2 -1
@@ -1331,7 +1331,6 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff **/ newsk->sk_gso_type =SKB_GSO_TCPV6 ; -ip6_dst_store (newsk, dst,NULL ,NULL );inet6_sk_rx_dst_set (newsk, skb);inet_sk (newsk)->pinet6 =tcp_inet6_sk (newsk);
@@ -1342,6 +1341,8 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *memcpy (newnp, np,sizeof (struct ipv6_pinfo )); +ip6_dst_store (newsk, dst,NULL ,NULL ); + newsk->sk_v6_daddr = ireq->ir_v6_rmt_addr; newnp->saddr = ireq->ir_v6_loc_addr; newsk->sk_v6_rcv_saddr = ireq->ir_v6_loc_addr;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 104/356 net/mlx5e: Fix features validation check for tunneled UDP (non-VXLAN) packets
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <[email protected]>
[ Upstream commit 791b4089e326271424b78f2fae778b20e53d071b ]
Move the vxlan_features_check() call to after we verified the packet is a tunneled VXLAN packet.
Without this, tunneled UDP non-VXLAN packets (for ex. GENENVE) might wrongly not get offloaded.
In some cases, it worked by chance as GENEVE header is the same size as VXLAN, but it is obviously incorrect.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -2
@@ -3989,7 +3989,7 @@ static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv,/* Verify if UDP port is being offloaded by HW */ if (mlx5_vxlan_lookup_port (priv->mdev->vxlan, port)) -return features; +return vxlan_features_check (skb, features);#if IS_ENABLED (CONFIG_GENEVE )/* Support Geneve offload for default UDP port */
@@ -4015,7 +4015,6 @@ netdev_features_t mlx5e_features_check(struct sk_buff *skb,struct mlx5e_priv *priv =netdev_priv (netdev); features =vlan_features_check (skb, features); - features =vxlan_features_check (skb, features);/* Validate if the tunneled packet is being offloaded by HW */ if (skb->encapsulation &&
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 78/356 xhci: Set correct transferred length for cancelled bulk transfers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit f0260589b439e2637ad54a2b25f00a516ef28a57 upstream.
The transferred length is set incorrectly for cancelled bulk transfer TDs in case the bulk transfer ring stops on the last transfer block with a 'Stop - Length Invalid' completion code.
length essentially ends up being set to the requested length:urb->actual_length = urb->transfer_buffer_length
Length for 'Stop - Length Invalid' cases should be the sum of all TRB transfer block lengths up to the one the ring stopped on, _excluding_ the one stopped on.
Fix this by always summing up TRB lengths for 'Stop - Length Invalid' bulk cases.
This issue was discovered by Alan Stern while debugging
https://bugzilla.kernel.org/show_bug.cgi?id=218890, but does not solve that bug. Issue is older than 4.10 kernel but fix won't apply to those due to major reworks in that area.
--- drivers/usb/host/xhci-ring.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-ring.c +2 -3
@@ -2570,9 +2570,8 @@ static int process_bulk_intr_td(struct x goto finish_td;case COMP_STOPPED_LENGTH_INVALID :/* stopped on ep trb with invalid length, exclude it */ - ep_trb_len =0 ; - remaining =0 ; -break ; + td->urb->actual_length =sum_trb_lengths (xhci, ep_ring, ep_trb); + goto finish_td;case COMP_USB_TRANSACTION_ERROR : if (xhci->quirks & XHCI_NO_SOFT_RETRY || (ep->err_count++ > MAX_SOFT_RETRY) ||
Greg Kroah-Hartman
maintainerPATCH 105/356 Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 806a5198c05987b748b50f3d0c0cfb3d417381a4 ]
This removes the bogus check for max > hcon->le_conn_max_interval since the later is just the initial maximum conn interval not the maximum the stack could support which is really 3200=4000ms.
In order to pass GAP/CONN/CPUP/BV-05-C one shall probably enter values of the following fields in IXIT that would cause hci_check_conn_params to fail:
TSPX_conn_update_int_minTSPX_conn_update_int_maxTSPX_conn_update_peripheral_latencyTSPX_conn_update_supervision_timeout
--- include/net/bluetooth/hci_core.h | 36 ++++++++++++++++++++++++++++---- net/bluetooth/l2cap_core.c | 8 +------ 2 files changed, 33 insertions(+), 11 deletions(-)
include/net/bluetooth/hci_core.h +32 -4
@@ -1690,18 +1690,46 @@ static inline int hci_check_conn_params(u16 min, u16 max, u16 latency, {u16 max_latency; -if (min > max || min <6 || max >3200 ) +if (min > max) { +BT_WARN ("min %d > max %d" , min, max);return -EINVAL ; + } + +if (min <6 ) { +BT_WARN ("min %d < 6" , min); +return -EINVAL ; + } + +if (max >3200 ) { +BT_WARN ("max %d > 3200" , max); +return -EINVAL ; + } + +if (to_multiplier <10 ) { +BT_WARN ("to_multiplier %d < 10" , to_multiplier); +return -EINVAL ; + } -if (to_multiplier <10 || to_multiplier >3200 ) +if (to_multiplier >3200 ) { +BT_WARN ("to_multiplier %d > 3200" , to_multiplier);return -EINVAL ; + } -if (max >= to_multiplier *8 ) +if (max >= to_multiplier *8 ) { +BT_WARN ("max %d >= to_multiplier %d * 8" , max, to_multiplier);return -EINVAL ; + } max_latency = (to_multiplier *4 / max) -1 ; -if (latency >499 || latency > max_latency) +if (latency >499 ) { +BT_WARN ("latency %d > 499" , latency);return -EINVAL ; + } + +if (latency > max_latency) { +BT_WARN ("latency %d > max_latency %d" , latency, max_latency); +return -EINVAL ; + }return 0 ; }
net/bluetooth/l2cap_core.c +1 -7
@@ -5617,13 +5617,7 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,memset (&rsp,0 ,sizeof (rsp)); -if (max > hcon->le_conn_max_interval) { -BT_DBG ("requested connection interval exceeds current bounds." ); - err = -EINVAL ; - }else { - err =hci_check_conn_params (min, max, latency, to_multiplier); - } - + err =hci_check_conn_params (min, max, latency, to_multiplier);if (err) rsp.result =cpu_to_le16 (L2CAP_CONN_PARAM_REJECTED );else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 106/356 netfilter: ipset: Fix race between namespace cleanup and gc in the list:set type
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jozsef Kadlecsik <[email protected]>
[ Upstream commit 4e7aaa6b82d63e8ddcbfb56b4fd3d014ca586f10 ]
Lion Ackermann reported that there is a race condition between namespace cleanup in ipset and the garbage collection of the list:set type. The namespace cleanup can destroy the list:set type of sets while the gc of the set type is waiting to run in rcu cleanup. The latter uses data from the destroyed set which thus leads use after free. The patch contains the following parts:
- When destroying all sets, first remove the garbage collectors, then wait if needed and then destroy the sets.
- Fix the badly ordered "wait then remove gc" for the destroy a single set case.
- Fix the missing rcu locking in the list:set type in the userspace test case.
- Use proper RCU list handlings in the list:set type.
The patch depends on c1193d9bbbd3 (netfilter: ipset: Add list flush to cancel_gc).
--- net/netfilter/ipset/ip_set_core.c | 81 +++++++++++++++------------ net/netfilter/ipset/ip_set_list_set.c | 30 +++++----- 2 files changed, 60 insertions(+), 51 deletions(-)
net/netfilter/ipset/ip_set_core.c +46 -35
@@ -1174,23 +1174,50 @@ ip_set_setname_policy[IPSET_ATTR_CMD_MAX + 1] = { .len = IPSET_MAXNAMELEN - 1 }, }; +/* In order to return quickly when destroying a single set, it is split +* into two stages: +* - Cancel garbage collector +* - Destroy the set itself via call_rcu() +*/ +static void -ip_set_destroy_set (struct ip_set *set) +ip_set_destroy_set_rcu (struct rcu_head *head) { -pr_debug ("set: %s\n" , set->name); + struct ip_set *set = container_of(head, struct ip_set, rcu); -/* Must call it without holding any lock */ set->variant->destroy (set);module_put (set->type->me);kfree (set); }static void -ip_set_destroy_set_rcu (struct rcu_head *head) +_destroy_all_sets (struct ip_set_net *inst) { - struct ip_set *set = container_of(head, struct ip_set, rcu); +struct ip_set *set; +ip_set_id_t i; +bool need_wait = false; -ip_set_destroy_set (set); +/* First cancel gc's: set:list sets are flushed as well */ +for (i =0 ; i < inst->ip_set_max; i++) { + set =ip_set (inst, i); +if (set) { + set->variant->cancel_gc (set); +if (set->type->features &IPSET_TYPE_NAME ) + need_wait = true; + } + } +/* Must wait for flush to be really finished */ +if (need_wait) +rcu_barrier (); +for (i =0 ; i < inst->ip_set_max; i++) { + set =ip_set (inst, i); +if (set) { +ip_set (inst, i) =NULL ; + set->variant->destroy (set); +module_put (set->type->me); +kfree (set); + } + } } static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info,
@@ -1204,11 +1231,10 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info,if (unlikely (protocol_min_failed (attr)))return -IPSET_ERR_PROTOCOL ; -/* Commands are serialized and references are * protected by the ip_set_ref_lock. * External systems (i.e. xt_set) must call -* ip_set_put|get_nfnl_* functions, that way we +* ip_set_nfnl_get_* functions, that way we * can safely check references here. * * list:set timer can only decrement the reference
@@ -1216,8 +1242,6 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info,* without holding the lock. */ if (!attr[IPSET_ATTR_SETNAME ]) { -/* Must wait for flush to be really finished in list:set */ -rcu_barrier ();read_lock_bh (&ip_set_ref_lock);for (i =0 ; i < inst->ip_set_max; i++) { s =ip_set (inst, i);
@@ -1228,15 +1252,7 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, } inst->is_destroyed = true;read_unlock_bh (&ip_set_ref_lock); -for (i =0 ; i < inst->ip_set_max; i++) { - s =ip_set (inst, i); -if (s) { -ip_set (inst, i) =NULL ; -/* Must cancel garbage collectors */ - s->variant->cancel_gc (s); -ip_set_destroy_set (s); - } - } +_destroy_all_sets (inst);/* Modified by ip_set_destroy() only, which is serialized */ inst->is_destroyed = false; }else {
@@ -1257,12 +1273,12 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, features = s->type->features;ip_set (inst, i) =NULL ;read_unlock_bh (&ip_set_ref_lock); +/* Must cancel garbage collectors */ + s->variant->cancel_gc (s);if (features &IPSET_TYPE_NAME ) {/* Must wait for flush to be really finished */ rcu_barrier (); } -/* Must cancel garbage collectors */ - s->variant->cancel_gc (s);call_rcu (&s->rcu, ip_set_destroy_set_rcu); }return 0 ;
@@ -2365,30 +2381,25 @@ ip_set_net_init(struct net *net) } static void __net_exit -ip_set_net_exit (struct net *net) +ip_set_net_pre_exit (struct net *net) {struct ip_set_net *inst =ip_set_pernet (net); -struct ip_set *set =NULL ; -ip_set_id_t i; - inst->is_deleted = true;/* flag for ip_set_nfnl_put */ +} -nfnl_lock (NFNL_SUBSYS_IPSET ); -for (i =0 ; i < inst->ip_set_max; i++) { - set =ip_set (inst, i); -if (set) { -ip_set (inst, i) =NULL ; - set->variant->cancel_gc (set); -ip_set_destroy_set (set); - } - } -nfnl_unlock (NFNL_SUBSYS_IPSET ); +static void __net_exit +ip_set_net_exit (struct net *net) +{ +struct ip_set_net *inst =ip_set_pernet (net); + +_destroy_all_sets (inst);kvfree (rcu_dereference_protected (inst->ip_set_list,1 )); }static struct pernet_operations ip_set_net_ops = { .init = ip_set_net_init, + .pre_exit = ip_set_net_pre_exit, .exit = ip_set_net_exit, .id = &ip_set_net_id, .size =sizeof (struct ip_set_net ),
net/netfilter/ipset/ip_set_list_set.c +14 -16
@@ -79,7 +79,7 @@ list_set_kadd(struct ip_set *set, const struct sk_buff *skb,struct set_elem *e;int ret; -list_for_each_entry (e, &map->members, list) { +list_for_each_entry_rcu (e, &map->members, list) {if (SET_WITH_TIMEOUT (set) &&ip_set_timeout_expired (ext_timeout (e, set)))continue ;
@@ -99,7 +99,7 @@ list_set_kdel(struct ip_set *set, const struct sk_buff *skb,struct set_elem *e;int ret; -list_for_each_entry (e, &map->members, list) { +list_for_each_entry_rcu (e, &map->members, list) {if (SET_WITH_TIMEOUT (set) &&ip_set_timeout_expired (ext_timeout (e, set)))continue ;
@@ -188,9 +188,10 @@ list_set_utest(struct ip_set *set, void *value, const struct ip_set_ext *ext,struct list_set *map = set->data;struct set_adt_elem *d = value;struct set_elem *e, *next, *prev =NULL ; -int ret; +int ret =0 ; -list_for_each_entry (e, &map->members, list) { +rcu_read_lock (); +list_for_each_entry_rcu (e, &map->members, list) {if (SET_WITH_TIMEOUT (set) &&ip_set_timeout_expired (ext_timeout (e, set)))continue ;
@@ -201,6 +202,7 @@ list_set_utest(struct ip_set *set, void *value, const struct ip_set_ext *ext,if (d->before ==0 ) { ret =1 ; + goto out; }else if (d->before >0 ) { next =list_next_entry (e, list); ret = !list_is_last(&e->list, &map->members) &&
@@ -208,9 +210,11 @@ list_set_utest(struct ip_set *set, void *value, const struct ip_set_ext *ext, }else { ret = prev && prev->id == d->refid; } -return ret; + goto out; } -return 0 ; +out: +rcu_read_unlock (); +return ret; } static void
@@ -239,7 +243,7 @@ list_set_uadd(struct ip_set *set, void *value, const struct ip_set_ext *ext,/* Find where to add the new entry */ n = prev = next =NULL ; -list_for_each_entry (e, &map->members, list) { +list_for_each_entry_rcu (e, &map->members, list) {if (SET_WITH_TIMEOUT (set) &&ip_set_timeout_expired (ext_timeout (e, set)))continue ;
@@ -316,9 +320,9 @@ list_set_udel(struct ip_set *set, void *value, const struct ip_set_ext *ext, {struct list_set *map = set->data;struct set_adt_elem *d = value; -struct set_elem *e, *next, *prev =NULL ; +struct set_elem *e, *n, *next, *prev =NULL ; -list_for_each_entry (e, &map->members, list) { +list_for_each_entry_safe (e, n, &map->members, list) {if (SET_WITH_TIMEOUT (set) &&ip_set_timeout_expired (ext_timeout (e, set)))continue ;
@@ -424,14 +428,8 @@ static void list_set_destroy(struct ip_set *set) {struct list_set *map = set->data; -struct set_elem *e, *n; -list_for_each_entry_safe (e, n, &map->members, list) { -list_del (&e->list); -ip_set_put_byindex (map->net, e->id); -ip_set_ext_destroy (set, e); -kfree (e); - } +WARN_ON_ONCE (!list_empty (&map->members));kfree (map); set->data =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 107/356 net: stmmac: replace priv->speed with the portTransmitRate from the tc-cbs parameters
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaolei Wang <[email protected]>
[ Upstream commit be27b896529787e23a35ae4befb6337ce73fcca0 ]
The current cbs parameter depends on speed after uplinking, which is not needed and will report a configuration error if the port is not initially connected. The UAPI exposed by tc-cbs requires userspace to recalculate the send slope anyway, because the formula depends on port_transmit_rate (see man tc-cbs), which is not an invariant from tc's perspective. Therefore, we use offload->sendslope and offload->idleslope to derive the original port_transmit_rate from the CBS formula.
--- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +11 -14
@@ -341,10 +341,11 @@ static int tc_setup_cbs(struct stmmac_priv *priv, struct tc_cbs_qopt_offload *qopt) {u32 tx_queues_count = priv->plat->tx_queues_to_use; +s64 port_transmit_rate_kbps;u32 queue = qopt->queue; -u32 ptr, speed_div;u32 mode_to_use;u64 value; +u32 ptr;int ret;/* Queue 0 is not AVB capable */
@@ -353,30 +354,26 @@ static int tc_setup_cbs(struct stmmac_priv *priv,if (!priv->dma_cap.av)return -EOPNOTSUPP ; + port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope; +/* Port Transmit Rate and Speed Divider */ -switch (priv->speed) { +switch (div_s64 (port_transmit_rate_kbps,1000 )) {case SPEED_10000 : - ptr =32 ; - speed_div =10000000 ; -break ;case SPEED_5000 : ptr =32 ; - speed_div =5000000 ;break ;case SPEED_2500 : - ptr =8 ; - speed_div =2500000 ; -break ;case SPEED_1000 : ptr =8 ; - speed_div =1000000 ;break ;case SPEED_100 : ptr =4 ; - speed_div =100000 ;break ;default : -return -EOPNOTSUPP ; +netdev_err (priv->dev, +"Invalid portTransmitRate %lld (idleSlope - sendSlope)\n" , + port_transmit_rate_kbps); +return -EINVAL ; } mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use;
@@ -396,10 +393,10 @@ static int tc_setup_cbs(struct stmmac_priv *priv, }/* Final adjustments for HW */ - value =div_s64 (qopt->idleslope *1024ll * ptr, speed_div); + value =div_s64 (qopt->idleslope *1024ll * ptr, port_transmit_rate_kbps); priv->plat->tx_queues_cfg[queue].idle_slope = value &GENMASK (31 ,0 ); - value =div_s64 (-qopt->sendslope *1024ll * ptr, speed_div); + value =div_s64 (-qopt->sendslope *1024ll * ptr, port_transmit_rate_kbps); priv->plat->tx_queues_cfg[queue].send_slope = value &GENMASK (31 ,0 ); value = qopt->hicredit *1024ll *8 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 79/356 xhci: Apply reset resume quirk to Etron EJ188 xHCI host
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuangyi Chiang <[email protected]>
commit 17bd54555c2aaecfdb38e2734149f684a73fa584 upstream.
As described in commit c877b3b2ad5c ("xhci: Add reset on resume quirk for asrock p67 host"), EJ188 have the same issue as EJ168, where completely dies on resume. So apply XHCI_RESET_ON_RESUME quirk to EJ188 as well.
--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/host/xhci-pci.c +5 -0
@@ -36,6 +36,7 @@#define PCI_VENDOR_ID_ETRON 0x1b6f#define PCI_DEVICE_ID_EJ168 0x7023 +#define PCI_DEVICE_ID_EJ188 0x7052#define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31
@@ -276,6 +277,10 @@ static void xhci_pci_quirks(struct devic xhci->quirks |=XHCI_TRUST_TX_LENGTH ; xhci->quirks |=XHCI_BROKEN_STREAMS ; } +if (pdev->vendor ==PCI_VENDOR_ID_ETRON && + pdev->device ==PCI_DEVICE_ID_EJ188 ) + xhci->quirks |=XHCI_RESET_ON_RESUME ; +if (pdev->vendor ==PCI_VENDOR_ID_RENESAS && pdev->device ==0x0014 ) { xhci->quirks |=XHCI_TRUST_TX_LENGTH ;
Greg Kroah-Hartman
maintainerPATCH 80/356 xhci: Handle TD clearing for multiple streams case
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
commit 5ceac4402f5d975e5a01c806438eb4e554771577 upstream.
When multiple streams are in use, multiple TDs might be in flight when an endpoint is stopped. We need to issue a Set TR Dequeue Pointer for each, to ensure everything is reset properly and the caches cleared. Change the logic so that any N>1 TDs found active for different streams are deferred until after the first one is processed, calling xhci_invalidate_cancelled_tds() again from xhci_handle_cmd_set_deq() to queue another command until we are done with all of them. Also change the error/"should never happen" paths to ensure we at least clear any affected TDs, even if we can't issue a command to clear the hardware cache, and complain loudly with an xhci_warn() if this ever happens.
This problem case dates back to commit e9df17eb1408 ("USB: xhci: Correct assumptions about number of rings per endpoint.") early on in the XHCI driver's life, when stream support was first added.
It was then identified but not fixed nor made into a warning in commit 674f8438c121 ("xhci: split handling halted endpoints into two steps"), which added a FIXME comment for the problem case (without materially changing the behavior as far as I can tell, though the new logic made the problem more obvious).
Then later, in commit 94f339147fc3 ("xhci: Fix failure to give back some cached cancelled URBs."), it was acknowledged again.
[Mathias: commit 94f339147fc3 ("xhci: Fix failure to give back some cached cancelled URBs.") was a targeted regression fix to the previously mentioned patch. Users reported issues with usb stuck after unmounting/disconnecting UAS devices. This rolled back the TD clearing of multiple streams to its original state.]
Apparently the commit author was aware of the problem (yet still chose to submit it): It was still mentioned as a FIXME, an xhci_dbg() was added to log the problem condition, and the remaining issue was mentioned in the commit description. The choice of making the log type xhci_dbg() for what is, at this point, a completely unhandled and known broken condition is puzzling and unfortunate, as it guarantees that no actual users would see the log in production, thereby making it nigh undebuggable (indeed, even if you turn on DEBUG, the message doesn't really hint at there being a problem at all).
It took me *months* of random xHC crashes to finally find a reliable repro and be able to do a deep dive debug session, which could all have been avoided had this unhandled, broken condition been actually reported with a warning, as it should have been as a bug intentionally left in unfixed (never mind that it shouldn't have been left in at all).
Quoted 2 lines
Another fix to solve clearing the caches of all stream rings with cancelled TDs is needed, but not as urgent.
3 years after that statement and 14 years after the original bug was introduced, I think it's finally time to fix it. And maybe next time let's not leave bugs unfixed (that are actually worse than the original bug), and let's actually get people to review kernel commits please.
Fixes xHC crashes and IOMMU faults with UAS devices when handling errors/faults. Easiest repro is to use hdparm to mark an early sector (e.g. 1024) on a disk as bad, then cat /dev/sdX > /dev/null in a loop. At least in the case of JMicron controllers, the read errors end up having to cancel two TDs (for two queued requests to different streams) and the one that didn't get cleared properly ends up faulting the xHC entirely when it tries to access DMA pages that have since been unmapped, referred to by the stale TDs. This normally happens quickly (after two or three loops). After this fix, I left the cat in a loop running overnight and experienced no xHC failures, with all read errors recovered properly. Repro'd and tested on an Apple M1 Mac Mini (dwc3 host).
On systems without an IOMMU, this bug would instead silently corrupt freed memory, making this a security bug (even on systems with IOMMUs this could silently corrupt memory belonging to other USB devices on the same controller, so it's still a security bug). Given that the kernel autoprobes partition tables, I'm pretty sure a malicious USB device pretending to be a UAS device and reporting an error with the right timing could deliberately trigger a UAF and write to freed memory, with no user action.
[Mathias: Commit message and code comment edit, original at:]
https://lore.kernel.org/linux-usb/[email protected]/
--- drivers/usb/host/xhci-ring.c | 54 ++++++++++++++++++++++++++++++++++--------- drivers/usb/host/xhci.h | 1 2 files changed, 44 insertions(+), 11 deletions(-)
drivers/usb/host/xhci-ring.c +43 -11
@@ -994,13 +994,27 @@ static int xhci_invalidate_cancelled_tdsbreak ;case TD_DIRTY :/* TD is cached, clear it */ case TD_HALTED : +case TD_CLEARING_CACHE_DEFERRED : +if (cached_td) { +if (cached_td->urb->stream_id != td->urb->stream_id) { +/* Multiple streams case, defer move dq */ +xhci_dbg (xhci, +"Move dq deferred: stream %u URB %p\n" , + td->urb->stream_id, td->urb); + td->cancel_status =TD_CLEARING_CACHE_DEFERRED ; +break ; + } + +/* Should never happen, but clear the TD if it does */ +xhci_warn (xhci, +"Found multiple active URBs %p and %p in stream %u?\n" , + td->urb, cached_td->urb, + td->urb->stream_id); +td_to_noop (xhci, ring, cached_td, false); + cached_td->cancel_status =TD_CLEARED ; + } + td->cancel_status =TD_CLEARING_CACHE ; -if (cached_td) -/* FIXME stream case, several stopped rings */ -xhci_dbg (xhci, -"Move dq past stream %u URB %p instead of stream %u URB %p\n" , - td->urb->stream_id, td->urb, - cached_td->urb->stream_id, cached_td->urb); cached_td = td;break ; }
@@ -1020,10 +1034,16 @@ static int xhci_invalidate_cancelled_tdsif (err) {/* Failed to move past cached td, just set cached TDs to no-op */ list_for_each_entry_safe (td, tmp_td, &ep->cancelled_td_list, cancelled_td_list) { -if (td->cancel_status !=TD_CLEARING_CACHE ) +/* +* Deferred TDs need to have the deq pointer set after the above command +* completes, so if that failed we just give up on all of them (and +* complain loudly since this could cause issues due to caching). +*/ +if (td->cancel_status !=TD_CLEARING_CACHE && + td->cancel_status !=TD_CLEARING_CACHE_DEFERRED )continue ; -xhci_dbg (xhci,"Failed to clear cancelled cached URB %p, mark clear anyway\n" , - td->urb); +xhci_warn (xhci,"Failed to clear cancelled cached URB %p, mark clear anyway\n" , + td->urb);td_to_noop (xhci, ring, td, false); td->cancel_status =TD_CLEARED ; }
@@ -1366,6 +1386,7 @@ static void xhci_handle_cmd_set_deq(strustruct xhci_ep_ctx *ep_ctx;struct xhci_slot_ctx *slot_ctx;struct xhci_td *td, *tmp_td; +bool deferred = false; ep_index =TRB_TO_EP_INDEX (le32_to_cpu (trb->generic.field[3 ])); stream_id =TRB_TO_STREAM_ID (le32_to_cpu (trb->generic.field[2 ]));
@@ -1452,6 +1473,8 @@ static void xhci_handle_cmd_set_deq(struxhci_dbg (ep->xhci,"%s: Giveback cancelled URB %p TD\n" , __func__, td->urb);xhci_td_cleanup (ep->xhci, td, ep_ring, td->status); + }else if (td->cancel_status ==TD_CLEARING_CACHE_DEFERRED ) { + deferred = true; }else {xhci_dbg (ep->xhci,"%s: Keep cancelled URB %p TD as cancel_status is %d\n" , __func__, td->urb, td->cancel_status);
@@ -1461,8 +1484,17 @@ cleanup: ep->ep_state &= ~SET_DEQ_PENDING ; ep->queued_deq_seg =NULL ; ep->queued_deq_ptr =NULL ; -/* Restart any rings with pending URBs */ -ring_doorbell_for_active_rings (xhci, slot_id, ep_index); + +if (deferred) { +/* We have more streams to clear */ +xhci_dbg (ep->xhci,"%s: Pending TDs to clear, continuing with invalidation\n" , + __func__); +xhci_invalidate_cancelled_tds (ep); + }else { +/* Restart any rings with pending URBs */ +xhci_dbg (ep->xhci,"%s: All TDs cleared, ring doorbell\n" , __func__); +ring_doorbell_for_active_rings (xhci, slot_id, ep_index); + } } static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id,
drivers/usb/host/xhci.h +1 -0
@@ -1556,6 +1556,7 @@ enum xhci_cancelled_td_status {TD_DIRTY =0 ,TD_HALTED ,TD_CLEARING_CACHE , +TD_CLEARING_CACHE_DEFERRED , TD_CLEARED, };
Greg Kroah-Hartman
maintainerPATCH 81/356 xhci: Apply broken streams quirk to Etron EJ188 xHCI host
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuangyi Chiang <[email protected]>
commit 91f7a1524a92c70ffe264db8bdfa075f15bbbeb9 upstream.
As described in commit 8f873c1ff4ca ("xhci: Blacklist using streams on the Etron EJ168 controller"), EJ188 have the same issue as EJ168, where Streams do not work reliable on EJ188. So apply XHCI_BROKEN_STREAMS quirk to EJ188 as well.
--- drivers/usb/host/xhci-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +3 -1
@@ -278,8 +278,10 @@ static void xhci_pci_quirks(struct devic xhci->quirks |=XHCI_BROKEN_STREAMS ; }if (pdev->vendor ==PCI_VENDOR_ID_ETRON && - pdev->device ==PCI_DEVICE_ID_EJ188 ) + pdev->device ==PCI_DEVICE_ID_EJ188 ) { xhci->quirks |=XHCI_RESET_ON_RESUME ; + xhci->quirks |=XHCI_BROKEN_STREAMS ; + }if (pdev->vendor ==PCI_VENDOR_ID_RENESAS && pdev->device ==0x0014 ) {
Greg Kroah-Hartman
maintainerPATCH 82/356 scsi: mpt3sas: Avoid test/set_bit() operating in non-allocated memory
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
commit 4254dfeda82f20844299dca6c38cbffcfd499f41 upstream.
There is a potential out-of-bounds access when using test_bit() on a single word. The test_bit() and set_bit() functions operate on long values, and when testing or setting a single word, they can exceed the word boundary. KASAN detects this issue and produces a dump:
BUG: KASAN: slab-out-of-bounds in _scsih_add_device.constprop.0 (./arch/x86/include/asm/bitops.h:60 ./include/asm-generic/bitops/instrumented-atomic.h:29 drivers/scsi/mpt3sas/mpt3sas_scsih.c:7331) mpt3sas Write of size 8 at addr ffff8881d26e3c60 by task kworker/u1536:2/2965
For full log, please look at [1].
Make the allocation at least the size of sizeof(unsigned long) so that set_bit() and test_bit() have sufficient room for read/write operations without overwriting unallocated memory.
[1] Link: https://lore.kernel.org/all/[email protected]/
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_base.c +19 -0
@@ -8337,6 +8337,12 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPT ioc->pd_handles_sz = (ioc->facts.MaxDevHandle /8 );if (ioc->facts.MaxDevHandle %8 ) ioc->pd_handles_sz++; +/* +* pd_handles_sz should have, at least, the minimal room for +* set_bit()/test_bit(), otherwise out-of-memory touch may occur. +*/ + ioc->pd_handles_sz =ALIGN (ioc->pd_handles_sz,sizeof (unsigned long )); + ioc->pd_handles =kzalloc (ioc->pd_handles_sz,GFP_KERNEL );if (!ioc->pd_handles) {
@@ -8354,6 +8360,13 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPT ioc->pend_os_device_add_sz = (ioc->facts.MaxDevHandle /8 );if (ioc->facts.MaxDevHandle %8 ) ioc->pend_os_device_add_sz++; + +/* +* pend_os_device_add_sz should have, at least, the minimal room for +* set_bit()/test_bit(), otherwise out-of-memory may occur. +*/ + ioc->pend_os_device_add_sz =ALIGN (ioc->pend_os_device_add_sz, +sizeof (unsigned long )); ioc->pend_os_device_add =kzalloc (ioc->pend_os_device_add_sz,GFP_KERNEL );if (!ioc->pend_os_device_add) {
@@ -8645,6 +8658,12 @@ _base_check_ioc_facts_changes(struct MPTif (ioc->facts.MaxDevHandle %8 ) pd_handles_sz++; +/* +* pd_handles should have, at least, the minimal room for +* set_bit()/test_bit(), otherwise out-of-memory touch may +* occur. +*/ + pd_handles_sz =ALIGN (pd_handles_sz,sizeof (unsigned long )); pd_handles =krealloc (ioc->pd_handles, pd_handles_sz,GFP_KERNEL );if (!pd_handles) {
Greg Kroah-Hartman
maintainerPATCH 83/356 powerpc/uaccess: Fix build errors seen with GCC 13/14
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 2d43cc701b96f910f50915ac4c2a0cae5deb734c upstream.
Building ppc64le_defconfig with GCC 14 fails with assembler errors:
CC fs/readdir.o
/tmp/ccdQn0mD.s: Assembler messages:
/tmp/ccdQn0mD.s:212: Error: operand out of domain (18 is not a multiple of 4) /tmp/ccdQn0mD.s:226: Error: operand out of domain (18 is not a multiple of 4) ... [6 lines]
/tmp/ccdQn0mD.s:1699: Error: operand out of domain (18 is not a multiple of 4)
A snippet of the asm shows:
# ../fs/readdir.c:210: unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end);
ld 9,0(29) # MEM[(u64 *)name_38(D) + _88 * 1], MEM[(u64 *)name_38(D) + _88 * 1]
# 210 "../fs/readdir.c" 1
1: std 9,18(8) # put_user # *__pus_addr_52, MEM[(u64 *)name_38(D) + _88 * 1]The 'std' instruction requires a 4-byte aligned displacement because it is a DS-form instruction, and as the assembler says, 18 is not a multiple of 4.
A similar error is seen with GCC 13 and CONFIG_UBSAN_SIGNED_WRAP=y.
The fix is to change the constraint on the memory operand to put_user(), from "m" which is a general memory reference to "YZ".
The "Z" constraint is documented in the GCC manual PowerPC machine constraints, and specifies a "memory operand accessed with indexed or indirect addressing". "Y" is not documented in the manual but specifies a "memory operand for a DS-form instruction". Using both allows the compiler to generate a DS-form "std" or X-form "stdx" as appropriate.
The change has to be conditional on CONFIG_PPC_KERNEL_PREFIXED because the "Y" constraint does not guarantee 4-byte alignment when prefixed instructions are enabled.
Unfortunately clang doesn't support the "Y" constraint so that has to be behind an ifdef.
Although the build error is only seen with GCC 13/14, that appears to just be luck. The constraint has been incorrect since it was first added.
--- arch/powerpc/include/asm/uaccess.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/uaccess.h +13 -2
@@ -90,9 +90,20 @@ __pu_failed: \ : \ : label) +#ifdef CONFIG_CC_IS_CLANG +#define DS_FORM_CONSTRAINT "Z<>" +#else +#define DS_FORM_CONSTRAINT "YZ<>" +#endif +#ifdef __powerpc64__ -#define __put_user_asm2_goto (x, ptr, label) \ - __put_user_asm_goto(x, ptr, label, "std") +#define __put_user_asm2_goto (x, addr, label) \ + asm goto ("1: std%U1%X1 %0,%1 # put_user\n" \ + EX_TABLE(1b, %l2) \ + : \ + : "r" (x), DS_FORM_CONSTRAINT (*addr) \ + : \ + : label)#else /* __powerpc64__ */ #define __put_user_asm2_goto (x, addr, label) \ asm_volatile_goto( \
Greg Kroah-Hartman
maintainerPATCH 84/356 Input: try trimming too long modalias strings
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit 0774d19038c496f0c3602fb505c43e1b2d8eed85 upstream.
If an input device declares too many capability bits then modalias string for such device may become too long and not fit into uevent buffer, resulting in failure of sending said uevent. This, in turn, may prevent userspace from recognizing existence of such devices.
This is typically not a concern for real hardware devices as they have limited number of keys, but happen with synthetic devices such as ones created by xen-kbdfront driver, which creates devices as being capable of delivering all possible keys, since it doesn't know what keys the backend may produce.
To deal with such devices input core will attempt to trim key data, in the hope that the rest of modalias string will fit in the given buffer. When trimming key data it will indicate that it is not complete by placing "+," sign, resulting in conversions like this:
old: k71,72,73,74,78,7A,7B,7C,7D,8E,9E,A4,AD,E0,E1,E4,F8,174,
new: k71,72,73,74,78,7A,7B,7C,+,
This should allow existing udev rules continue to work with existing devices, and will also allow writing more complex rules that would recognize trimmed modalias and check input device characteristics by other means (for example by parsing KEY= data in uevent or parsing input device sysfs attributes).
Note that the driver core may try adding more uevent environment variables once input core is done adding its own, so when forming modalias we can not use the entire available buffer, so we reduce it by somewhat an arbitrary amount (96 bytes).
---
--- drivers/input/input.c | 105 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 90 insertions(+), 15 deletions(-)
drivers/input/input.c +90 -15
@@ -1360,19 +1360,19 @@ static int input_print_modalias_bits(cha char name, unsigned long *bm, unsigned int min_bit, unsigned int max_bit) { - int len = 0, i; + int bit = min_bit; +int len =0 ; len +=snprintf (buf,max (size,0 ),"%c" , name); -for (i = min_bit; i < max_bit; i++) -if (bm[BIT_WORD (i)] &BIT_MASK (i)) - len +=snprintf (buf + len,max (size - len,0 ),"%X," , i); +for_each_set_bit_from (bit, bm, max_bit) + len +=snprintf (buf + len,max (size - len,0 ),"%X," , bit);return len; } -static int input_print_modalias (char *buf,int size,struct input_dev *id, -int add_cr) +static int input_print_modalias_parts (char *buf,int size,int full_len, +struct input_dev *id) { -int len; +int len, klen, remainder, space; len = snprintf(buf, max(size, 0), "input:b%04Xv%04Xp%04Xe%04X-",
@@ -1381,8 +1381,49 @@ static int input_print_modalias(char *bu len +=input_print_modalias_bits (buf + len, size - len,'e' , id->evbit,0 ,EV_MAX ); - len +=input_print_modalias_bits (buf + len, size - len, + +/* +* Calculate the remaining space in the buffer making sure we +* have place for the terminating 0. +*/ + space =max (size - (len +1 ),0 ); + + klen =input_print_modalias_bits (buf + len, size - len,'k' , id->keybit,KEY_MIN_INTERESTING ,KEY_MAX ); + len += klen; + +/* +* If we have more data than we can fit in the buffer, check +* if we can trim key data to fit in the rest. We will indicate +* that key data is incomplete by adding "+" sign at the end, like +* this: * "k1,2,3,45,+,". +* +* Note that we shortest key info (if present) is "k+," so we +* can only try to trim if key data is longer than that. +*/ +if (full_len && size < full_len +1 && klen >3 ) { + remainder = full_len - len; +/* +* We can only trim if we have space for the remainder +* and also for at least "k+," which is 3 more characters. +*/ +if (remainder <= space -3 ) { +int i; +/* +* We are guaranteed to have 'k' in the buffer, so +* we need at least 3 additional bytes for storing +* "+," in addition to the remainder. +*/ +for (i = size -1 - remainder -3 ; i >=0 ; i--) { +if (buf[i] =='k' || buf[i] ==',' ) { +strcpy (buf + i +1 ,"+," ); + len = i +3 ;/* Not counting '\0' */ +break ; + } + } + } + } + len +=input_print_modalias_bits (buf + len, size - len,'r' , id->relbit,0 ,REL_MAX ); len += input_print_modalias_bits(buf + len, size - len,
@@ -1398,12 +1439,25 @@ static int input_print_modalias(char *bu len +=input_print_modalias_bits (buf + len, size - len,'w' , id->swbit,0 ,SW_MAX ); -if (add_cr) - len +=snprintf (buf + len,max (size - len,0 ),"\n" ); -return len; } +static int input_print_modalias (char *buf,int size,struct input_dev *id) +{ +int full_len; + +/* +* Printing is done in 2 passes: first one figures out total length +* needed for the modalias string, second one will try to trim key +* data in case when buffer is too small for the entire modalias. +* If the buffer is too small regardless, it will fill as much as it +* can (without trimming key data) into the buffer and leave it to +* the caller to figure out what to do with the result. +*/ + full_len =input_print_modalias_parts (NULL ,0 ,0 , id); +return input_print_modalias_parts (buf, size, full_len, id); +} +static ssize_t input_dev_show_modalias (struct device *dev,struct device_attribute *attr,char *buf)
@@ -1411,7 +1465,9 @@ static ssize_t input_dev_show_modalias(sstruct input_dev *id =to_input_dev (dev);ssize_t len; - len =input_print_modalias (buf,PAGE_SIZE , id,1 ); + len =input_print_modalias (buf,PAGE_SIZE , id); +if (len <PAGE_SIZE -2 ) + len +=snprintf (buf + len,PAGE_SIZE - len,"\n" );return min_t (int, len,PAGE_SIZE ); }
@@ -1623,6 +1679,23 @@ static int input_add_uevent_bm_var(strucreturn 0 ; } +/* +* This is a pretty gross hack. When building uevent data the driver core +* may try adding more environment variables to kobj_uevent_env without +* telling us, so we have no idea how much of the buffer we can use to +* avoid overflows/-ENOMEM elsewhere. To work around this let's artificially +* reduce amount of memory we will use for the modalias environment variable. +* +* The potential additions are: +* +* SEQNUM=18446744073709551615 - (%llu - 28 bytes) +* HOME=/ (6 bytes) +* PATH=/sbin:/bin:/usr/sbin:/usr/bin (34 bytes) +* +* 68 bytes total. Allow extra buffer - 96 bytes +*/ +#define UEVENT_ENV_EXTRA_LEN 96 +static int input_add_uevent_modalias_var (struct kobj_uevent_env *env,struct input_dev *dev) {
@@ -1632,9 +1705,11 @@ static int input_add_uevent_modalias_varreturn -ENOMEM ; len =input_print_modalias (&env->buf[env->buflen -1 ], -sizeof (env->buf) - env->buflen, - dev,0 ); -if (len >= (sizeof (env->buf) - env->buflen)) + (int )sizeof (env->buf) - env->buflen - +UEVENT_ENV_EXTRA_LEN , + dev); +if (len >= ((int )sizeof (env->buf) - env->buflen - +UEVENT_ENV_EXTRA_LEN ))return -ENOMEM ; env->buflen += len;
Greg Kroah-Hartman
maintainerPATCH 75/356 usb: typec: tcpm: Ignore received Hard Reset in TOGGLING state
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Tso <[email protected]>
commit fc8fb9eea94d8f476e15f3a4a7addeb16b3b99d6 upstream.
Similar to what fixed in Commit a6fe37f428c1 ("usb: typec: tcpm: Skip hard reset when in error recovery"), the handling of the received Hard Reset has to be skipped during TOGGLING state.
[ 4086.021288] VBUS off [ 4086.021295] pending state change SNK_READY -> SNK_UNATTACHED @ 650 ms [rev2 NONE_AMS] [ 4086.022113] VBUS VSAFE0V [ 4086.022117] state change SNK_READY -> SNK_UNATTACHED [rev2 NONE_AMS] [ 4086.022447] VBUS off [ 4086.022450] state change SNK_UNATTACHED -> SNK_UNATTACHED [rev2 NONE_AMS] [ 4086.023060] VBUS VSAFE0V [ 4086.023064] state change SNK_UNATTACHED -> SNK_UNATTACHED [rev2 NONE_AMS] [ 4086.023070] disable BIST MODE TESTDATA [ 4086.023766] disable vbus discharge ret:0 [ 4086.023911] Setting usb_comm capable false [ 4086.028874] Setting voltage/current limit 0 mV 0 mA [ 4086.028888] polarity 0 [ 4086.030305] Requesting mux state 0, usb-role 0, orientation 0 [ 4086.033539] Start toggling [ 4086.038496] state change SNK_UNATTACHED -> TOGGLING [rev2 NONE_AMS]
// This Hard Reset is unexpected
[ 4086.038499] Received hard reset [ 4086.038501] state change TOGGLING -> HARD_RESET_START [rev2 HARD_RESET]
--- drivers/usb/typec/tcpm/tcpm.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/typec/tcpm/tcpm.c +1 -0
@@ -5351,6 +5351,7 @@ static void _tcpm_pd_hard_reset(struct t port->tcpc->set_bist_data (port->tcpc, false);switch (port->state) { +case TOGGLING :case ERROR_RECOVERY :case PORT_RESET :case PORT_RESET_WAIT_OFF :
Greg Kroah-Hartman
maintainerPATCH 109/356 ionic: fix use after netif_napi_del()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taehee Yoo <[email protected]>
[ Upstream commit 79f18a41dd056115d685f3b0a419c7cd40055e13 ]
When queues are started, netif_napi_add() and napi_enable() are called. If there are 4 queues and only 3 queues are used for the current configuration, only 3 queues' napi should be registered and enabled. The ionic_qcq_enable() checks whether the .poll pointer is not NULL for enabling only the using queue' napi. Unused queues' napi will not be registered by netif_napi_add(), so the .poll pointer indicates NULL. But it couldn't distinguish whether the napi was unregistered or not because netif_napi_del() doesn't reset the .poll pointer to NULL. So, ionic_qcq_enable() calls napi_enable() for the queue, which was unregistered by netif_napi_del().
Reproducer:
ethtool -L <interface name> rx 1 tx 1 combined 0 ethtool -L <interface name> rx 0 tx 0 combined 1 ethtool -L <interface name> rx 0 tx 0 combined 4
Splat looks like:
kernel BUG at net/core/dev.c:6666!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 3 PID: 1057 Comm: kworker/3:3 Not tainted 6.10.0-rc2+ #16 Workqueue: events ionic_lif_deferred_work [ionic] RIP: 0010:napi_enable+0x3b/0x40 Code: 48 89 c2 48 83 e2 f6 80 b9 61 09 00 00 00 74 0d 48 83 bf 60 01 00 00 00 74 03 80 ce 01 f0 4f RSP: 0018:ffffb6ed83227d48 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff97560cda0828 RCX: 0000000000000029 RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff97560cda0a28 RBP: ffffb6ed83227d50 R08: 0000000000000400 R09: 0000000000000001 R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000 R13: ffff97560ce3c1a0 R14: 0000000000000000 R15: ffff975613ba0a20 FS: 0000000000000000(0000) GS:ffff975d5f780000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f8f734ee200 CR3: 0000000103e50000 CR4: 00000000007506f0 PKRU: 55555554 Call Trace: <TASK> ? die+0x33/0x90 ? do_trap+0xd9/0x100 ? napi_enable+0x3b/0x40 ? do_error_trap+0x83/0xb0 ? napi_enable+0x3b/0x40 ? napi_enable+0x3b/0x40 ? exc_invalid_op+0x4e/0x70 ? napi_enable+0x3b/0x40 ? asm_exc_invalid_op+0x16/0x20 ? napi_enable+0x3b/0x40 ionic_qcq_enable+0xb7/0x180 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8] ionic_start_queues+0xc4/0x290 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8] ionic_link_status_check+0x11c/0x170 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8] ionic_lif_deferred_work+0x129/0x280 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8] process_one_work+0x145/0x360 worker_thread+0x2bb/0x3d0 ? __pfx_worker_thread+0x10/0x10 kthread+0xcc/0x100 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x2d/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +1 -3
@@ -283,10 +283,8 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq)if (ret)return ret; -if (qcq->napi.poll) -napi_enable (&qcq->napi); -if (qcq->flags &IONIC_QCQ_F_INTR ) { +napi_enable (&qcq->napi);irq_set_affinity_hint (qcq->intr.vector, &qcq->intr.affinity_mask); ionic_intr_mask(idev->intr_ctrl, qcq->intr.index,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 118/356 tracing/selftests: Fix kprobe event name test for .isra. functions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
commit 23a4b108accc29a6125ed14de4a044689ffeda78 upstream.
The kprobe_eventname.tc test checks if a function with .isra. can have a kprobe attached to it. It loops through the kallsyms file for all the functions that have the .isra. name, and checks if it exists in the available_filter_functions file, and if it does, it uses it to attach a kprobe to it.
The issue is that kprobes can not attach to functions that are listed more than once in available_filter_functions. With the latest kernel, the function that is found is: rapl_event_update.isra.0
# grep rapl_event_update.isra.0 /sys/kernel/tracing/available_filter_functions rapl_event_update.isra.0 rapl_event_update.isra.0
It is listed twice. This causes the attached kprobe to it to fail which in turn fails the test. Instead of just picking the function function that is found in available_filter_functions, pick the first one that is listed only once in available_filter_functions.
--- tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc +2 -1
@@ -30,7 +30,8 @@ find_dot_func() { fi grep " [tT] .*\.isra\..*" /proc/kallsyms | cut -f 3 -d " " | while read f; do - if grep -s $f available_filter_functions; then + cnt=`grep -s $f available_filter_functions | wc -l`; + if [ $cnt -eq 1 ]; then echo $f break fi
Greg Kroah-Hartman
maintainerPATCH 119/356 null_blk: Print correct max open zones limit in null_init_zoned_dev()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 233e27b4d21c3e44eb863f03e566d3a22e81a7ae upstream.
When changing the maximum number of open zones, print that number instead of the total number of zones.
--- drivers/block/null_blk/zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/null_blk/zoned.c +1 -1
@@ -109,7 +109,7 @@ int null_init_zoned_dev(struct nullb_devif (dev->zone_max_active && dev->zone_max_open > dev->zone_max_active) { dev->zone_max_open = dev->zone_max_active;pr_info ("changed the maximum number of open zones to %u\n" , - dev->nr_zones); + dev->zone_max_open); }else if (dev->zone_max_open >= dev->nr_zones - dev->zone_nr_conv) { dev->zone_max_open =0 ;pr_info ("zone_max_open limit disabled, limit >= zone count\n" );
Greg Kroah-Hartman
maintainerPATCH 120/356 sock_map: avoid race between sock_map_close and sk_psock_put
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit 4b4647add7d3c8530493f7247d11e257ee425bf0 upstream.
sk_psock_get will return NULL if the refcount of psock has gone to 0, which will happen when the last call of sk_psock_put is done. However, sk_psock_drop may not have finished yet, so the close callback will still point to sock_map_close despite psock being NULL.
This can be reproduced with a thread deleting an element from the sock map, while the second one creates a socket, adds it to the map and closes it.
That will trigger the WARN_ON_ONCE:
------------[ cut here ]------------ WARNING: CPU: 1 PID: 7220 at net/core/sock_map.c:1701 sock_map_close+0x2a2/0x2d0 net/core/sock_map.c:1701 Modules linked in: CPU: 1 PID: 7220 Comm: syz-executor380 Not tainted 6.9.0-syzkaller-07726-g3c999d1ae3c7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 RIP: 0010:sock_map_close+0x2a2/0x2d0 net/core/sock_map.c:1701 Code: df e8 92 29 88 f8 48 8b 1b 48 89 d8 48 c1 e8 03 42 80 3c 20 00 74 08 48 89 df e8 79 29 88 f8 4c 8b 23 eb 89 e8 4f 15 23 f8 90 <0f> 0b 90 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d e9 13 26 3d 02 RSP: 0018:ffffc9000441fda8 EFLAGS: 00010293 RAX: ffffffff89731ae1 RBX: ffffffff94b87540 RCX: ffff888029470000 RDX: 0000000000000000 RSI: ffffffff8bcab5c0 RDI: ffffffff8c1faba0 RBP: 0000000000000000 R08: ffffffff92f9b61f R09: 1ffffffff25f36c3 R10: dffffc0000000000 R11: fffffbfff25f36c4 R12: ffffffff89731840 R13: ffff88804b587000 R14: ffff88804b587000 R15: ffffffff89731870 FS: 000055555e080380(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 00000000207d4000 CR4: 0000000000350ef0 Call Trace: <TASK> unix_release+0x87/0xc0 net/unix/af_unix.c:1048 __sock_release net/socket.c:659 [inline] sock_close+0xbe/0x240 net/socket.c:1421 __fput+0x42b/0x8a0 fs/file_table.c:422 __do_sys_close fs/open.c:1556 [inline] __se_sys_close fs/open.c:1541 [inline] __x64_sys_close+0x7f/0x110 fs/open.c:1541 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fb37d618070 Code: 00 00 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d4 e8 10 2c 00 00 80 3d 31 f0 07 00 00 74 17 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c RSP: 002b:00007ffcd4a525d8 EFLAGS: 00000202 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007fb37d618070 RDX: 0000000000000010 RSI: 00000000200001c0 RDI: 0000000000000004 RBP: 0000000000000000 R08: 0000000100000000 R09: 0000000100000000 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 </TASK>
Use sk_psock, which will only check that the pointer is not been set to NULL yet, which should only happen after the callbacks are restored. If, then, a reference can still be gotten, we may call sk_psock_stop and cancel psock->work.
As suggested by Paolo Abeni, reorder the condition so the control flow is less convoluted.
After that change, the reproducer does not trigger the WARN_ON_ONCE anymore.
--- net/core/sock_map.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
net/core/sock_map.c +10 -6
@@ -1566,19 +1566,23 @@ void sock_map_close(struct sock *sk, lonlock_sock (sk);rcu_read_lock (); - psock =sk_psock_get (sk); -if (unlikely (!psock)) { -rcu_read_unlock (); -release_sock (sk); - saved_close =READ_ONCE (sk->sk_prot)->close; - }else { + psock =sk_psock (sk); +if (likely (psock)) { saved_close = psock->saved_close;sock_map_remove_links (sk, psock); + psock =sk_psock_get (sk); +if (unlikely (!psock)) + goto no_psock;rcu_read_unlock ();sk_psock_stop (psock);release_sock (sk);cancel_delayed_work_sync (&psock->work);sk_psock_put (sk, psock); + }else { + saved_close =READ_ONCE (sk->sk_prot)->close; +no_psock: +rcu_read_unlock (); +release_sock (sk); }/* Make sure we do not recurse. This is a bug.
Greg Kroah-Hartman
maintainerPATCH 121/356 vmci: prevent speculation leaks by sanitizing event in event_deliver()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hagar Gamal Halim Hemdan <[email protected]>
commit 8003f00d895310d409b2bf9ef907c56b42a4e0f4 upstream.
Coverity spotted that event_msg is controlled by user-space, event_msg->event_data.event is passed to event_deliver() and used as an index without sanitization.
This change ensures that the event index is sanitized to mitigate any possibility of speculative information leaks.
This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc.
Only compile tested, no access to HW.
--- drivers/misc/vmw_vmci/vmci_event.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/misc/vmw_vmci/vmci_event.c +5 -1
@@ -9,6 +9,7 @@#include <linux/vmw_vmci_api.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/nospec.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/rculist.h>
@@ -86,9 +87,12 @@ static void event_deliver(struct vmci_ev {struct vmci_subscription *cur;struct list_head *subscriber_list; +u32 sanitized_event, max_vmci_event;rcu_read_lock (); - subscriber_list = &subscriber_array[event_msg->event_data.event]; + max_vmci_event =ARRAY_SIZE (subscriber_array); + sanitized_event =array_index_nospec (event_msg->event_data.event, max_vmci_event); + subscriber_list = &subscriber_array[sanitized_event];list_for_each_entry_rcu (cur, subscriber_list, node) { cur->callback (cur->id, &event_msg->event_data, cur->callback_data);
Greg Kroah-Hartman
maintainerPATCH 122/356 spmi: hisi-spmi-controller: Do not override device identifier
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vamshi Gajjela <[email protected]>
commit eda4923d78d634482227c0b189d9b7ca18824146 upstream.
'nr' member of struct spmi_controller, which serves as an identifier for the controller/bus. This value is a dynamic ID assigned in spmi_controller_alloc, and overriding it from the driver results in an ida_free error "ida_free called for id=xx which is not allocated".
--- drivers/spmi/hisi-spmi-controller.c | 1 - 1 file changed, 1 deletion(-)
drivers/spmi/hisi-spmi-controller.c +0 -1
@@ -303,7 +303,6 @@ static int spmi_controller_probe(structspin_lock_init (&spmi_controller->lock); - ctrl->nr = spmi_controller->channel; ctrl->dev.parent = pdev->dev.parent; ctrl->dev.of_node =of_node_get (pdev->dev.of_node);
Greg Kroah-Hartman
maintainerPATCH 123/356 knfsd: LOOKUP can return an illegal error value
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit e221c45da3770962418fb30c27d941bbc70d595a upstream.
The 'NFS error' NFSERR_OPNOTSUPP is not described by any of the official NFS related RFCs, but appears to have snuck into some older .x files for NFSv2.
Either way, it is not in RFC1094, RFC1813 or any of the NFSv4 RFCs, so should not be returned by the knfsd server, and particularly not by the "LOOKUP" operation.
Instead, let's return NFSERR_STALE, which is more appropriate if the filesystem encodes the filehandle as FILEID_INVALID.
--- fs/nfsd/nfsfh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfsfh.c +2 -2
@@ -569,7 +569,7 @@ fh_compose(struct svc_fh *fhp, struct sv_fh_update (fhp, exp, dentry);if (fhp->fh_handle.fh_fileid_type ==FILEID_INVALID ) {fh_put (fhp); -return nfserr_opnotsupp; +return nfserr_stale; }return 0 ;
@@ -595,7 +595,7 @@ fh_update(struct svc_fh *fhp)_fh_update (fhp, fhp->fh_export, dentry);if (fhp->fh_handle.fh_fileid_type ==FILEID_INVALID ) -return nfserr_opnotsupp; +return nfserr_stale;return 0 ; out_bad:printk (KERN_ERR "fh_update: fh not verified!\n" );
Greg Kroah-Hartman
maintainerPATCH 124/356 fs/proc: fix softlockup in __read_vmcore
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <[email protected]>
commit 5cbcb62dddf5346077feb82b7b0c9254222d3445 upstream.
While taking a kernel core dump with makedumpfile on a larger system, softlockup messages often appear.
While softlockup warnings can be harmless, they can also interfere with things like RCU freeing memory, which can be problematic when the kdump kexec image is configured with as little memory as possible.
Avoid the softlockup, and give things like work items and RCU a chance to do their thing during __read_vmcore by adding a cond_resched.
--- fs/proc/vmcore.c | 2 ++ 1 file changed, 2 insertions(+)
fs/proc/vmcore.c +2 -0
@@ -373,6 +373,8 @@ static ssize_t __read_vmcore(char *buffe/* leave now if filled buffer already */ if (buflen ==0 )return acc; + +cond_resched (); }list_for_each_entry (m, &vmcore_list, list) {
Greg Kroah-Hartman
maintainerPATCH 125/356 ocfs2: use coarse time for new created files
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Yue <[email protected]>
commit b8cb324277ee16f3eca3055b96fce4735a5a41c6 upstream.
The default atime related mount option is '-o realtime' which means file atime should be updated if atime <= ctime or atime <= mtime. atime should be updated in the following scenario, but it is not:
==========================================================
$ rm /mnt/testfile; $ echo test > /mnt/testfile $ stat -c "%X %Y %Z" /mnt/testfile 1711881646 1711881646 1711881646 $ sleep 5 $ cat /mnt/testfile > /dev/null $ stat -c "%X %Y %Z" /mnt/testfile 1711881646 1711881646 1711881646 ==========================================================
And the reason the atime in the test is not updated is that ocfs2 calls ktime_get_real_ts64() in __ocfs2_mknod_locked during file creation. Then inode_set_ctime_current() is called in inode_set_ctime_current() calls ktime_get_coarse_real_ts64() to get current time.
ktime_get_real_ts64() is more accurate than ktime_get_coarse_real_ts64(). In my test box, I saw ctime set by ktime_get_coarse_real_ts64() is less than ktime_get_real_ts64() even ctime is set later. The ctime of the new inode is smaller than atime.
The call trace is like:
ocfs2_create
ocfs2_mknod
__ocfs2_mknod_locked
....
ktime_get_real_ts64 <------- set atime,ctime,mtime, more accurate
ocfs2_populate_inode
...
ocfs2_init_acl
ocfs2_acl_set_mode
inode_set_ctime_current
current_time
ktime_get_coarse_real_ts64 <-------less accurateocfs2_file_read_iter
ocfs2_inode_lock_atime
ocfs2_should_update_atime
atime <= ctime ? <-------- false, ctime < atime due to accuracy
So here call ktime_get_coarse_real_ts64 to set inode time coarser while creating new files. It may lower the accuracy of file times. But it's not a big deal since we already use coarse time in other places like ocfs2_update_inode_atime and inode_set_ctime_current.
--- fs/ocfs2/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +1 -1
@@ -566,7 +566,7 @@ static int __ocfs2_mknod_locked(struct i fe->i_last_eb_blk =0 ;strcpy (fe->i_signature,OCFS2_INODE_SIGNATURE ); fe->i_flags |=cpu_to_le32 (OCFS2_VALID_FL ); -ktime_get_real_ts64 (&ts); +ktime_get_coarse_real_ts64 (&ts); fe->i_atime = fe->i_ctime = fe->i_mtime =cpu_to_le64 (ts.tv_sec); fe->i_mtime_nsec = fe->i_ctime_nsec = fe->i_atime_nsec =
Greg Kroah-Hartman
maintainerPATCH 126/356 ocfs2: fix races between hole punching and AIO+DIO
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Yue <[email protected]>
commit 952b023f06a24b2ad6ba67304c4c84d45bea2f18 upstream.
After commit "ocfs2: return real error code in ocfs2_dio_wr_get_block", fstests/generic/300 become from always failed to sometimes failed:
========================================================================
[ 473.293420 ] run fstests generic/300
[ 475.296983 ] JBD2: Ignoring recovery information on journal [ 475.302473 ] ocfs2: Mounting device (253,1) on (node local, slot 0) with ordered data mode. [ 494.290998 ] OCFS2: ERROR (device dm-1): ocfs2_change_extent_flag: Owner 5668 has an extent at cpos 78723 which can no longer be found [ 494.291609 ] On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted. [ 494.292018 ] OCFS2: File system is now read-only. [ 494.292224 ] (kworker/19:11,2628,19):ocfs2_mark_extent_written:5272 ERROR: status = -30 [ 494.292602 ] (kworker/19:11,2628,19):ocfs2_dio_end_io_write:2374 ERROR: status = -3
fio: io_u error on file /mnt/scratch/racer: Read-only file system: write offset=460849152, buflen=131072
=========================================================================
In __blockdev_direct_IO, ocfs2_dio_wr_get_block is called to add unwritten extents to a list. extents are also inserted into extent tree in ocfs2_write_begin_nolock. Then another thread call fallocate to puch a hole at one of the unwritten extent. The extent at cpos was removed by ocfs2_remove_extent(). At end io worker thread, ocfs2_search_extent_list found there is no such extent at the cpos.
T1 T2 T3
inode lock
...
insert extents
...
inode unlockocfs2_fallocate
__ocfs2_change_file_space
inode lock
lock ip_alloc_sem
ocfs2_remove_inode_range inode
ocfs2_remove_btree_range
ocfs2_remove_extent
^---remove the extent at cpos 78723 ...
unlock ip_alloc_sem
inode unlock
ocfs2_dio_end_io
ocfs2_dio_end_io_write
lock ip_alloc_sem ocfs2_mark_extent_written
ocfs2_change_extent_flag
ocfs2_search_extent_list ^---failed to find extent
...
unlock ip_alloc_sem
In most filesystems, fallocate is not compatible with racing with AIO+DIO, so fix it by adding to wait for all dio before fallocate/punch_hole like ext4.
--- fs/ocfs2/file.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ocfs2/file.c +2 -0
@@ -1940,6 +1940,8 @@ static int __ocfs2_change_file_space(strinode_lock (inode); +/* Wait all existing dio workers, newcomers will block on i_rwsem */ +inode_dio_wait (inode);/* * This prevents concurrent writes on other nodes */
Greg Kroah-Hartman
maintainerPATCH 127/356 PCI: rockchip-ep: Remove wrong mask on subsys_vendor_id
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rick Wertenbroek <[email protected]>
commit 2dba285caba53f309d6060fca911b43d63f41697 upstream.
Remove wrong mask on subsys_vendor_id. Both the Vendor ID and Subsystem Vendor ID are u16 variables and are written to a u32 register of the controller. The Subsystem Vendor ID was always 0 because the u16 value was masked incorrectly with GENMASK(31,16) resulting in all lower 16 bits being set to 0 prior to the shift.
Remove both masks as they are unnecessary and set the register correctly i.e., the lower 16-bits are the Vendor ID and the upper 16-bits are the Subsystem Vendor ID.
This is documented in the RK3399 TRM section 17.6.7.1.17
--- drivers/pci/controller/pcie-rockchip-ep.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pci/controller/pcie-rockchip-ep.c +2 -4
@@ -98,10 +98,8 @@ static int rockchip_pcie_ep_write_header/* All functions share the same vendor ID with function 0 */ if (fn ==0 ) { -u32 vid_regs = (hdr->vendorid &GENMASK (15 ,0 )) | - (hdr->subsys_vendor_id &GENMASK (31 ,16 )) <<16 ; - -rockchip_pcie_write (rockchip, vid_regs, +rockchip_pcie_write (rockchip, + hdr->vendorid | hdr->subsys_vendor_id <<16 ,PCIE_CORE_CONFIG_VENDOR ); }
Greg Kroah-Hartman
maintainerPATCH 110/356 af_unix: Read with MSG_PEEK loops if the first unread byte is OOB
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rao Shoaib <[email protected]>
[ Upstream commit a6736a0addd60fccc3a3508461d72314cc609772 ]
Read with MSG_PEEK flag loops if the first byte to read is an OOB byte. commit 22dd70eb2c3d ("af_unix: Don't peek OOB data without MSG_OOB.") addresses the loop issue but does not address the issue that no data beyond OOB byte can be read.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
from socket import *
c1, c2 =socketpair(AF_UNIX, SOCK_STREAM)c1.send(b'a', MSG_OOB)
1
Quoted 1 line
Quoted 1 line
Quoted 1 line
c1.send(b'b')
1
Quoted 1 line
Quoted 1 line
Quoted 1 line
c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
b'b'
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
from socket import *
c1, c2 =socketpair(AF_UNIX, SOCK_STREAM)c2.setsockopt(SOL_SOCKET, SO_OOBINLINE, 1)c1.send(b'a', MSG_OOB)
1
Quoted 1 line
Quoted 1 line
Quoted 1 line
c1.send(b'b')
1
Quoted 1 line
Quoted 1 line
Quoted 1 line
c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
b'a'
Quoted 1 line
Quoted 1 line
Quoted 1 line
c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
b'a'
Quoted 1 line
Quoted 1 line
Quoted 1 line
c2.recv(1, MSG_DONTWAIT)
b'a'
Quoted 1 line
Quoted 1 line
Quoted 1 line
c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
b'b'
Quoted 1 line
Quoted 1 line
Quoted 1 line
--- net/unix/af_unix.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
net/unix/af_unix.c +9 -9
@@ -2565,18 +2565,18 @@ static struct sk_buff *manage_oob(structif (skb == u->oob_skb) {if (copied) { skb =NULL ; - }else if (sock_flag (sk,SOCK_URGINLINE )) { -if (!(flags &MSG_PEEK )) { + }else if (!(flags &MSG_PEEK )) { +if (sock_flag (sk,SOCK_URGINLINE )) {WRITE_ONCE (u->oob_skb,NULL );consume_skb (skb); + }else { +__skb_unlink (skb, &sk->sk_receive_queue); +WRITE_ONCE (u->oob_skb,NULL ); + unlinked_skb = skb; + skb =skb_peek (&sk->sk_receive_queue); } - }else if (flags &MSG_PEEK ) { - skb =NULL ; - }else { -__skb_unlink (skb, &sk->sk_receive_queue); -WRITE_ONCE (u->oob_skb,NULL ); - unlinked_skb = skb; - skb =skb_peek (&sk->sk_receive_queue); + }else if (!sock_flag (sk,SOCK_URGINLINE )) { + skb =skb_peek_next (skb, &sk->sk_receive_queue); } }
Greg Kroah-Hartman
maintainerPATCH 128/356 dmaengine: axi-dmac: fix possible race in remove()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nuno Sa <[email protected]>
commit 1bc31444209c8efae98cb78818131950d9a6f4d6 upstream.
We need to first free the IRQ before calling of_dma_controller_free(). Otherwise we could get an interrupt and schedule a tasklet while removing the DMA controller.
--- drivers/dma/dma-axi-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dma-axi-dmac.c +1 -1
@@ -1020,8 +1020,8 @@ static int axi_dmac_remove(struct platfo {struct axi_dmac *dmac =platform_get_drvdata (pdev); -of_dma_controller_free (pdev->dev.of_node);free_irq (dmac->irq, dmac); +of_dma_controller_free (pdev->dev.of_node);tasklet_kill (&dmac->chan.vchan.task);dma_async_device_unregister (&dmac->dma_dev);clk_disable_unprepare (dmac->clk);
Greg Kroah-Hartman
maintainerPATCH 129/356 intel_th: pci: Add Granite Rapids support
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit e44937889bdf4ecd1f0c25762b7226406b9b7a69 upstream.
Add support for the Trace Hub in Granite Rapids.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -305,6 +305,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Granite Rapids */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0963), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Alder Lake CPU */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x466f ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 130/356 intel_th: pci: Add Granite Rapids SOC support
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit 854afe461b009801a171b3a49c5f75ea43e4c04c upstream.
Add support for the Trace Hub in Granite Rapids SOC.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -310,6 +310,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Granite Rapids SOC */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x3256), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Alder Lake CPU */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x466f ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 131/356 intel_th: pci: Add Sapphire Rapids SOC support
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit 2e1da7efabe05cb0cf0b358883b2bc89080ed0eb upstream.
Add support for the Trace Hub in Sapphire Rapids SOC.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -315,6 +315,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Sapphire Rapids SOC */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x3456), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Alder Lake CPU */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x466f ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 132/356 intel_th: pci: Add Meteor Lake-S support
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit c4a30def564d75e84718b059d1a62cc79b137cf9 upstream.
Add support for the Trace Hub in Meteor Lake-S.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -295,6 +295,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Meteor Lake-S */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7f26), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Raptor Lake-S */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x7a26 ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 133/356 intel_th: pci: Add Lunar Lake support
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit f866b65322bfbc8fcca13c25f49e1a5c5a93ae4d upstream.
Add support for the Trace Hub in Lunar Lake.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -325,6 +325,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Lunar Lake */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa824), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Alder Lake CPU */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x466f ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 134/356 nilfs2: fix potential kernel bug due to lack of writeback flag waiting
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit a4ca369ca221bb7e06c725792ac107f0e48e82e7 upstream.
Destructive writes to a block device on which nilfs2 is mounted can cause a kernel bug in the folio/page writeback start routine or writeback end routine (__folio_start_writeback in the log below):
kernel BUG at mm/page-writeback.c:3070!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI ... RIP: 0010:__folio_start_writeback+0xbaa/0x10e0 Code: 25 ff 0f 00 00 0f 84 18 01 00 00 e8 40 ca c6 ff e9 17 f6 ff ff e8 36 ca c6 ff 4c 89 f7 48 c7 c6 80 c0 12 84 e8 e7 b3 0f 00 90 <0f> 0b e8 1f ca c6 ff 4c 89 f7 48 c7 c6 a0 c6 12 84 e8 d0 b3 0f 00 ... Call Trace: <TASK> nilfs_segctor_do_construct+0x4654/0x69d0 [nilfs2] nilfs_segctor_construct+0x181/0x6b0 [nilfs2] nilfs_segctor_thread+0x548/0x11c0 [nilfs2] kthread+0x2f0/0x390 ret_from_fork+0x4b/0x80 ret_from_fork_asm+0x1a/0x30 </TASK>
This is because when the log writer starts a writeback for segment summary blocks or a super root block that use the backing device's page cache, it does not wait for the ongoing folio/page writeback, resulting in an inconsistent writeback state.
Fix this issue by waiting for ongoing writebacks when putting folios/pages on the backing device into writeback state.
--- fs/nilfs2/segment.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nilfs2/segment.c +3 -0
@@ -1692,6 +1692,7 @@ static void nilfs_segctor_prepare_write(if (bh->b_page != bd_page) {if (bd_page) {lock_page (bd_page); +wait_on_page_writeback (bd_page);clear_page_dirty_for_io (bd_page);set_page_writeback (bd_page);unlock_page (bd_page);
@@ -1705,6 +1706,7 @@ static void nilfs_segctor_prepare_write(if (bh == segbuf->sb_super_root) {if (bh->b_page != bd_page) {lock_page (bd_page); +wait_on_page_writeback (bd_page);clear_page_dirty_for_io (bd_page);set_page_writeback (bd_page);unlock_page (bd_page);
@@ -1721,6 +1723,7 @@ static void nilfs_segctor_prepare_write( }if (bd_page) {lock_page (bd_page); +wait_on_page_writeback (bd_page);clear_page_dirty_for_io (bd_page);set_page_writeback (bd_page);unlock_page (bd_page);
Greg Kroah-Hartman
maintainerPATCH 135/356 tick/nohz_full: Dont abuse smp_call_function_single() in tick_setup_device()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 07c54cc5988f19c9642fd463c2dbdac7fc52f777 upstream.
After the recent commit 5097cbcb38e6 ("sched/isolation: Prevent boot crash when the boot CPU is nohz_full") the kernel no longer crashes, but there is another problem.
In this case tick_setup_device() calls tick_take_do_timer_from_boot() to update tick_do_timer_cpu and this triggers the WARN_ON_ONCE(irqs_disabled) in smp_call_function_single().
Kill tick_take_do_timer_from_boot() and just use WRITE_ONCE(), the new comment explains why this is safe (thanks Thomas!).
--- kernel/time/tick-common.c | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-)
kernel/time/tick-common.c +14 -28
@@ -179,26 +179,6 @@ void tick_setup_periodic(struct clock_ev } } -#ifdef CONFIG_NO_HZ_FULL -static void giveup_do_timer (void *info) -{ -int cpu = *(unsigned int *)info; - -WARN_ON (tick_do_timer_cpu !=smp_processor_id ()); - - tick_do_timer_cpu = cpu; -} - -static void tick_take_do_timer_from_boot (void ) -{ -int cpu =smp_processor_id (); -int from = tick_do_timer_boot_cpu; - -if (from >=0 && from != cpu) -smp_call_function_single (from, giveup_do_timer, &cpu,1 ); -} -#endif -/* * Setup the tick device */
@@ -222,19 +202,25 @@ static void tick_setup_device(struct tic tick_next_period =ktime_get ();#ifdef CONFIG_NO_HZ_FULL /* -* The boot CPU may be nohz_full, in which case set -* tick_do_timer_boot_cpu so the first housekeeping -* secondary that comes up will take do_timer from -* us. +* The boot CPU may be nohz_full, in which case the +* first housekeeping secondary will take do_timer() +* from it. */ if (tick_nohz_full_cpu (cpu)) tick_do_timer_boot_cpu = cpu; - }else if (tick_do_timer_boot_cpu !=-1 && - !tick_nohz_full_cpu (cpu)) { -tick_take_do_timer_from_boot (); + }else if (tick_do_timer_boot_cpu !=-1 && !tick_nohz_full_cpu (cpu)) { tick_do_timer_boot_cpu =-1 ; -WARN_ON (tick_do_timer_cpu != cpu); +/* +* The boot CPU will stay in periodic (NOHZ disabled) +* mode until clocksource_done_booting() called after +* smp_init() selects a high resolution clocksource and +* timekeeping_notify() kicks the NOHZ stuff alive. +* +* So this WRITE_ONCE can only race with the READ_ONCE +* check in tick_periodic() but this race is harmless. +*/ +WRITE_ONCE (tick_do_timer_cpu, cpu);#endif }