5.15.33-rc1 review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 419/913 KVM: PPC: Book3S HV: Check return value of kvmppc_radix_init
In reply to Greg Kroah-HartmanFrom: Fabiano Rosas <[email protected]>
[ Upstream commit 69ab6ac380a00244575de02c406dcb9491bf3368 ]
The return of the function is being shadowed by the call to kvmppc_uvmem_init.
--- arch/powerpc/kvm/book3s_hv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/kvm/book3s_hv.c +4 -1
@@ -6101,8 +6101,11 @@ static int kvmppc_book3s_init_hv(void)if (r)return r; -if (kvmppc_radix_possible ()) +if (kvmppc_radix_possible ()) { r =kvmppc_radix_init (); +if (r) +return r; + } r =kvmppc_uvmem_init ();if (r <0 )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 420/913 powerpc/perf: Dont use perf_hw_context for trace IMC PMU
In reply to Greg Kroah-HartmanFrom: Athira Rajeev <[email protected]>
[ Upstream commit 0198322379c25215b2778482bf1221743a76e2b5 ]
Trace IMC (In-Memory collection counters) in powerpc is useful for application level profiling.
For trace_imc, presently task context (task_ctx_nr) is set to perf_hw_context. But perf_hw_context should only be used for CPU PMU. See commit 26657848502b ("perf/core: Verify we have a single perf_hw_context PMU").
So for trace_imc, even though it is per thread PMU, it is preferred to use sw_context in order to be able to do application level monitoring. Hence change the task_ctx_nr to use perf_sw_context.
--- arch/powerpc/perf/imc-pmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/powerpc/perf/imc-pmu.c +5 -1
@@ -1457,7 +1457,11 @@ static int trace_imc_event_init(struct perf_event *event) event->hw.idx =-1 ; - event->pmu->task_ctx_nr = perf_hw_context; +/* +* There can only be a single PMU for perf_hw_context events which is assigned to +* core PMU. Hence use "perf_sw_context" for trace_imc. +*/ + event->pmu->task_ctx_nr = perf_sw_context; event->destroy = reset_global_refc;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 421/913 mt76: connac: fix sta_rec_wtbl tag len
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 74c337ec0905d99111fc63a15f2e0784b9ed5503 ]
Similar to mt7915 driver, fix tag len error for sta_rec_wtbl, which causes fw parsing error for the tags placed behind it.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +1 -1
@@ -295,7 +295,7 @@ mt76_connac_mcu_alloc_wtbl_req(struct mt76_dev *dev, struct mt76_wcid *wcid, }if (sta_hdr) - sta_hdr->len =cpu_to_le16 (sizeof (hdr)); +le16_add_cpu (&sta_hdr->len,sizeof (hdr));return skb_put_data (nskb, &hdr,sizeof (hdr)); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 422/913 mt76: mt7915: use proper aid value in mt7915_mcu_wtbl_generic_tlv in sta mode
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit a56b1b0f145ef2d6bb9312dedf3ab8558ef50a5b ]
mac80211 provides aid in vif->bss_conf.aid for sta mode and not in sta->aid. Fix mt7915_mcu_wtbl_generic_tlv routine using proper value for aid in sta mode.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +4 -1
@@ -1396,8 +1396,11 @@ mt7915_mcu_wtbl_generic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, generic = (struct wtbl_generic *)tlv;if (sta) { +if (vif->type ==NL80211_IFTYPE_STATION ) + generic->partial_aid =cpu_to_le16 (vif->bss_conf.aid); +else + generic->partial_aid =cpu_to_le16 (sta->aid);memcpy (generic->peer_addr, sta->addr,ETH_ALEN ); - generic->partial_aid =cpu_to_le16 (sta->aid); generic->muar_idx = mvif->omac_idx; generic->qos = sta->wme; }else {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 423/913 mt76: mt7915: use proper aid value in mt7915_mcu_sta_basic_tlv
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit abdb8bc94be4cf68aa71c9a8ee0bad9b3e6f52d3 ]
Similar to mt7915_mcu_wtbl_generic_tlv, rely on vif->bss_conf.aid for aid in sta mode and not on sta->aid.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +3 -1
@@ -1454,12 +1454,15 @@ mt7915_mcu_sta_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,case NL80211_IFTYPE_MESH_POINT :case NL80211_IFTYPE_AP : basic->conn_type =cpu_to_le32 (CONNECTION_INFRA_STA ); + basic->aid =cpu_to_le16 (sta->aid);break ;case NL80211_IFTYPE_STATION : basic->conn_type =cpu_to_le32 (CONNECTION_INFRA_AP ); + basic->aid =cpu_to_le16 (vif->bss_conf.aid);break ;case NL80211_IFTYPE_ADHOC : basic->conn_type =cpu_to_le32 (CONNECTION_IBSS_ADHOC ); + basic->aid =cpu_to_le16 (sta->aid);break ;default :WARN_ON (1 );
@@ -1467,7 +1470,6 @@ mt7915_mcu_sta_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, }memcpy (basic->peer_addr, sta->addr,ETH_ALEN ); - basic->aid =cpu_to_le16 (sta->aid); basic->qos = sta->wme; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 424/913 mt76: mt7921: fix a leftover race in runtime-pm
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 591cdccebdd4d02eb46d400dea911136400cc567 ]
Fix a possible race in mt7921_pm_power_save_work() if rx/tx napi schedules ps_work and we are currently accessing device register on a different cpu.
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +8 -0
@@ -1550,6 +1550,14 @@ void mt7921_pm_power_save_work(struct work_struct *work) test_bit(MT76_HW_SCHED_SCANNING, &mphy->state)) goto out; +if (mutex_is_locked (&dev->mt76.mutex)) +/* if mt76 mutex is held we should not put the device +* to sleep since we are currently accessing device +* register map. We need to wait for the next power_save +* trigger. +*/ + goto out; +if (time_is_after_jiffies (dev->pm.last_activity + delta)) { delta = dev->pm.last_activity + delta - jiffies; goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 425/913 mt76: mt7615: fix a leftover race in runtime-pm
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 42ce8d3b623162f3248db50a38359f294e6b06fd ]
Fix a possible race in mt7615_pm_power_save_work() if rx/tx napi schedules ps_work and we are currently accessing device register on a different cpu.
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +8 -0
@@ -2000,6 +2000,14 @@ void mt7615_pm_power_save_work(struct work_struct *work) test_bit(MT76_HW_SCHED_SCANNING, &dev->mphy.state)) goto out; +if (mutex_is_locked (&dev->mt76.mutex)) +/* if mt76 mutex is held we should not put the device +* to sleep since we are currently accessing device +* register map. We need to wait for the next power_save +* trigger. +*/ + goto out; +if (time_is_after_jiffies (dev->pm.last_activity + delta)) { delta = dev->pm.last_activity + delta - jiffies; goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 426/913 mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit fc8e2c707ce11c8ec2e992885b0d53a5e04031ac ]
Check sta_rates pointer value in mt7603_sta_rate_tbl_update routine since minstrel_ht_update_rates can fail allocating rates array.
--- drivers/net/wireless/mediatek/mt76/mt7603/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7603/main.c +3 -0
@@ -620,6 +620,9 @@ mt7603_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta_rates *sta_rates =rcu_dereference (sta->rates);int i; +if (!sta_rates) +return ; +spin_lock_bh (&dev->mt76.lock);for (i =0 ; i <ARRAY_SIZE (msta->rates); i++) { msta->rates[i].idx = sta_rates->rate[i].idx;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 427/913 mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 6a6f457ed5fdf6777536c20644a9e42128a50ec2 ]
Check sta_rates pointer value in mt7615_sta_rate_tbl_update routine since minstrel_ht_update_rates can fail allocating rates array.
--- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/main.c +3 -0
@@ -682,6 +682,9 @@ static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw,struct ieee80211_sta_rates *sta_rates =rcu_dereference (sta->rates);int i; +if (!sta_rates) +return ; +spin_lock_bh (&dev->mt76.lock);for (i =0 ; i <ARRAY_SIZE (msta->rates); i++) { msta->rates[i].idx = sta_rates->rate[i].idx;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 428/913 ptp: unregister virtual clocks when unregistering physical clock.
In reply to Greg Kroah-HartmanFrom: Miroslav Lichvar <[email protected]>
[ Upstream commit bfcbb76b0f595ea9ede9f7a218086fef85242f10 ]
When unregistering a physical clock which has some virtual clocks, unregister the virtual clocks with it.
This fixes the following oops, which can be triggered by unloading a driver providing a PTP clock when it has enabled virtual clocks:
BUG: unable to handle page fault for address: ffffffffc04fc4d8 Oops: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:ptp_vclock_read+0x31/0xb0 Call Trace: timecounter_read+0xf/0x50 ptp_vclock_refresh+0x2c/0x50 ? ptp_clock_release+0x40/0x40 ptp_aux_kworker+0x17/0x30 kthread_worker_fn+0x9b/0x240 ? kthread_should_park+0x30/0x30 kthread+0xe2/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30
--- drivers/ptp/ptp_clock.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/ptp/ptp_clock.c +9 -2
@@ -317,11 +317,18 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, }EXPORT_SYMBOL (ptp_clock_register); +static int unregister_vclock (struct device *dev,void *data) +{ +struct ptp_clock *ptp =dev_get_drvdata (dev); + +ptp_vclock_unregister (info_to_vclock (ptp->info)); +return 0 ; +} +int ptp_clock_unregister (struct ptp_clock *ptp) {if (ptp_vclock_in_use (ptp)) { -pr_err ("ptp: virtual clock in use\n" ); -return -EBUSY ; +device_for_each_child (&ptp->dev,NULL , unregister_vclock); } ptp->defunct =1 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 429/913 net: dsa: mv88e6xxx: Enable port policy support on 6097
In reply to Greg Kroah-HartmanFrom: Tobias Waldekranz <[email protected]>
[ Upstream commit 585d42bb57bb358d48906660a8de273b078810b1 ]
This chip has support for the same per-port policy actions found in later versions of LinkStreet devices.
--- drivers/net/dsa/mv88e6xxx/chip.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/mv88e6xxx/chip.c +1 -0
@@ -3649,6 +3649,7 @@ static const struct mv88e6xxx_ops mv88e6097_ops = { .port_sync_link = mv88e6185_port_sync_link, .port_set_speed_duplex = mv88e6185_port_set_speed_duplex, .port_tag_remap = mv88e6095_port_tag_remap, + .port_set_policy = mv88e6352_port_set_policy, .port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_ucast_flood = mv88e6352_port_set_ucast_flood, .port_set_mcast_flood = mv88e6352_port_set_mcast_flood,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 430/913 mac80211: Remove a couple of obsolete TODO
In reply to Greg Kroah-HartmanFrom: Ilan Peer <[email protected]>
[ Upstream commit cee04f3c3a00ffd2a2a6ed1028e0ab58a3a28d25 ]
The HE capability IE is an extension IE so remove
an irrelevant comments.
--- net/mac80211/main.c | 13 +++++-------- net/mac80211/mlme.c | 4 ---- 2 files changed, 5 insertions(+), 12 deletions(-)
net/mac80211/main.c +5 -8
@@ -1131,17 +1131,14 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) local->scan_ies_len +=2 +sizeof (struct ieee80211_vht_cap ); -/* HE cap element is variable in size - set len to allow max size */ /* -* TODO: 1 is added at the end of the calculation to accommodate for -* the temporary placing of the HE capabilities IE under EXT. -* Remove it once it is placed in the final place. -*/ -if (supp_he) +* HE cap element is variable in size - set len to allow max size */ +if (supp_he) { local->scan_ies_len += -2 +sizeof (struct ieee80211_he_cap_elem ) + +3 +sizeof (struct ieee80211_he_cap_elem ) +sizeof (struct ieee80211_he_mcs_nss_supp ) + -IEEE80211_HE_PPE_THRES_MAX_LEN +1 ; +IEEE80211_HE_PPE_THRES_MAX_LEN ; + }if (!local->ops->hw_scan) {/* For hw_scan, driver needs to set these up. */
net/mac80211/mlme.c +0 -4
@@ -650,10 +650,6 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata,if (!he_cap || !reg_cap)return ; -/* -* TODO: the 1 added is because this temporarily is under the EXTENSION -* IE. Get rid of it when it moves. -*/ he_cap_size =2 +1 +sizeof (he_cap->he_cap_elem) + ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem) +
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 431/913 mac80211: limit bandwidth in HE capabilities
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 1f2c104448477512fcf7296df54bfbc3a6f9a765 ]
If we're limiting bandwidth for some reason such as regulatory restrictions, then advertise that limitation just like we do for VHT today, so the AP is aware we cannot use the higher BW it might be using.
--- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/mesh.c | 2 +- net/mac80211/mlme.c | 11 ++++++++--- net/mac80211/util.c | 27 ++++++++++++++++++++++----- 4 files changed, 32 insertions(+), 10 deletions(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -2379,7 +2379,7 @@ u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,u8 *ieee80211_ie_build_vht_oper (u8 *pos,struct ieee80211_sta_vht_cap *vht_cap,const struct cfg80211_chan_def *chandef);u8 ieee80211_ie_len_he_cap (struct ieee80211_sub_if_data *sdata,u8 iftype); -u8 *ieee80211_ie_build_he_cap (u8 *pos, +u8 *ieee80211_ie_build_he_cap (u32 disable_flags,u8 *pos,const struct ieee80211_sta_he_cap *he_cap,u8 *end); void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata,
net/mac80211/mesh.c +1 -1
@@ -580,7 +580,7 @@ int mesh_add_he_cap_ie(struct ieee80211_sub_if_data *sdata,return -ENOMEM ; pos =skb_put (skb, ie_len); -ieee80211_ie_build_he_cap (pos, he_cap, pos + ie_len); +ieee80211_ie_build_he_cap (0 , pos, he_cap, pos + ie_len);return 0 ; }
net/mac80211/mlme.c +8 -3
@@ -630,7 +630,7 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata,struct sk_buff *skb, struct ieee80211_supported_band *sband) { - u8 *pos; + u8 *pos, *pre_he_pos;const struct ieee80211_sta_he_cap *he_cap =NULL ;struct ieee80211_chanctx_conf *chanctx_conf;u8 he_cap_size;
@@ -647,16 +647,21 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata, he_cap =ieee80211_get_he_iftype_cap (sband,ieee80211_vif_type_p2p (&sdata->vif)); -if (!he_cap || !reg_cap) +if (!he_cap || !chanctx_conf || !reg_cap)return ; +/* get a max size estimate */ he_cap_size =2 +1 +sizeof (he_cap->he_cap_elem) +ieee80211_he_mcs_nss_size (&he_cap->he_cap_elem) +ieee80211_he_ppe_size (he_cap->ppe_thres[0 ], he_cap->he_cap_elem.phy_cap_info); pos =skb_put (skb, he_cap_size); -ieee80211_ie_build_he_cap (pos, he_cap, pos + he_cap_size); + pre_he_pos = pos; + pos =ieee80211_ie_build_he_cap (sdata->u.mgd.flags, + pos, he_cap, pos + he_cap_size); +/* trim excess if any */ +skb_trim (skb, skb->len - (pre_he_pos + he_cap_size - pos));ieee80211_ie_build_he_6ghz_cap (sdata, skb); }
net/mac80211/util.c +22 -5
@@ -1959,7 +1959,7 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_sub_if_data *sdata,if (he_cap &&cfg80211_any_usable_channels (local->hw.wiphy,BIT (sband->band),IEEE80211_CHAN_NO_HE )) { - pos =ieee80211_ie_build_he_cap (pos, he_cap, end); + pos =ieee80211_ie_build_he_cap (0 , pos, he_cap, end);if (!pos) goto out_err; }
@@ -2903,10 +2903,11 @@ u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype) he_cap->he_cap_elem.phy_cap_info); } -u8 *ieee80211_ie_build_he_cap (u8 *pos, +u8 *ieee80211_ie_build_he_cap (u32 disable_flags,u8 *pos,const struct ieee80211_sta_he_cap *he_cap,u8 *end) { +struct ieee80211_he_cap_elem elem;u8 n;u8 ie_len;u8 *orig_pos = pos;
@@ -2919,7 +2920,23 @@ u8 *ieee80211_ie_build_he_cap(u8 *pos,if (!he_cap)return orig_pos; - n =ieee80211_he_mcs_nss_size (&he_cap->he_cap_elem); +/* modify on stack first to calculate 'n' and 'ie_len' correctly */ + elem = he_cap->he_cap_elem; + +if (disable_flags &IEEE80211_STA_DISABLE_40MHZ ) + elem.phy_cap_info[0 ] &= + ~(IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | +IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G ); + +if (disable_flags &IEEE80211_STA_DISABLE_160MHZ ) + elem.phy_cap_info[0 ] &= + ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G ; + +if (disable_flags &IEEE80211_STA_DISABLE_80P80MHZ ) + elem.phy_cap_info[0 ] &= + ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G ; + + n =ieee80211_he_mcs_nss_size (&elem); ie_len =2 +1 +sizeof (he_cap->he_cap_elem) + n + ieee80211_he_ppe_size(he_cap->ppe_thres[0],
@@ -2933,8 +2950,8 @@ u8 *ieee80211_ie_build_he_cap(u8 *pos, *pos++ =WLAN_EID_EXT_HE_CAPABILITY ;/* Fixed data */ -memcpy (pos, &he_cap->he_cap_elem,sizeof (he_cap->he_cap_elem)); - pos +=sizeof (he_cap->he_cap_elem); +memcpy (pos, &elem,sizeof (elem)); + pos +=sizeof (elem);memcpy (pos, &he_cap->he_mcs_nss_supp, n); pos += n;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 432/913 scripts/dtc: Call pkg-config POSIXly correct
In reply to Greg Kroah-HartmanFrom: Thomas Bracht Laumann Jespersen <[email protected]>
[ Upstream commit a8b309ce9760943486e0585285e0125588a31650 ]
Running with POSIXLY_CORRECT=1 in the environment the scripts/dtc build fails, because pkg-config doesn't output anything when the flags come after the arguments.
--- scripts/dtc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/dtc/Makefile +1 -1
@@ -29,7 +29,7 @@ dtc-objs += yamltree.o # To include <yaml.h> installed in a non-default path HOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1) # To link libyaml installed in a non-default path -HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs) +HOSTLDLIBS_dtc := $(shell pkg-config --libs yaml-0.1) endif # Generated files need one more search path to include headers in source tree
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 433/913 livepatch: Fix build failure on 32 bits processors
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 2f293651eca3eacaeb56747dede31edace7329d2 ]
Trying to build livepatch on powerpc/32 results in:
kernel/livepatch/core.c: In function 'klp_resolve_symbols':
kernel/livepatch/core.c:221:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
221 | sym = (Elf64_Sym *)sechdrs[symndx].sh_addr + ELF_R_SYM(relas[i].r_info);
| ^
kernel/livepatch/core.c:221:21: error: assignment to 'Elf32_Sym *' {aka 'struct elf32_sym *'} from incompatible pointer type 'Elf64_Sym *' {aka 'struct elf64_sym *'} [-Werror=incompatible-pointer-types]
221 | sym = (Elf64_Sym *)sechdrs[symndx].sh_addr + ELF_R_SYM(relas[i].r_info);
| ^
kernel/livepatch/core.c: In function 'klp_apply_section_relocs':
kernel/livepatch/core.c:312:35: error: passing argument 1 of 'klp_resolve_symbols' from incompatible pointer type [-Werror=incompatible-pointer-types]
312 | ret = klp_resolve_symbols(sechdrs, strtab, symndx, sec, sec_objname);
| ^~~~~~~
| |
| Elf32_Shdr * {aka struct elf32_shdr *}
kernel/livepatch/core.c:193:44: note: expected 'Elf64_Shdr *' {aka 'struct elf64_shdr *'} but argument is of type 'Elf32_Shdr *' {aka 'struct elf32_shdr *'}
193 | static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab,
| ~~~~~~~~~~~~^~~~~~~Fix it by using the right types instead of forcing 64 bits types.
--- kernel/livepatch/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/livepatch/core.c +2 -2
@@ -190,7 +190,7 @@ static int klp_find_object_symbol(const char *objname, const char *name,return -EINVAL ; } -static int klp_resolve_symbols (Elf64_Shdr *sechdrs,const char *strtab, +static int klp_resolve_symbols (Elf_Shdr *sechdrs,const char *strtab,unsigned int symndx,Elf_Shdr *relasec,const char *sec_objname) {
@@ -218,7 +218,7 @@ static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab, relas = (Elf_Rela *) relasec->sh_addr;/* For each rela in this klp relocation section */ for (i =0 ; i < relasec->sh_size /sizeof (Elf_Rela); i++) { - sym = (Elf64_Sym *)sechdrs[symndx].sh_addr +ELF_R_SYM (relas[i].r_info); + sym = (Elf_Sym *)sechdrs[symndx].sh_addr +ELF_R_SYM (relas[i].r_info);if (sym->st_shndx !=SHN_LIVEPATCH ) {pr_err ("symbol %s is not marked as a livepatch symbol\n" , strtab + sym->st_name);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 434/913 net: asix: add proper error handling of usb read errors
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 920a9fa27e7805499cfe78491b36fed2322c02ec ]
Syzbot once again hit uninit value in asix driver. The problem still the same -- asix_read_cmd() reads less bytes, than was requested by caller.
Since all read requests are performed via asix_read_cmd() let's catch usb related error there and add __must_check notation to be sure all callers actually check return value.
So, this patch adds sanity check inside asix_read_cmd(), that simply checks if bytes read are not less, than was requested and adds missing error handling of asix_read_cmd() all across the driver code.
--- drivers/net/usb/asix.h | 4 ++-- drivers/net/usb/asix_common.c | 19 +++++++++++++------ drivers/net/usb/asix_devices.c | 21 ++++++++++++++++++--- 3 files changed, 33 insertions(+), 11 deletions(-)
drivers/net/usb/asix.h +2 -2
@@ -192,8 +192,8 @@ extern const struct driver_info ax88172a_info;/* ASIX specific flags */ #define FLAG_EEPROM_MAC (1UL << 0)/* init device MAC from eeprom */ -int asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, -u16 size,void *data,int in_pm); +int __must_check asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, +u16 size,void *data,int in_pm);int asix_write_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index,u16 size,void *data,int in_pm);
drivers/net/usb/asix_common.c +13 -6
@@ -11,8 +11,8 @@#define AX_HOST_EN_RETRIES 30 -int asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, -u16 size,void *data,int in_pm) +int __must_check asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, +u16 size,void *data,int in_pm) {int ret;int (*fn)(struct usbnet *,u8 ,u8 ,u16 ,u16 ,void *,u16 );
@@ -27,9 +27,12 @@ int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, ret =fn (dev, cmd,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , value, index, data, size); -if (unlikely (ret <0 )) +if (unlikely (ret < size)) { + ret = ret <0 ? ret : -ENODATA ; +netdev_warn (dev->net,"Failed to read reg index 0x%04x: %d\n" , index, ret); + }return ret; }
@@ -79,7 +82,7 @@ static int asix_check_host_enable(struct usbnet *dev, int in_pm) 0, 0, 1, &smsr, in_pm);if (ret == -ENODEV )break ; -else if (ret <sizeof (smsr)) +else if (ret <0 )continue ;else if (smsr &AX_HOST_EN )break ;
@@ -579,8 +582,12 @@ int asix_mdio_read_nopm(struct net_device *netdev, int phy_id, int loc)return ret; } -asix_read_cmd (dev,AX_CMD_READ_MII_REG , phy_id, - (__u16 )loc,2 , &res,1 ); + ret =asix_read_cmd (dev,AX_CMD_READ_MII_REG , phy_id, + (__u16 )loc,2 , &res,1 ); +if (ret <0 ) { +mutex_unlock (&dev->phy_mutex); +return ret; + }asix_set_hw_mii (dev,1 );mutex_unlock (&dev->phy_mutex);
drivers/net/usb/asix_devices.c +18 -3
@@ -755,7 +755,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) priv->phy_addr = ret; priv->embd_phy = ((priv->phy_addr &0x1f ) ==0x10 ); -asix_read_cmd (dev,AX_CMD_STATMNGSTS_REG ,0 ,0 ,1 , &chipcode,0 ); + ret =asix_read_cmd (dev,AX_CMD_STATMNGSTS_REG ,0 ,0 ,1 , &chipcode,0 ); +if (ret <0 ) { +netdev_dbg (dev->net,"Failed to read STATMNGSTS_REG: %d\n" , ret); +return ret; + } + chipcode &=AX_CHIPCODE_MASK ; ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
@@ -920,11 +925,21 @@ static int ax88178_reset(struct usbnet *dev)int gpio0 =0 ;u32 phyid; -asix_read_cmd (dev,AX_CMD_READ_GPIOS ,0 ,0 ,1 , &status,0 ); + ret =asix_read_cmd (dev,AX_CMD_READ_GPIOS ,0 ,0 ,1 , &status,0 ); +if (ret <0 ) { +netdev_dbg (dev->net,"Failed to read GPIOS: %d\n" , ret); +return ret; + } +netdev_dbg (dev->net,"GPIO Status: 0x%04x\n" , status);asix_write_cmd (dev,AX_CMD_WRITE_ENABLE ,0 ,0 ,0 ,NULL ,0 ); -asix_read_cmd (dev,AX_CMD_READ_EEPROM ,0x0017 ,0 ,2 , &eeprom,0 ); + ret =asix_read_cmd (dev,AX_CMD_READ_EEPROM ,0x0017 ,0 ,2 , &eeprom,0 ); +if (ret <0 ) { +netdev_dbg (dev->net,"Failed to read EEPROM: %d\n" , ret); +return ret; + } +asix_write_cmd (dev,AX_CMD_WRITE_DISABLE ,0 ,0 ,0 ,NULL ,0 );netdev_dbg (dev->net,"EEPROM index 0x17 is 0x%04x\n" , eeprom);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 435/913 i2c: bcm2835: Use platform_get_irq() to get the interrupt
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit c3b2f911ac11892b672df7829becf28d3a830073 ]
platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static allocation of IRQ resources in DT core code, this causes an issue when using hierarchical interrupt domains using "interrupts" property in the node as this bypasses the hierarchical setup and messes up the irq chaining.
In preparation for removal of static setup of IRQ resource from DT core code use platform_get_irq().
--- drivers/i2c/busses/i2c-bcm2835.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-bcm2835.c +4 -7
@@ -407,7 +407,7 @@ static const struct i2c_adapter_quirks bcm2835_i2c_quirks = {static int bcm2835_i2c_probe (struct platform_device *pdev) {struct bcm2835_i2c_dev *i2c_dev; -struct resource *mem, *irq; +struct resource *mem;int ret;struct i2c_adapter *adap;struct clk *mclk;
@@ -457,12 +457,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)return ret; } - irq =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); -if (!irq) { -dev_err (&pdev->dev,"No IRQ resource\n" ); -return -ENODEV ; - } - i2c_dev->irq = irq->start; + i2c_dev->irq =platform_get_irq (pdev,0 ); +if (i2c_dev->irq <0 ) +return i2c_dev->irq; ret =request_irq (i2c_dev->irq, bcm2835_i2c_isr,IRQF_SHARED ,dev_name (&pdev->dev), i2c_dev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 436/913 i2c: bcm2835: Fix the error handling in bcm2835_i2c_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit b205f5850263632b6897d8f0bfaeeea4955f8663 ]
Some resource should be released if an error occurs in 'bcm2835_i2c_probe()'.
Add an error handling path and the needed 'clk_disable_unprepare()' and 'clk_rate_exclusive_put()' calls.
While at it, rework the bottom of the function to use this newly added error handling path and have an explicit and more standard "return 0;" at the end of the normal path.
--- drivers/i2c/busses/i2c-bcm2835.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-bcm2835.c +16 -5
@@ -454,18 +454,20 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) ret =clk_prepare_enable (i2c_dev->bus_clk);if (ret) {dev_err (&pdev->dev,"Couldn't prepare clock" ); -return ret; + goto err_put_exclusive_rate; } i2c_dev->irq =platform_get_irq (pdev,0 ); -if (i2c_dev->irq <0 ) -return i2c_dev->irq; +if (i2c_dev->irq <0 ) { + ret = i2c_dev->irq; + goto err_disable_unprepare_clk; + } ret =request_irq (i2c_dev->irq, bcm2835_i2c_isr,IRQF_SHARED ,dev_name (&pdev->dev), i2c_dev);if (ret) {dev_err (&pdev->dev,"Could not request IRQ\n" ); -return -ENODEV ; + goto err_disable_unprepare_clk; } adap = &i2c_dev->adapter;
@@ -489,7 +491,16 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) ret =i2c_add_adapter (adap);if (ret) -free_irq (i2c_dev->irq, i2c_dev); + goto err_free_irq; + +return 0 ; + +err_free_irq: +free_irq (i2c_dev->irq, i2c_dev); +err_disable_unprepare_clk: +clk_disable_unprepare (i2c_dev->bus_clk); +err_put_exclusive_rate: +clk_rate_exclusive_put (i2c_dev->bus_clk);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 437/913 mtd: mchp23k256: Add SPI ID table
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit bc7ee2e34b219da6813c17a1680dd20766648883 ]
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything.
--- drivers/mtd/devices/mchp23k256.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/mtd/devices/mchp23k256.c +14 -0
@@ -229,6 +229,19 @@ static const struct of_device_id mchp23k256_of_table[] = { };MODULE_DEVICE_TABLE (of, mchp23k256_of_table); +static const struct spi_device_id mchp23k256_spi_ids[] = { + { + .name ="mchp23k256" , + .driver_data = (kernel_ulong_t)&mchp23k256_caps, + }, + { + .name ="mchp23lcv1024" , + .driver_data = (kernel_ulong_t)&mchp23lcv1024_caps, + }, + {} +}; +MODULE_DEVICE_TABLE (spi, mchp23k256_spi_ids); +static struct spi_driver mchp23k256_driver = { .driver = { .name ="mchp23k256" ,
@@ -236,6 +249,7 @@ static struct spi_driver mchp23k256_driver = { }, .probe = mchp23k256_probe, .remove = mchp23k256_remove, + .id_table = mchp23k256_spi_ids, };module_spi_driver (mchp23k256_driver);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 438/913 mtd: mchp48l640: Add SPI ID table
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 69a6d06878f05d63673b0dcdc3c3ef1af2996d46 ]
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything.
--- drivers/mtd/devices/mchp48l640.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mtd/devices/mchp48l640.c +10 -0
@@ -357,6 +357,15 @@ static const struct of_device_id mchp48l640_of_table[] = { };MODULE_DEVICE_TABLE (of, mchp48l640_of_table); +static const struct spi_device_id mchp48l640_spi_ids[] = { + { + .name ="48l640" , + .driver_data = (kernel_ulong_t)&mchp48l640_caps, + }, + {} +}; +MODULE_DEVICE_TABLE (spi, mchp48l640_spi_ids); +static struct spi_driver mchp48l640_driver = { .driver = { .name ="mchp48l640" ,
@@ -364,6 +373,7 @@ static struct spi_driver mchp48l640_driver = { }, .probe = mchp48l640_probe, .remove = mchp48l640_remove, + .id_table = mchp48l640_spi_ids, };module_spi_driver (mchp48l640_driver);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 439/913 igc: avoid kernel warning when changing RX ring parameters
In reply to Greg Kroah-HartmanFrom: Corinna Vinschen <[email protected]>
[ Upstream commit 453307b569a0d41bddd07f26bf41b784cd82a4c9 ]
Calling ethtool changing the RX ring parameters like this:
$ ethtool -G eth0 rx 1024
on igc triggers kernel warnings like this:
[ 225.198467] ------------[ cut here ]------------ [ 225.198473] Missing unregister, handled but fix driver [ 225.198485] WARNING: CPU: 7 PID: 959 at net/core/xdp.c:168 xdp_rxq_info_reg+0x79/0xd0 [...] [ 225.198601] Call Trace: [ 225.198604] <TASK> [ 225.198609] igc_setup_rx_resources+0x3f/0xe0 [igc] [ 225.198617] igc_ethtool_set_ringparam+0x30e/0x450 [igc] [ 225.198626] ethnl_set_rings+0x18a/0x250 [ 225.198631] genl_family_rcv_msg_doit+0xca/0x110 [ 225.198637] genl_rcv_msg+0xce/0x1c0 [ 225.198640] ? rings_prepare_data+0x60/0x60 [ 225.198644] ? genl_get_cmd+0xd0/0xd0 [ 225.198647] netlink_rcv_skb+0x4e/0xf0 [ 225.198652] genl_rcv+0x24/0x40 [ 225.198655] netlink_unicast+0x20e/0x330 [ 225.198659] netlink_sendmsg+0x23f/0x480 [ 225.198663] sock_sendmsg+0x5b/0x60 [ 225.198667] __sys_sendto+0xf0/0x160 [ 225.198671] ? handle_mm_fault+0xb2/0x280 [ 225.198676] ? do_user_addr_fault+0x1eb/0x690 [ 225.198680] __x64_sys_sendto+0x20/0x30 [ 225.198683] do_syscall_64+0x38/0x90 [ 225.198687] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 225.198693] RIP: 0033:0x7f7ae38ac3aa
igc_ethtool_set_ringparam() copies the igc_ring structure but neglects to reset the xdp_rxq_info member before calling igc_setup_rx_resources(). This in turn calls xdp_rxq_info_reg() with an already registered xdp_rxq_info.
Make sure to unregister the xdp_rxq_info structure first in igc_setup_rx_resources.
--- drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igc/igc_main.c +3 -0
@@ -504,6 +504,9 @@ int igc_setup_rx_resources(struct igc_ring *rx_ring)u8 index = rx_ring->queue_index;int size, desc_len, res; +/* XDP RX-queue info */ +if (xdp_rxq_info_is_reg (&rx_ring->xdp_rxq)) +xdp_rxq_info_unreg (&rx_ring->xdp_rxq); res =xdp_rxq_info_reg (&rx_ring->xdp_rxq, ndev, index, rx_ring->q_vector->napi.napi_id);if (res <0 ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 440/913 igb: refactor XDP registration
In reply to Greg Kroah-HartmanFrom: Corinna Vinschen <[email protected]>
[ Upstream commit e62ad74aa534404b3ee7e250b114a3536ac56987 ]
On changing the RX ring parameters igb uses a hack to avoid a warning when calling xdp_rxq_info_reg via igb_setup_rx_resources. It just clears the struct xdp_rxq_info content.
Instead, change this to unregister if we're already registered. Align code to the igc code.
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ---- drivers/net/ethernet/intel/igb/igb_main.c | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +0 -4
@@ -961,10 +961,6 @@ static int igb_set_ringparam(struct net_device *netdev,memcpy (&temp_ring[i], adapter->rx_ring[i],sizeof (struct igb_ring )); -/* Clear copied XDP RX-queue info */ -memset (&temp_ring[i].xdp_rxq,0 , -sizeof (temp_ring[i].xdp_rxq)); - temp_ring[i].count = new_rx_count; err =igb_setup_rx_resources (&temp_ring[i]);if (err) {
drivers/net/ethernet/intel/igb/igb_main.c +13 -6
@@ -4345,7 +4345,18 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) {struct igb_adapter *adapter =netdev_priv (rx_ring->netdev);struct device *dev = rx_ring->dev; -int size; +int size, res; + +/* XDP RX-queue info */ +if (xdp_rxq_info_is_reg (&rx_ring->xdp_rxq)) +xdp_rxq_info_unreg (&rx_ring->xdp_rxq); + res =xdp_rxq_info_reg (&rx_ring->xdp_rxq, rx_ring->netdev, + rx_ring->queue_index,0 ); +if (res <0 ) { +dev_err (dev,"Failed to register xdp_rxq index %u\n" , + rx_ring->queue_index); +return res; + } size =sizeof (struct igb_rx_buffer ) * rx_ring->count;
@@ -4368,14 +4379,10 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) rx_ring->xdp_prog = adapter->xdp_prog; -/* XDP RX-queue info */ -if (xdp_rxq_info_reg (&rx_ring->xdp_rxq, rx_ring->netdev, - rx_ring->queue_index,0 ) <0 ) - goto err; -return 0 ; err: +xdp_rxq_info_unreg (&rx_ring->xdp_rxq);vfree (rx_ring->rx_buffer_info); rx_ring->rx_buffer_info =NULL ;dev_err (dev,"Unable to allocate memory for the Rx descriptor ring\n" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 441/913 PCI: aardvark: Fix reading MSI interrupt number
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 805dfc18dd3d4dd97a987d4406593b5a225b1253 ]
In advk_pcie_handle_msi() it is expected that when bit i in the W1C register PCIE_MSI_STATUS_REG is cleared, the PCIE_MSI_PAYLOAD_REG is updated to contain the MSI number corresponding to index i.
Experiments show that this is not so, and instead PCIE_MSI_PAYLOAD_REG always contains the number of the last received MSI, overall.
Do not read PCIE_MSI_PAYLOAD_REG register for determining MSI interrupt number. Since Aardvark already forbids more than 32 interrupts and uses own allocated hwirq numbers, the msi_idx already corresponds to the received MSI number.
--- drivers/pci/controller/pci-aardvark.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/pci/controller/pci-aardvark.c +2 -7
@@ -1381,7 +1381,6 @@ static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie)static void advk_pcie_handle_msi (struct advk_pcie *pcie) {u32 msi_val, msi_mask, msi_status, msi_idx; -u16 msi_data; msi_mask =advk_readl (pcie,PCIE_MSI_MASK_REG ); msi_val =advk_readl (pcie,PCIE_MSI_STATUS_REG );
@@ -1391,13 +1390,9 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie)if (!(BIT (msi_idx) & msi_status))continue ; -/* -* msi_idx contains bits [4:0] of the msi_data and msi_data -* contains 16bit MSI interrupt number -*/ advk_writel (pcie,BIT (msi_idx),PCIE_MSI_STATUS_REG ); - msi_data =advk_readl (pcie,PCIE_MSI_PAYLOAD_REG ) &PCIE_MSI_DATA_MASK ; -generic_handle_irq (msi_data); +if (generic_handle_domain_irq (pcie->msi_inner_domain, msi_idx) == -EINVAL ) +dev_err_ratelimited (&pcie->pdev->dev,"unexpected MSI 0x%02x\n" , msi_idx); } advk_writel(pcie, PCIE_ISR0_MSI_INT_PENDING,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 442/913 PCI: aardvark: Fix reading PCI_EXP_RTSTA_PME bit on emulated bridge
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 735f5ae49e1b44742cc63ca9b5c1ffde3e94ba91 ]
The emulated bridge returns incorrect value for PCI_EXP_RTSTA register during readout in advk_pci_bridge_emul_pcie_conf_read() function: the correct bit is BIT(16), but we are setting BIT(23), because the code does
*value = (isr0 & PCIE_MSG_PM_PME_MASK) << 16
where
PCIE_MSG_PM_PME_MASK
is
BIT(7).
The code should probably have been something like
*value = (!!(isr0 & PCIE_MSG_PM_PME_MASK)) << 16,
but we are better of using an if() and using the proper macro for this bit.
--- drivers/pci/controller/pci-aardvark.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +3 -1
@@ -844,7 +844,9 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge,case PCI_EXP_RTSTA : {u32 isr0 =advk_readl (pcie,PCIE_ISR0_REG );u32 msglog =advk_readl (pcie,PCIE_MSG_LOG_REG ); - *value = (isr0 &PCIE_MSG_PM_PME_MASK ) <<16 | (msglog >>16 ); + *value = msglog >>16 ; +if (isr0 &PCIE_MSG_PM_PME_MASK ) + *value |=PCI_EXP_RTSTA_PME ;return PCI_BRIDGE_EMUL_HANDLED ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 443/913 RDMA/rxe: Check the last packet by RXE_END_MASK
In reply to Greg Kroah-HartmanFrom: Xiao Yang <[email protected]>
[ Upstream commit b1377cc37f6bebd57ce8747b7e16163a475af295 ]
It's wrong to check the last packet by RXE_COMP_MASK because the flag is to indicate if responder needs to generate a completion.
--- drivers/infiniband/sw/rxe/rxe_resp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +6 -4
@@ -830,6 +830,10 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt)return RESPST_ERR_INVALIDATE_RKEY ; } +if (pkt->mask &RXE_END_MASK ) +/* We successfully processed this new request. */ + qp->resp.msn++; +/* next expected psn, read handles this separately */ qp->resp.psn = (pkt->psn +1 ) &BTH_PSN_MASK ; qp->resp.ack_psn = qp->resp.psn;
@@ -837,11 +841,9 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt) qp->resp.opcode = pkt->opcode; qp->resp.status =IB_WC_SUCCESS ; -if (pkt->mask &RXE_COMP_MASK ) { -/* We successfully processed this new request. */ - qp->resp.msn++; +if (pkt->mask &RXE_COMP_MASK )return RESPST_COMPLETE ; - }else if (qp_type (qp) ==IB_QPT_RC ) +else if (qp_type (qp) ==IB_QPT_RC )return RESPST_ACKNOWLEDGE ;else return RESPST_CLEANUP ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 444/913 libbpf: Fix signedness bug in btf_dump_array_data()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4172843ed4a38f97084032f74f07b2037b5da3a6 ]
The btf__resolve_size() function returns negative error codes so "elem_size" must be signed for the error handling to work.
--- tools/lib/bpf/btf_dump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/lib/bpf/btf_dump.c +3 -2
@@ -1829,14 +1829,15 @@ static int btf_dump_array_data(struct btf_dump *d, {const struct btf_array *array =btf_array (t);const struct btf_type *elem_type; -__u32 i, elem_size =0 , elem_type_id; +__u32 i, elem_type_id; +__s64 elem_size;bool is_array_member; elem_type_id = array->type; elem_type =skip_mods_and_typedefs (d->btf, elem_type_id,NULL ); elem_size =btf__resolve_size (d->btf, elem_type_id);if (elem_size <=0 ) { -pr_warn ("unexpected elem size %d for array type [%u]\n" , elem_size, id); +pr_warn ("unexpected elem size %lld for array type [%u]\n" , elem_size, id);return -EINVAL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 445/913 cxl/core: Fix cxl_probe_component_regs() error message
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit d621bc2e7282f9955033a6359877fd4ac4be60e1 ]
Fix a '\n' vs '/n' typo.
--- drivers/cxl/core/regs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/regs.c +1 -1
@@ -49,7 +49,7 @@ void cxl_probe_component_regs(struct device *dev, void __iomem *base,if (FIELD_GET (CXL_CM_CAP_HDR_ID_MASK , cap_array) !=CM_CAP_HDR_CAP_ID ) {dev_err (dev, -"Couldn't locate the CXL.cache and CXL.mem capability array header./n" ); +"Couldn't locate the CXL.cache and CXL.mem capability array header.\n" );return ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 446/913 cxl/regs: Fix size of CXL Capability Header Register
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 74b0fe80409733055971bbfaf33c80a33fddeeb3 ]
In CXL 2.0, 8.2.5.1 CXL Capability Header Register: this register is given as 32 bits.
8.2.3 which covers the CXL 2.0 Component registers, including the CXL Capability Header Register states that access restrictions specified in Section 8.2.2 apply.
8.2.2 includes:
* A 32 bit register shall be accessed as a 4 Byte quantity.
...
If these rules are not followed, the behavior is undefined.
Discovered during review of CXL QEMU emulation. Alex Bennée pointed out there was a comment saying that 4 byte registers must be read with a 4 byte read, but 8 byte reads were being emulated.
https://lore.kernel.org/qemu-devel/[email protected]/
Fixing that, led to this code failing. Whilst a given hardware implementation 'might' work with an 8 byte read, it should not be relied upon. The QEMU emulation v5 will return 0 and log the wrong access width.
The code moved, so one fixes tag for where this will directly apply and also a reference to the earlier introduction of the code for backports.
--- drivers/cxl/core/regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cxl/core/regs.c +2 -2
@@ -35,7 +35,7 @@ void cxl_probe_component_regs(struct device *dev, void __iomem *base, struct cxl_component_reg_map *map) {int cap, cap_count; -u64 cap_array; +u32 cap_array; *map = (struct cxl_component_reg_map ) {0 };
@@ -45,7 +45,7 @@ void cxl_probe_component_regs(struct device *dev, void __iomem *base,*/ base +=CXL_CM_OFFSET ; - cap_array =readq (base +CXL_CM_CAP_HDR_OFFSET ); + cap_array =readl (base +CXL_CM_CAP_HDR_OFFSET );if (FIELD_GET (CXL_CM_CAP_HDR_ID_MASK , cap_array) !=CM_CAP_HDR_CAP_ID ) { dev_err(dev,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 447/913 net:enetc: allocate CBD ring data memory using DMA coherent methods
In reply to Greg Kroah-HartmanFrom: Po Liu <[email protected]>
[ Upstream commit b3a723dbc94a6e38f67669d03b521edd766ad895 ]
To replace the dma_map_single() stream DMA mapping with DMA coherent method dma_alloc_coherent() which is more simple.
dma_map_single() found by Tim Gardner not proper. Suggested by Claudiu Manoil and Jakub Kicinski to use dma_alloc_coherent(). Discussion at:
--- .../net/ethernet/freescale/enetc/enetc_qos.c | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_qos.c +64 -64
@@ -45,6 +45,7 @@ void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed) | pspeed); } +#define ENETC_QOS_ALIGN 64static int enetc_setup_taprio (struct net_device *ndev,struct tc_taprio_qopt_offload *admin_conf) {
@@ -52,10 +53,11 @@ static int enetc_setup_taprio(struct net_device *ndev,struct enetc_cbd cbd = {.cmd =0 };struct tgs_gcl_conf *gcl_config;struct tgs_gcl_data *gcl_data; +dma_addr_t dma, dma_align;struct gce *gce; -dma_addr_t dma;u16 data_size;u16 gcl_len; +void *tmp;u32 tge;int err;int i;
@@ -82,9 +84,16 @@ static int enetc_setup_taprio(struct net_device *ndev, gcl_config = &cbd.gcl_conf; data_size =struct_size (gcl_data, entry, gcl_len); - gcl_data =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!gcl_data) + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of taprio gate list failed!\n" );return -ENOMEM ; + } + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + gcl_data = (struct tgs_gcl_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); gce = (struct gce *)(gcl_data +1 );
@@ -110,16 +119,8 @@ static int enetc_setup_taprio(struct net_device *ndev, cbd.length =cpu_to_le16 (data_size); cbd.status_flags =0 ; - dma =dma_map_single (&priv->si->pdev->dev, gcl_data, - data_size,DMA_TO_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); -kfree (gcl_data); -return -ENOMEM ; - } - - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align)); cbd.cls =BDCR_CMD_PORT_GCL ; cbd.status_flags =0 ;
@@ -132,8 +133,8 @@ static int enetc_setup_taprio(struct net_device *ndev,ENETC_QBV_PTGCR_OFFSET , tge & (~ENETC_QBV_TGE)); -dma_unmap_single (&priv->si->pdev->dev, dma, data_size,DMA_TO_DEVICE ); -kfree (gcl_data); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma);return err; }
@@ -463,8 +464,9 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv,struct enetc_cbd cbd = {.cmd =0 };struct streamid_data *si_data;struct streamid_conf *si_conf; +dma_addr_t dma, dma_align;u16 data_size; -dma_addr_t dma; +void *tmp;int port;int err;
@@ -485,21 +487,20 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, cbd.status_flags =0 ; data_size =sizeof (struct streamid_data ); - si_data =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!si_data) + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of stream identify failed!\n" );return -ENOMEM ; - cbd.length =cpu_to_le16 (data_size); - - dma =dma_map_single (&priv->si->pdev->dev, si_data, - data_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); - err = -ENOMEM ; - goto out; } + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + si_data = (struct streamid_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.length =cpu_to_le16 (data_size); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align));eth_broadcast_addr (si_data->dmac); si_data->vid_vidm_tg = (ENETC_CBDR_SID_VID_MASK + ((0x3 <<14 ) |ENETC_CBDR_SID_VIDM ));
@@ -539,8 +540,8 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, cbd.length =cpu_to_le16 (data_size); - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align));/* VIDM default to be 1. * VID Match. If set (b1) then the VID must match, otherwise
@@ -561,10 +562,8 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, err =enetc_send_cmd (priv->si, &cbd); out: -if (!dma_mapping_error (&priv->si->pdev->dev, dma)) -dma_unmap_single (&priv->si->pdev->dev, dma, data_size,DMA_FROM_DEVICE ); - -kfree (si_data); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma);return err; }
@@ -633,8 +632,9 @@ static int enetc_streamcounter_hw_get(struct enetc_ndev_priv *priv, {struct enetc_cbd cbd = { .cmd =2 };struct sfi_counter_data *data_buf; -dma_addr_t dma; +dma_addr_t dma, dma_align;u16 data_size; +void *tmp;int err; cbd.index =cpu_to_le16 ((u16 )index);
@@ -643,19 +643,19 @@ static int enetc_streamcounter_hw_get(struct enetc_ndev_priv *priv, cbd.status_flags =0 ; data_size =sizeof (struct sfi_counter_data ); - data_buf =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!data_buf) + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of stream counter failed!\n" );return -ENOMEM ; - - dma =dma_map_single (&priv->si->pdev->dev, data_buf, - data_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); - err = -ENOMEM ; - goto exit; } - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + data_buf = (struct sfi_counter_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); + + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align)); cbd.length =cpu_to_le16 (data_size);
@@ -684,7 +684,9 @@ static int enetc_streamcounter_hw_get(struct enetc_ndev_priv *priv, data_buf->flow_meter_dropl; exit: -kfree (data_buf); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma); +return err; }
@@ -723,9 +725,10 @@ static int enetc_streamgate_hw_set(struct enetc_ndev_priv *priv,struct sgcl_conf *sgcl_config;struct sgcl_data *sgcl_data;struct sgce *sgce; -dma_addr_t dma; +dma_addr_t dma, dma_align;u16 data_size;int err, i; +void *tmp;u64 now; cbd.index =cpu_to_le16 (sgi->index);
@@ -772,24 +775,20 @@ static int enetc_streamgate_hw_set(struct enetc_ndev_priv *priv, sgcl_config->acl_len = (sgi->num_entries -1 ) &0x3 ; data_size =struct_size (sgcl_data, sgcl, sgi->num_entries); - - sgcl_data =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!sgcl_data) -return -ENOMEM ; - - cbd.length =cpu_to_le16 (data_size); - - dma =dma_map_single (&priv->si->pdev->dev, - sgcl_data, data_size, -DMA_FROM_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); -kfree (sgcl_data); + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of stream counter failed!\n" );return -ENOMEM ; } + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + sgcl_data = (struct sgcl_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.length =cpu_to_le16 (data_size); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align)); sgce = &sgcl_data->sgcl[0 ];
@@ -844,7 +843,8 @@ static int enetc_streamgate_hw_set(struct enetc_ndev_priv *priv, err =enetc_send_cmd (priv->si, &cbd); exit: -kfree (sgcl_data); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma);return err; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 448/913 libbpf: Fix compilation warning due to mismatched printf format
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit dc37dc617fabfb1c3a16d49f5d8cc20e9e3608ca ]
On ppc64le architecture __s64 is long int and requires %ld. Cast to ssize_t and use %zd to avoid architecture-specific specifiers.
--- tools/lib/bpf/btf_dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/lib/bpf/btf_dump.c +2 -1
@@ -1837,7 +1837,8 @@ static int btf_dump_array_data(struct btf_dump *d, elem_type =skip_mods_and_typedefs (d->btf, elem_type_id,NULL ); elem_size =btf__resolve_size (d->btf, elem_type_id);if (elem_size <=0 ) { -pr_warn ("unexpected elem size %lld for array type [%u]\n" , elem_size, id); +pr_warn ("unexpected elem size %zd for array type [%u]\n" , + (ssize_t )elem_size, id);return -EINVAL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 449/913 drm/bridge: dw-hdmi: use safe format when first in bridge chain
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit 1528038385c0a706aac9ac165eeb24044fef6825 ]
When the dw-hdmi bridge is in first place of the bridge chain, this means there is no way to select an input format of the dw-hdmi HW component.
Since introduction of display-connector, negotiation was broken since the dw-hdmi negotiation code only worked when the dw-hdmi bridge was in last position of the bridge chain or behind another bridge also supporting input & output format negotiation.
Commit 7cd70656d128 ("drm/bridge: display-connector: implement bus fmts callbacks") was introduced to make negotiation work again by making display-connector act as a pass-through concerning input & output format negotiation.
But in the case where the dw-hdmi is single in the bridge chain, for example on Renesas SoCs, with the display-connector bridge the dw-hdmi is no more single, breaking output format.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -2
@@ -2551,8 +2551,9 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,if (!output_fmts)return NULL ; -/* If dw-hdmi is the only bridge, avoid negociating with ourselves */ -if (list_is_singular (&bridge->encoder->bridge_chain)) { +/* If dw-hdmi is the first or only bridge, avoid negociating with ourselves */ +if (list_is_singular (&bridge->encoder->bridge_chain) || +list_is_first (&bridge->chain_node, &bridge->encoder->bridge_chain)) { *num_output_fmts =1 ; output_fmts[0 ] =MEDIA_BUS_FMT_FIXED ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 450/913 libbpf: Use dynamically allocated buffer when receiving netlink messages
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 9c3de619e13ee6693ec5ac74f50b7aa89056a70e ]
When receiving netlink messages, libbpf was using a statically allocated stack buffer of 4k bytes. This happened to work fine on systems with a 4k page size, but on systems with larger page sizes it can lead to truncated messages. The user-visible impact of this was that libbpf would insist no XDP program was attached to some interfaces because that bit of the netlink message got chopped off.
Fix this by switching to a dynamically allocated buffer; we borrow the approach from iproute2 of using recvmsg() with MSG_PEEK|MSG_TRUNC to get the actual size of the pending message before receiving it, adjusting the buffer as necessary. While we're at it, also add retries on interrupted system calls around the recvmsg() call.
v2:
- Move peek logic to libbpf_netlink_recv(), don't double free on ENOMEM.
--- tools/lib/bpf/netlink.c | 55 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-)
tools/lib/bpf/netlink.c +51 -4
@@ -87,29 +87,75 @@ enum { NL_DONE, }; +static int netlink_recvmsg (int sock,struct msghdr *mhdr,int flags) +{ +int len; + +do { + len =recvmsg (sock, mhdr, flags); + }while (len <0 && (errno ==EINTR || errno ==EAGAIN )); + +if (len <0 ) +return -errno; +return len; +} + +static int alloc_iov (struct iovec *iov,int len) +{ +void *nbuf; + + nbuf =realloc (iov->iov_base, len); +if (!nbuf) +return -ENOMEM ; + + iov->iov_base = nbuf; + iov->iov_len = len; +return 0 ; +} +static int libbpf_netlink_recv (int sock,__u32 nl_pid,int seq,__dump_nlmsg_t _fn,libbpf_dump_nlmsg_t fn,void *cookie) { +struct iovec iov = {}; +struct msghdr mhdr = { + .msg_iov = &iov, + .msg_iovlen =1 , + };bool multipart = true;struct nlmsgerr *err;struct nlmsghdr *nh; -char buf[4096 ];int len, ret; + ret =alloc_iov (&iov,4096 ); +if (ret) + goto done; +while (multipart) { start: multipart = false; - len =recv (sock, buf,sizeof (buf),0 ); + len =netlink_recvmsg (sock, &mhdr,MSG_PEEK |MSG_TRUNC ); +if (len <0 ) { + ret = len; + goto done; + } + +if (len > iov.iov_len) { + ret =alloc_iov (&iov, len); +if (ret) + goto done; + } + + len =netlink_recvmsg (sock, &mhdr,0 );if (len <0 ) { - ret = -errno; + ret = len; goto done; }if (len ==0 )break ; -for (nh = (struct nlmsghdr *)buf;NLMSG_OK (nh, len); +for (nh = (struct nlmsghdr *)iov.iov_base;NLMSG_OK (nh, len); nh =NLMSG_NEXT (nh, len)) {if (nh->nlmsg_pid != nl_pid) { ret = -LIBBPF_ERRNO__WRNGPID ;
@@ -151,6 +197,7 @@ static int libbpf_netlink_recv(int sock, __u32 nl_pid, int seq, } ret =0 ; done: +free (iov.iov_base);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 451/913 power: supply: ab8500: Fix memory leak in ab8500_fg_sysfs_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 6a4760463dbc6b603690938c468839985189ce0a ]
kobject_init_and_add() takes reference even when it fails. According to the doc of kobject_init_and_add():
If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object.
Fix memory leak by calling kobject_put().
--- drivers/power/supply/ab8500_fg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/power/supply/ab8500_fg.c +3 -1
@@ -2545,8 +2545,10 @@ static int ab8500_fg_sysfs_init(struct ab8500_fg *di) ret =kobject_init_and_add (&di->fg_kobject, &ab8500_fg_ktype,NULL ,"battery" ); -if (ret <0 ) +if (ret <0 ) { +kobject_put (&di->fg_kobject);dev_err (di->dev,"failed to create sysfs entry\n" ); + }return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 452/913 HID: i2c-hid: fix GET/SET_REPORT for unnumbered reports
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit a5e5e03e94764148a01757b2fa4737d3445c13a6 ]
Internally kernel prepends all report buffers, for both numbered and unnumbered reports, with report ID, therefore to properly handle unnumbered reports we should prepend it ourselves.
For the same reason we should skip the first byte of the buffer when calling i2c_hid_set_or_send_report() which then will take care of properly formatting the transfer buffer based on its separate report ID argument along with report payload.
--- drivers/hid/i2c-hid/i2c-hid-core.c | 32 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
drivers/hid/i2c-hid/i2c-hid-core.c +24 -8
@@ -615,6 +615,17 @@ static int i2c_hid_get_raw_report(struct hid_device *hid,if (report_type ==HID_OUTPUT_REPORT )return -EINVAL ; +/* +* In case of unnumbered reports the response from the device will +* not have the report ID that the upper layers expect, so we need +* to stash it the buffer ourselves and adjust the data size. +*/ +if (!report_number) { + buf[0 ] =0 ; + buf++; + count--; + } +/* +2 bytes to include the size of the reply in the query buffer */ ask_count =min (count +2 , (size_t )ihid->bufsize);
@@ -636,6 +647,9 @@ static int i2c_hid_get_raw_report(struct hid_device *hid, count =min (count, ret_count -2 );memcpy (buf, ihid->rawbuf +2 , count); +if (!report_number) + count++; +return count; }
@@ -652,17 +666,19 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf,mutex_lock (&ihid->reset_lock); -if (report_id) { - buf++; - count--; - } - +/* +* Note that both numbered and unnumbered reports passed here +* are supposed to have report ID stored in the 1st byte of the +* buffer, so we strip it off unconditionally before passing payload +* to i2c_hid_set_or_send_report which takes care of encoding +* everything properly. +*/ ret =i2c_hid_set_or_send_report (client, report_type ==HID_FEATURE_REPORT ?0x03 :0x02 , - report_id, buf, count, use_data); + report_id, buf +1 , count -1 , use_data); -if (report_id && ret >=0 ) - ret++;/* add report_id to the number of transfered bytes */ +if (ret >=0 ) + ret++;/* add report_id to the number of transferred bytes */ mutex_unlock (&ihid->reset_lock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 453/913 iommu/ipmmu-vmsa: Check for error num after setting mask
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 1fdbbfd5099f797a4dac05e7ef0192ba4a9c39b4 ]
Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num. Therefore, it should be better to check it and return the error if fails.
--- drivers/iommu/ipmmu-vmsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/ipmmu-vmsa.c +3 -1
@@ -982,7 +982,9 @@ static int ipmmu_probe(struct platform_device *pdev)bitmap_zero (mmu->ctx,IPMMU_CTX_MAX ); mmu->features =of_device_get_match_data (&pdev->dev);memset (mmu->utlb_ctx,IPMMU_CTX_INVALID , mmu->features->num_utlbs); -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (40 )); + ret =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (40 )); +if (ret) +return ret;/* Map I/O memory and request IRQ. */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 454/913 drm/bridge: anx7625: Fix overflow issue on reading EDID
In reply to Greg Kroah-HartmanFrom: Pin-Yen Lin <[email protected]>
[ Upstream commit d5c6f647aec9ed524aedd04a3aec5ebc21d39007 ]
The length of EDID block can be longer than 256 bytes, so we should use int instead of u8 for the edid_pos variable.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -1
@@ -791,7 +791,8 @@ static int segments_edid_read(struct anx7625_data *ctx,static int sp_tx_edid_read (struct anx7625_data *ctx,u8 *pedid_blocks_buf) { -u8 offset, edid_pos; +u8 offset; +int edid_pos;int count, blocks_num;u8 pblock_buf[MAX_DPCD_BUFFER_SIZE ];u8 i, j;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 455/913 bpftool: Fix the error when lookup in no-btf maps
In reply to Greg Kroah-HartmanFrom: Yinjun Zhang <[email protected]>
[ Upstream commit edc21dc909c6c133a2727f063eadd7907af51f94 ]
When reworking btf__get_from_id() in commit a19f93cfafdf the error handling when calling bpf_btf_get_fd_by_id() changed. Before the rework if bpf_btf_get_fd_by_id() failed the error would not be propagated to callers of btf__get_from_id(), after the rework it is. This lead to a change in behavior in print_key_value() that now prints an error when trying to lookup keys in maps with no btf available.
Fix this by following the way used in dumping maps to allow to look up keys in no-btf maps, by which it decides whether and where to get the btf info according to the btf value type.
--- tools/bpf/bpftool/map.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/bpf/bpftool/map.c +2 -4
@@ -1042,11 +1042,9 @@ static void print_key_value(struct bpf_map_info *info, void *key,json_writer_t *btf_wtr;struct btf *btf; - btf =btf__load_from_kernel_by_id (info->btf_id); -if (libbpf_get_error (btf)) { -p_err ("failed to get btf" ); + btf =get_map_kv_btf (info); +if (libbpf_get_error (btf))return ; - }if (json_output) {print_entry_json (info, key, value, btf);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 456/913 drm/amd/pm: enable pm sysfs write for one VF mode
In reply to Greg Kroah-HartmanFrom: Yiqing Yao <[email protected]>
[ Upstream commit e610941c45bad75aa839af015c27d236ab6749e5 ]
[why]
pm sysfs should be writable in one VF mode as is in passthrough
[how]
do not remove write access on pm sysfs if device is in one VF mode
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2 -2
@@ -2117,8 +2117,8 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ } } -/* setting should not be allowed from VF */ -if (amdgpu_sriov_vf (adev)) { +/* setting should not be allowed from VF if not in one VF mode */ +if (amdgpu_sriov_vf (adev) && !amdgpu_sriov_is_pp_one_vf (adev)) { dev_attr->attr.mode &= ~S_IWUGO ; dev_attr->store =NULL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 457/913 drm/amd/display: Add affected crtcs to atomic state for dsc mst unplug
In reply to Greg Kroah-HartmanFrom: Roman Li <[email protected]>
[ Upstream commit 128f8ed5902a287a6bb4afe0ffdae8a80b2a64ec ]
[Why]
When display topology changed on DSC hub we add all crtcs with dsc support to atomic state.
Refer to patch:"drm/amd/display: Trigger modesets on MST DSC connectors" However the original implementation may skip crtc if the topology change caused by unplug.
That potentially could lead to no-lightup or corruption on DSC hub after unplug event on one of the connectors.
[How]
Update add_affected_mst_dsc_crtcs() to use old connector state if new connector state has no crtc (undergoes modeset due to unplug)
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -2
@@ -10226,10 +10226,13 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,static int add_affected_mst_dsc_crtcs (struct drm_atomic_state *state,struct drm_crtc *crtc) {struct drm_connector *connector; -struct drm_connector_state *conn_state; +struct drm_connector_state *conn_state, *old_conn_state;struct amdgpu_dm_connector *aconnector =NULL ;int i; -for_each_new_connector_in_state (state, connector, conn_state, i) { +for_each_oldnew_connector_in_state (state, connector, old_conn_state, conn_state, i) { +if (!conn_state->crtc) + conn_state = old_conn_state; +if (conn_state->crtc != crtc)continue ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 458/913 libbpf: Fix memleak in libbpf_netlink_recv()
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 1b8c924a05934d2e758ec7da7bd217ef8ebd80ce ]
Ensure that libbpf_netlink_recv() frees dynamically allocated buffer in all code paths.
--- tools/lib/bpf/netlink.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tools/lib/bpf/netlink.c +5 -3
@@ -176,7 +176,8 @@ static int libbpf_netlink_recv(int sock, __u32 nl_pid, int seq,libbpf_nla_dump_errormsg (nh); goto done;case NLMSG_DONE : -return 0 ; + ret =0 ; + goto done;default :break ; }
@@ -188,9 +189,10 @@ static int libbpf_netlink_recv(int sock, __u32 nl_pid, int seq,case NL_NEXT : goto start;case NL_DONE : -return 0 ; + ret =0 ; + goto done;default : -return ret; + goto done; } } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 459/913 IB/cma: Allow XRC INI QPs to set their local ACK timeout
In reply to Greg Kroah-HartmanFrom: Håkon Bugge <[email protected]>
[ Upstream commit 748663c8ccf6b2e5a800de19127c2cc1c4423fd2 ]
XRC INI QPs should be able to adjust their local ACK timeout.
--- drivers/infiniband/core/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +1 -1
@@ -2640,7 +2640,7 @@ int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout) {struct rdma_id_private *id_priv; -if (id->qp_type !=IB_QPT_RC ) +if (id->qp_type !=IB_QPT_RC && id->qp_type !=IB_QPT_XRC_INI )return -EINVAL ; id_priv = container_of(id, struct rdma_id_private, id);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 460/913 dax: make sure inodes are flushed before destroy cache
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit a7e8de822e0b1979f08767c751f6c8a9c1d4ad86 ]
A bug can be triggered by following command
$ modprobe nd_pmem && modprobe -r nd_pmem
[ 10.060014] BUG dax_cache (Not tainted): Objects remaining in dax_cache on __kmem_cache_shutdown() [ 10.060938] Slab 0x0000000085b729ac objects=9 used=1 fp=0x000000004f5ae469 flags=0x200000000010200(slab|head|node) [ 10.062433] Call Trace: [ 10.062673] dump_stack_lvl+0x34/0x44 [ 10.062865] slab_err+0x90/0xd0 [ 10.063619] __kmem_cache_shutdown+0x13b/0x2f0 [ 10.063848] kmem_cache_destroy+0x4a/0x110 [ 10.064058] __x64_sys_delete_module+0x265/0x300
This is caused by dax_fs_exit() not flushing inodes before destroy cache. To fix this issue, call rcu_barrier() before destroy cache.
--- drivers/dax/super.c | 1 + 1 file changed, 1 insertion(+)
drivers/dax/super.c +1 -0
@@ -678,6 +678,7 @@ static int dax_fs_init(void)static void dax_fs_exit (void ) {kern_unmount (dax_mnt); +rcu_barrier ();kmem_cache_destroy (dax_cache); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 461/913 selftests: mptcp: add csum mib check for mptcp_connect
In reply to Greg Kroah-HartmanFrom: Geliang Tang <[email protected]>
[ Upstream commit 24720d7452df2dff2e539d9dff28904e25bb1c6d ]
This patch added the data checksum error mib counters check for the script mptcp_connect.sh when the data checksum is enabled.
In do_transfer(), got the mib counters twice, before and after running the mptcp_connect commands. The latter minus the former is the actual number of the data checksum mib counter.
The output looks like this:
ns1 MPTCP -> ns2 (dead:beef:1::2:10007) MPTCP (duration 86ms) [ OK ] ns1 MPTCP -> ns2 (10.0.2.1:10008 ) MPTCP (duration 66ms) [ FAIL ]
server got 1 data checksum error[s]
--- .../selftests/net/mptcp/mptcp_connect.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +19 -0
@@ -445,6 +445,8 @@ do_transfer() local stat_ackrx_last_l=$(get_mib_counter "${listener_ns}" "MPTcpExtMPCapableACKRX") local stat_cookietx_last=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesSent") local stat_cookierx_last=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesRecv") + local stat_csum_err_s=$(get_mib_counter "${listener_ns}" "MPTcpExtDataCsumErr") + local stat_csum_err_c=$(get_mib_counter "${connector_ns}" "MPTcpExtDataCsumErr") timeout ${timeout_test} \ ip netns exec ${listener_ns} \
@@ -537,6 +539,23 @@ do_transfer() fi fi + if $checksum; then + local csum_err_s=$(get_mib_counter "${listener_ns}" "MPTcpExtDataCsumErr") + local csum_err_c=$(get_mib_counter "${connector_ns}" "MPTcpExtDataCsumErr") + + local csum_err_s_nr=$((csum_err_s - stat_csum_err_s)) + if [ $csum_err_s_nr -gt 0 ]; then + printf "[ FAIL ]\nserver got $csum_err_s_nr data checksum error[s]" + rets=1 + fi + + local csum_err_c_nr=$((csum_err_c - stat_csum_err_c)) + if [ $csum_err_c_nr -gt 0 ]; then + printf "[ FAIL ]\nclient got $csum_err_c_nr data checksum error[s]" + retc=1 + fi + fi + if [ $retc -eq 0 ] && [ $rets -eq 0 ]; then printf "[ OK ]" fi
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 462/913 iwlwifi: mvm: Dont call iwl_mvm_sta_from_mac80211() with NULL sta
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 30d17c12b0895e15ce22ebc1f52a4ff02df6dbc6 ]
The recent fix for NULL sta in iwl_mvm_get_tx_rate() still has a call of iwl_mvm_sta_from_mac80211() that may be called with NULL sta. Although this practically only points to the address and the actual access doesn't happen due to the conditional evaluation at a later point, it looks a bit flaky.
This patch drops the temporary variable above and evaluates iwm_mvm_sta_from_mac80211() directly for avoiding confusions.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +2 -3
@@ -271,15 +271,14 @@ static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm,/* info->control is only relevant for non HW rate control */ if (!ieee80211_hw_check (mvm->hw,HAS_RATE_CONTROL )) { -struct iwl_mvm_sta *mvmsta =iwl_mvm_sta_from_mac80211 (sta); -/* HT rate doesn't make sense for a non data frame */ WARN_ONCE (info->control.rates[0 ].flags &IEEE80211_TX_RC_MCS && !ieee80211_is_data (fc),"Got a HT rate (flags:0x%x/mcs:%d/fc:0x%x/state:%d) for a non data frame\n" , info->control.rates[0 ].flags, info->control.rates[0 ].idx, -le16_to_cpu (fc), sta ? mvmsta->sta_state :-1 ); +le16_to_cpu (fc), + sta ?iwl_mvm_sta_from_mac80211 (sta)->sta_state :-1 ); rate_idx = info->control.rates[0 ].idx; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 463/913 iwlwifi: mvm: dont iterate unadded vifs when handling FW SMPS req
In reply to Greg Kroah-HartmanFrom: Luca Coelho <[email protected]>
[ Upstream commit 8a265d1a619c16400406c9d598411850ee104aed ]
We may not have all the interfaces added to the driver when we get the THERMAL_DUAL_CHAIN_REQUEST notification from the FW, so instead of iterating all vifs to update SMPS, iterate only the ones that are already assigned. The interfaces that were not assigned yet, will be updated accordingly when we start using them.
--- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +2 -1
@@ -238,7 +238,8 @@ static void iwl_mvm_rx_thermal_dual_chain_req(struct iwl_mvm *mvm,*/ mvm->fw_static_smps_request = req->event ==cpu_to_le32 (THERMAL_DUAL_CHAIN_REQ_DISABLE ); -ieee80211_iterate_interfaces (mvm->hw,IEEE80211_IFACE_ITER_NORMAL , +ieee80211_iterate_interfaces (mvm->hw, +IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER , iwl_mvm_intf_dual_chain_req,NULL ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 464/913 iwlwifi: mvm: align locking in D3 test debugfs
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 59e1221f470c2e5d2f2d4c95153edd577a7071c5 ]
Since commit a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver") we're not only holding the RTNL when going in and out of suspend, but also the wiphy->mtx. Add that to the D3 test debugfs in iwlwifi since it's required for various calls to mac80211.
--- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +4 -0
@@ -2499,7 +2499,9 @@ static int iwl_mvm_d3_test_open(struct inode *inode, struct file *file)/* start pseudo D3 */ rtnl_lock (); +wiphy_lock (mvm->hw->wiphy); err =__iwl_mvm_suspend (mvm->hw, mvm->hw->wiphy->wowlan_config, true); +wiphy_unlock (mvm->hw->wiphy);rtnl_unlock ();if (err >0 ) err = -EINVAL ;
@@ -2555,7 +2557,9 @@ static int iwl_mvm_d3_test_release(struct inode *inode, struct file *file)iwl_fw_dbg_read_d3_debug_data (&mvm->fwrt);rtnl_lock (); +wiphy_lock (mvm->hw->wiphy);__iwl_mvm_resume (mvm, true); +wiphy_unlock (mvm->hw->wiphy);rtnl_unlock ();iwl_mvm_resume_tcm (mvm);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 465/913 iwlwifi: yoyo: remove DBGI_SRAM address reset writing
In reply to Greg Kroah-HartmanFrom: Rotem Saado <[email protected]>
[ Upstream commit ce014c9861544bb4e789323d0d8956a5ad262e25 ]
Due to preg protection we cannot write to this register while FW is running (when FW in Halt it is ok). since we have some cases that we need to dump this region while FW is running remove this writing from DRV. FW will do this writing.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 2 -- drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 2 -- 2 files changed, 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +0 -2
@@ -1532,8 +1532,6 @@ iwl_dump_ini_dbgi_sram_iter(struct iwl_fw_runtime *fwrt,return -EBUSY ; range->range_data_size = reg->dev_addr.size; -iwl_write_prph_no_grab (fwrt->trans,DBGI_SRAM_TARGET_ACCESS_CFG , -DBGI_SRAM_TARGET_ACCESS_CFG_RESET_ADDRESS_MSK );for (i =0 ; i < (le32_to_cpu (reg->dev_addr.size) /4 ); i++) { prph_data = iwl_read_prph(fwrt->trans, (i % 2) ? DBGI_SRAM_TARGET_ACCESS_RDATA_MSB :
drivers/net/wireless/intel/iwlwifi/iwl-prph.h +0 -2
@@ -350,8 +350,6 @@#define WFPM_GP2 0xA030B4/* DBGI SRAM Register details */ -#define DBGI_SRAM_TARGET_ACCESS_CFG 0x00A2E14C -#define DBGI_SRAM_TARGET_ACCESS_CFG_RESET_ADDRESS_MSK 0x10000#define DBGI_SRAM_TARGET_ACCESS_RDATA_LSB 0x00A2E154#define DBGI_SRAM_TARGET_ACCESS_RDATA_MSB 0x00A2E158
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 466/913 iwlwifi: Fix -EIO error code that is never returned
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit c305c94bdc18e45b5ad1db54da4269f8cbfdff6b ]
Currently the error -EIO is being assinged to variable ret when the READY_BIT is not set but the function iwlagn_mac_start returns 0 rather than ret. Fix this by returning ret instead of 0.
Addresses-Coverity: ("Unused value")
--- drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c +1 -1
@@ -304,7 +304,7 @@ static int iwlagn_mac_start(struct ieee80211_hw *hw) priv->is_open =1 ;IWL_DEBUG_MAC80211 (priv,"leave\n" ); -return 0 ; +return ret; }static void iwlagn_mac_stop (struct ieee80211_hw *hw)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 467/913 iwlwifi: mvm: Fix an error code in iwl_mvm_up()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 583d18336abdfb1b355270289ff8f6a2608ba905 ]
Return -ENODEV instead of success on this error path.
--- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/fw.c +3 -1
@@ -1489,8 +1489,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm)while (!sband && i <NUM_NL80211_BANDS ) sband = mvm->hw->wiphy->bands[i++]; -if (WARN_ON_ONCE (!sband)) +if (WARN_ON_ONCE (!sband)) { + ret = -ENODEV ; goto error; + } chan = &sband->channels[0 ];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 468/913 mtd: rawnand: pl353: Set the nand chip node as the flash node
In reply to Greg Kroah-HartmanFrom: Amit Kumar Mahapatra <[email protected]>
[ Upstream commit a1fe2ace2c39dcdc7c053705459a73b7598b1e4f ]
In devicetree the flash information is embedded within nand chip node, so during nand chip initialization the nand chip node should be passed to nand_set_flash_node() api, instead of nand controller node.
--- drivers/mtd/nand/raw/pl35x-nand-controller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/pl35x-nand-controller.c +1 -1
@@ -1062,7 +1062,7 @@ static int pl35x_nand_chip_init(struct pl35x_nandc *nfc, chip->controller = &nfc->controller; mtd =nand_to_mtd (chip); mtd->dev.parent = nfc->dev; -nand_set_flash_node (chip, nfc->dev->of_node); +nand_set_flash_node (chip, np);if (!mtd->name) { mtd->name =devm_kasprintf (nfc->dev,GFP_KERNEL ,"%s" ,PL35X_NANDC_DRIVER_NAME );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 469/913 drm/msm/dp: populate connector of struct dp_panel
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit 5e602f5156910c7b19661699896cb6e3fb94fab9 ]
DP CTS test case 4.2.2.6 has valid edid with bad checksum on purpose and expect DP source return correct checksum. During drm edid read, correct edid checksum is calculated and stored at connector::real_edid_checksum.
The problem is struct dp_panel::connector never be assigned, instead the connector is stored in struct msm_dp::connector. When we run compliance testing test case 4.2.2.6 dp_panel_handle_sink_request() won't have a valid edid set in struct dp_panel::edid so we'll try to use the connectors real_edid_checksum and hit a NULL pointer dereference error because the connector pointer is never assigned.
Changes in V2:
-- populate panel connector at msm_dp_modeset_init() instead of at dp_panel_read_sink_caps()
Changes in V3:
-- remove unhelpful kernel crash trace commit text -- remove renaming dp_display parameter to dp
Changes in V4:
-- add more details to commit text
Changes in v10:
-- group into one series
Changes in v11:
-- drop drm/msm/dp: dp_link_parse_sink_count() return immediately if aux read
--- drivers/gpu/drm/msm/dp/dp_display.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/dp/dp_display.c +5 -0
@@ -1442,6 +1442,7 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, struct drm_encoder *encoder) {struct msm_drm_private *priv; +struct dp_display_private *dp_priv;int ret;if (WARN_ON (!encoder) ||WARN_ON (!dp_display) ||WARN_ON (!dev))
@@ -1450,6 +1451,8 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, priv = dev->dev_private; dp_display->drm_dev = dev; + dp_priv = container_of(dp_display, struct dp_display_private, dp_display); + ret =dp_display_request_irq (dp_display);if (ret) {DRM_ERROR ("request_irq failed, ret=%d\n" , ret);
@@ -1467,6 +1470,8 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,return ret; } + dp_priv->panel->connector = dp_display->connector; + priv->connectors[priv->num_connectors++] = dp_display->connector;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 470/913 drm/msm/dp: stop link training after link training 2 failed
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit 9051d629dbf7a998a40f7eac65a9512b01bc3bb8 ]
Each DP link training contains link training 1 followed by link training 2. There is maximum of 5 retries of DP link training before declared link training failed. It is required to stop link training at end of link training 2 if it is failed so that next link training 1 can start freshly. This patch fixes link compliance test case 4.3.1.13 (Source Device Link Training EQ Fallback Test).
Changes in v10:
-- group into one series
Changes in v11:
-- drop drm/msm/dp: dp_link_parse_sink_count() return immediately if aux read
--- drivers/gpu/drm/msm/dp/dp_ctrl.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/dp/dp_ctrl.c +3 -0
@@ -1744,6 +1744,9 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)/* end with failure */ break ;/* lane == 1 already */ } + +/* stop link training before start re training */ +dp_ctrl_clear_training_pattern (ctrl); } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 471/913 drm/msm/dp: always add fail-safe mode into connector mode list
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit d4aca422539c441a7f3fec749287b36de37d9b6b ]
Some of DP link compliant test expects to return fail-safe mode if prefer detailed timing mode can not be supported by mainlink's lane and rate after link training. Therefore add fail-safe mode into connector mode list as backup mode. This patch fixes test case 4.2.2.1.
Changes in v2:
-- add Fixes text string
--- drivers/gpu/drm/msm/dp/dp_panel.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/dp/dp_panel.c +5 -0
@@ -212,6 +212,11 @@ int dp_panel_read_sink_caps(struct dp_panel *dp_panel,if (drm_add_modes_noedid (connector,640 ,480 ))drm_set_preferred_mode (connector,640 ,480 );mutex_unlock (&connector->dev->mode_config.mutex); + }else { +/* always add fail-safe mode as backup mode */ +mutex_lock (&connector->dev->mode_config.mutex); +drm_add_modes_noedid (connector,640 ,480 ); +mutex_unlock (&connector->dev->mode_config.mutex); }if (panel->aux_cfg_update_done) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 472/913 drm/msm/dsi: Use "ref" fw clock instead of global name for VCO parent
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 3a3ee71bd8e14c5e852c71f317eebfda8f88dff0 ]
All DSI PHY/PLL drivers were referencing their VCO parent clock by a global name, most of which don't exist or have been renamed. These clock drivers seem to function fine without that except the 14nm driver for sdm6xx [1].
At the same time all DTs provide a "ref" clock as per the requirements of dsi-phy-common.yaml, but the clock is never used. This patchset puts that clock to use without relying on a global clock name, so that all dependencies are explicitly defined in DT (the firmware) in the end.
Note that this patch intentionally breaks older firmware (DT) that relies on the clock to be found globally instead. The only affected platform is msm8974 [2] for whose dsi_phy_28nm a .name="xo" fallback is left in place to accommodate a more graceful transition period. All other platforms had the "ref" clock added to their phy node since its inception, or in a followup patch some time after. These patches wrongly assumed that the "ref" clock was actively used and have hence been listed as "Fixes:" below.
Furthermore apq8064 was providing the wrong 19.2MHz cxo instead of 27MHz pxo clock, which has been addressed in [3].
It is expected that both [2] and [3] are applied to the tree well in advance of this patch such that any actual breakage is extremely unlikely, but might still occur if kernel upgrades are performed without the DT to match. After some time the fallback for msm8974 can be removed again as well.
[1]: https://lore.kernel.org/linux-arm-msm/[email protected]/
[2]: https://lore.kernel.org/linux-arm-msm/[email protected]/
[3]: https://lore.kernel.org/linux-arm-msm/[email protected]/
--- drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c | 4 +++- drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c | 4 +++- drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 4 +++- drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c | 4 +++- drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c +3 -1
@@ -562,7 +562,9 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm, struct clk_hw **provchar clk_name[32 ], parent[32 ], vco_name[32 ];char parent2[32 ], parent3[32 ], parent4[32 ];struct clk_init_data vco_init = { - .parent_names = (const char *[]){"xo" }, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="ref" , + }, .num_parents =1 , .name = vco_name, .flags =CLK_IGNORE_UNUSED ,
drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c +3 -1
@@ -804,7 +804,9 @@ static int pll_14nm_register(struct dsi_pll_14nm *pll_14nm, struct clk_hw **prov {char clk_name[32 ], parent[32 ], vco_name[32 ];struct clk_init_data vco_init = { - .parent_names = (const char *[]){"xo" }, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="ref" , + }, .num_parents =1 , .name = vco_name, .flags =CLK_IGNORE_UNUSED ,
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c +3 -1
@@ -521,7 +521,9 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **prov {char clk_name[32 ], parent1[32 ], parent2[32 ], vco_name[32 ];struct clk_init_data vco_init = { - .parent_names = (const char *[]){"xo" }, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="ref" , .name ="xo" , + }, .num_parents =1 , .name = vco_name, .flags =CLK_IGNORE_UNUSED ,
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c +3 -1
@@ -385,7 +385,9 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **prov {char *clk_name, *parent_name, *vco_name;struct clk_init_data vco_init = { - .parent_names = (const char *[]){"pxo" }, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="ref" , + }, .num_parents =1 , .flags =CLK_IGNORE_UNUSED , .ops = &clk_ops_dsi_pll_28nm_vco,
drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +3 -1
@@ -590,7 +590,9 @@ static int pll_7nm_register(struct dsi_pll_7nm *pll_7nm, struct clk_hw **providechar clk_name[32 ], parent[32 ], vco_name[32 ];char parent2[32 ], parent3[32 ], parent4[32 ];struct clk_init_data vco_init = { - .parent_names = (const char *[]){"bi_tcxo" }, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="ref" , + }, .num_parents =1 , .name = vco_name, .flags =CLK_IGNORE_UNUSED ,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 473/913 drm/msm/dsi/phy: fix 7nm v4.0 settings for C-PHY mode
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit bb07af2ed2a47dc6c4d0681f275bb27d4f845465 ]
The dsi_7nm_phy_enable() disagrees with downstream for glbl_str_swi_cal_sel_ctrl and glbl_hstx_str_ctrl_0 values. Update programmed settings to match downstream driver. To remove the possibility for such errors in future drop less_than_1500_mhz assignment and specify settings explicitly.
--- drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +14 -8
@@ -866,20 +866,26 @@ static int dsi_7nm_phy_enable(struct msm_dsi_phy *phy,/* Alter PHY configurations if data rate less than 1.5GHZ*/ less_than_1500_mhz = (clk_req->bitclk_rate <=1500000000 ); -/* For C-PHY, no low power settings for lower clk rate */ -if (phy->cphy_mode) - less_than_1500_mhz = false; -if (phy->cfg->quirks &DSI_PHY_7NM_QUIRK_V4_1 ) { vreg_ctrl_0 = less_than_1500_mhz ?0x53 :0x52 ; - glbl_rescode_top_ctrl = less_than_1500_mhz ?0x3d :0x00 ; - glbl_rescode_bot_ctrl = less_than_1500_mhz ?0x39 :0x3c ; +if (phy->cphy_mode) { + glbl_rescode_top_ctrl =0x00 ; + glbl_rescode_bot_ctrl =0x3c ; + }else { + glbl_rescode_top_ctrl = less_than_1500_mhz ?0x3d :0x00 ; + glbl_rescode_bot_ctrl = less_than_1500_mhz ?0x39 :0x3c ; + } glbl_str_swi_cal_sel_ctrl =0x00 ; glbl_hstx_str_ctrl_0 =0x88 ; }else { vreg_ctrl_0 = less_than_1500_mhz ?0x5B :0x59 ; - glbl_str_swi_cal_sel_ctrl = less_than_1500_mhz ?0x03 :0x00 ; - glbl_hstx_str_ctrl_0 = less_than_1500_mhz ?0x66 :0x88 ; +if (phy->cphy_mode) { + glbl_str_swi_cal_sel_ctrl =0x03 ; + glbl_hstx_str_ctrl_0 =0x66 ; + }else { + glbl_str_swi_cal_sel_ctrl = less_than_1500_mhz ?0x03 :0x00 ; + glbl_hstx_str_ctrl_0 = less_than_1500_mhz ?0x66 :0x88 ; + } glbl_rescode_top_ctrl =0x03 ; glbl_rescode_bot_ctrl =0x3c ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 474/913 drm/msm/dpu: add DSPP blocks teardown
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit d5c5e78f217172e87d8fb2c3418dd8b58b4adfcb ]
Add missing calls to dpu_hw_dspp_destroy() to free resources allocated for DSPP hardware blocks.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +8 -0
@@ -35,6 +35,14 @@ int dpu_rm_destroy(struct dpu_rm *rm) {int i; +for (i =0 ; i <ARRAY_SIZE (rm->dspp_blks); i++) { +struct dpu_hw_dspp *hw; + +if (rm->dspp_blks[i]) { + hw =to_dpu_hw_dspp (rm->dspp_blks[i]); +dpu_hw_dspp_destroy (hw); + } + }for (i =0 ; i <ARRAY_SIZE (rm->pingpong_blks); i++) {struct dpu_hw_pingpong *hw;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 475/913 drm/msm/dpu: fix dp audio condition
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 1e0505a5a7a2fea243f8e6d7e13fcde65f9e41bc ]
DP audio enablement code which is comparing intf_type, DRM_MODE_ENCODER_TMDS (= 2) with DRM_MODE_CONNECTOR_DisplayPort (= 10). Which would never succeed. Fix it to check for DRM_MODE_ENCODER_TMDS.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -1
@@ -1107,7 +1107,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) } -if (dpu_enc->disp_info.intf_type == DRM_MODE_CONNECTOR_DisplayPort && +if (dpu_enc->disp_info.intf_type ==DRM_MODE_ENCODER_TMDS && dpu_enc->cur_master->hw_mdptop && dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select) dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select(
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 476/913 dm crypt: fix get_key_size compiler warning if !CONFIG_KEYS
In reply to Greg Kroah-HartmanFrom: Aashish Sharma <[email protected]>
[ Upstream commit 6fc51504388c1a1a53db8faafe9fff78fccc7c87 ]
Explicitly convert unsigned int in the right of the conditional expression to int to match the left side operand and the return type, fixing the following compiler warning:
drivers/md/dm-crypt.c:2593:43: warning: signed and unsigned type in conditional expression [-Wsign-compare]
--- drivers/md/dm-crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-crypt.c +1 -1
@@ -2579,7 +2579,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_stringstatic int get_key_size (char **key_string) { -return (*key_string[0 ] ==':' ) ? -EINVAL :strlen (*key_string) >>1 ; +return (*key_string[0 ] ==':' ) ? -EINVAL : (int )(strlen (*key_string) >>1 ); }#endif /* CONFIG_KEYS */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 477/913 vfio/pci: fix memory leak during D3hot to D0 transition
In reply to Greg Kroah-HartmanFrom: Abhishek Sahu <[email protected]>
[ Upstream commit eadf88ecf6ac7d6a9f47a76c6055d9a1987a8991 ]
If 'vfio_pci_core_device::needs_pm_restore' is set (PCI device does not have No_Soft_Reset bit set in its PMCSR config register), then the current PCI state will be saved locally in 'vfio_pci_core_device::pm_save' during D0->D3hot transition and same will be restored back during D3hot->D0 transition.
For saving the PCI state locally, pci_store_saved_state() is being used and the pci_load_and_free_saved_state() will free the allocated memory.
But for reset related IOCTLs, vfio driver calls PCI reset-related API's which will internally change the PCI power state back to D0. So, when the guest resumes, then it will get the current state as D0 and it will skip the call to vfio_pci_set_power_state() for changing the power state to D0 explicitly. In this case, the memory pointed by 'pm_save' will never be freed. In a malicious sequence, the state changing to D3hot followed by VFIO_DEVICE_RESET/VFIO_DEVICE_PCI_HOT_RESET can be run in a loop and it can cause an OOM situation.
This patch frees the earlier allocated memory first before overwriting 'pm_save' to prevent the mentioned memory leak.
--- drivers/vfio/pci/vfio_pci_core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/vfio/pci/vfio_pci_core.c +13 -0
@@ -228,6 +228,19 @@ int vfio_pci_set_power_state(struct vfio_pci_core_device *vdev, pci_power_t statif (!ret) {/* D3 might be unsupported via quirk, skip unless in D3 */ if (needs_save && pdev->current_state >= PCI_D3hot) { +/* +* The current PCI state will be saved locally in +* 'pm_save' during the D3hot transition. When the +* device state is changed to D0 again with the current +* function, then pci_store_saved_state() will restore +* the state and will free the memory pointed by +* 'pm_save'. There are few cases where the PCI power +* state can be changed to D0 without the involvement +* of the driver. For these cases, free the earlier +* allocated memory first before overwriting 'pm_save' +* to prevent the memory leak. +*/ +kfree (vdev->pm_save); vdev->pm_save =pci_store_saved_state (pdev); }else if (needs_restore) {pci_load_and_free_saved_state (pdev, &vdev->pm_save);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 478/913 vfio/pci: wake-up devices around reset functions
In reply to Greg Kroah-HartmanFrom: Abhishek Sahu <[email protected]>
[ Upstream commit 26a17b12d7f3dd8a7aa45a290e5b46e9cc775ddf ]
If 'vfio_pci_core_device::needs_pm_restore' is set (PCI device does not have No_Soft_Reset bit set in its PMCSR config register), then the current PCI state will be saved locally in 'vfio_pci_core_device::pm_save' during D0->D3hot transition and same will be restored back during D3hot->D0 transition. For reset-related functionalities, vfio driver uses PCI reset API's. These API's internally change the PCI power state back to D0 first if the device power state is non-D0. This state change to D0 will happen without the involvement of vfio driver.
Let's consider the following example:
1. The device is in D3hot.
2. User invokes VFIO_DEVICE_RESET ioctl.
3. pci_try_reset_function() will be called which internally invokes pci_dev_save_and_disable().
4. pci_set_power_state(dev, PCI_D0) will be called first.
5. pci_save_state() will happen then.
Now, for the devices which has NoSoftRst-, the pci_set_power_state() can trigger soft reset and the original PCI config state will be lost at step (4) and this state cannot be restored again. This original PCI state can include any setting which is performed by SBIOS or host linux kernel (for example LTR, ASPM L1 substates, etc.). When this soft reset will be triggered, then all these settings will be reset, and the device state saved at step (5) will also have this setting cleared so it cannot be restored. Since the vfio driver only exposes limited PCI capabilities to its user, so the vfio driver user also won't have the option to save and restore these capabilities state either and these original settings will be permanently lost.
For pci_reset_bus() also, we can have the above situation. The other functions/devices can be in D3hot and the reset will change the power state of all devices to D0 without the involvement of vfio driver.
So, before calling any reset-related API's, we need to make sure that the device state is D0. This is mainly to preserve the state around soft reset.
For vfio_pci_core_disable(), we use __pci_reset_function_locked() which internally can use pci_pm_reset() for the function reset. pci_pm_reset() requires the device power state to be in D0, otherwise it returns error.
This patch changes the device power state to D0 by invoking vfio_pci_set_power_state() explicitly before calling any reset related API's.
--- drivers/vfio/pci/vfio_pci_core.c | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
drivers/vfio/pci/vfio_pci_core.c +48 -0
@@ -335,6 +335,17 @@ void vfio_pci_core_disable(struct vfio_pci_core_device *vdev)/* For needs_reset */ lockdep_assert_held (&vdev->vdev.dev_set->lock); +/* +* This function can be invoked while the power state is non-D0. +* This function calls __pci_reset_function_locked() which internally +* can use pci_pm_reset() for the function reset. pci_pm_reset() will +* fail if the power state is non-D0. Also, for the devices which +* have NoSoftRst-, the reset function can cause the PCI config space +* reset without restoring the original state (saved locally in +* 'vdev->pm_save'). +*/ +vfio_pci_set_power_state (vdev,PCI_D0 ); +/* Stop the device from further DMA */ pci_clear_master (pdev);
@@ -934,6 +945,19 @@ long vfio_pci_core_ioctl(struct vfio_device *core_vdev, unsigned int cmd,return -EINVAL ;vfio_pci_zap_and_down_write_memory_lock (vdev); + +/* +* This function can be invoked while the power state is non-D0. +* If pci_try_reset_function() has been called while the power +* state is non-D0, then pci_try_reset_function() will +* internally set the power state to D0 without vfio driver +* involvement. For the devices which have NoSoftRst-, the +* reset function can cause the PCI config space reset without +* restoring the original state (saved locally in +* 'vdev->pm_save'). +*/ +vfio_pci_set_power_state (vdev,PCI_D0 ); + ret =pci_try_reset_function (vdev->pdev);up_write (&vdev->memory_lock);
@@ -2077,6 +2101,18 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set, } cur_mem =NULL ; +/* +* The pci_reset_bus() will reset all the devices in the bus. +* The power state can be non-D0 for some of the devices in the bus. +* For these devices, the pci_reset_bus() will internally set +* the power state to D0 without vfio driver involvement. +* For the devices which have NoSoftRst-, the reset function can +* cause the PCI config space reset without restoring the original +* state (saved locally in 'vdev->pm_save'). +*/ +list_for_each_entry (cur, &dev_set->device_list, vdev.dev_set_list) +vfio_pci_set_power_state (cur,PCI_D0 ); + ret =pci_reset_bus (pdev); err_undo:
@@ -2130,6 +2166,18 @@ static bool vfio_pci_dev_set_try_reset(struct vfio_device_set *dev_set)if (!pdev)return false; +/* +* The pci_reset_bus() will reset all the devices in the bus. +* The power state can be non-D0 for some of the devices in the bus. +* For these devices, the pci_reset_bus() will internally set +* the power state to D0 without vfio driver involvement. +* For the devices which have NoSoftRst-, the reset function can +* cause the PCI config space reset without restoring the original +* state (saved locally in 'vdev->pm_save'). +*/ +list_for_each_entry (cur, &dev_set->device_list, vdev.dev_set_list) +vfio_pci_set_power_state (cur,PCI_D0 ); + ret =pci_reset_bus (pdev);if (ret)return false;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 479/913 scsi: fnic: Fix a tracing statement
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 3032ed77a28913203a4fe0ab8f05752331af79b3 ]
Report both the command flags and command state instead of only the command state.
--- drivers/scsi/fnic/fnic_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/fnic/fnic_scsi.c +1 -1
@@ -604,7 +604,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_FNIC_TRACE (fnic_queuecommand, sc->device->host->host_no, tag, sc, io_req, sg_count, cmd_trace, - (((u64 )CMD_FLAGS (sc) >>32 ) |CMD_STATE (sc))); + (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc)));/* if only we issued IO, will we have the io lock */ if (io_lock_acquired)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 480/913 scsi: pm8001: Fix command initialization in pm80XX_send_read_log()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 1a37b6738b58d86f6b144b3fc754ace0f2e0166d ]
Since the sata_cmd struct is zeroed out before its fields are initialized, there is no need for using "|=" to initialize the ncqtag_atap_dir_m field. Using a standard assignment removes the sparse warning:
warning: invalid assignment: |=
Also, since the ncqtag_atap_dir_m field has type __le32, use cpu_to_le32() to generate the assigned value.
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 +- drivers/scsi/pm8001/pm80xx_hwi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +1 -1
@@ -1860,7 +1860,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, sata_cmd.tag =cpu_to_le32 (ccb_tag); sata_cmd.device_id =cpu_to_le32 (pm8001_ha_dev->device_id); - sata_cmd.ncqtag_atap_dir_m |= ((0x1 <<7 ) | (0x5 <<9 )); + sata_cmd.ncqtag_atap_dir_m =cpu_to_le32 ((0x1 <<7 ) | (0x5 <<9 ));memcpy (&sata_cmd.sata_fis, &fis,sizeof (struct host_to_dev_fis )); res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd,
drivers/scsi/pm8001/pm80xx_hwi.c +1 -1
@@ -1881,7 +1881,7 @@ static void pm80xx_send_read_log(struct pm8001_hba_info *pm8001_ha, sata_cmd.tag =cpu_to_le32 (ccb_tag); sata_cmd.device_id =cpu_to_le32 (pm8001_ha_dev->device_id); - sata_cmd.ncqtag_atap_dir_m_dad |= ((0x1 <<7 ) | (0x5 <<9 )); + sata_cmd.ncqtag_atap_dir_m_dad =cpu_to_le32 (((0x1 <<7 ) | (0x5 <<9 )));memcpy (&sata_cmd.sata_fis, &fis,sizeof (struct host_to_dev_fis )); res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 481/913 scsi: pm8001: Fix command initialization in pm8001_chip_ssp_tm_req()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit cd2268a180117aa8ebb23e090ba204324b2d0e93 ]
The ds_ads_m field of struct ssp_ini_tm_start_req has the type __le32. Assigning a value to it should thus use cpu_to_le32(). This fixes the sparse warning:
warning: incorrect type in assignment (different base types)
expected restricted __le32 [addressable] [assigned] [usertype] ds_ads_m got int
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/pm8001/pm8001_hwi.c +1 -1
@@ -4633,7 +4633,7 @@ int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha,memcpy (sspTMCmd.lun, task->ssp_task.LUN,8 ); sspTMCmd.tag =cpu_to_le32 (ccb->ccb_tag);if (pm8001_ha->chip_id != chip_8001) - sspTMCmd.ds_ads_m =0x08 ; + sspTMCmd.ds_ads_m =cpu_to_le32 (0x08 ); circularQ = &pm8001_ha->inbnd_q_tbl[0 ]; ret =pm8001_mpi_build_cmd (pm8001_ha, circularQ, opc, &sspTMCmd,sizeof (sspTMCmd),0 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 482/913 scsi: pm8001: Fix payload initialization in pm80xx_set_thermal_config()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit bb225b12dbcc82d53d637d10b8d70b64494f8c16 ]
The fields of the set_ctrl_cfg_req structure have the __le32 type, so use cpu_to_le32() to assign them. This removes the sparse warnings:
warning: incorrect type in assignment (different base types)
expected restricted __le32
got unsigned int
--- drivers/scsi/pm8001/pm80xx_hwi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +5 -3
@@ -1202,9 +1202,11 @@ pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha)else page_code =THERMAL_PAGE_CODE_8H ; - payload.cfg_pg[0 ] = (THERMAL_LOG_ENABLE <<9 ) | - (THERMAL_ENABLE <<8 ) | page_code; - payload.cfg_pg[1 ] = (LTEMPHIL <<24 ) | (RTEMPHIL <<8 ); + payload.cfg_pg[0 ] = +cpu_to_le32 ((THERMAL_LOG_ENABLE <<9 ) | + (THERMAL_ENABLE <<8 ) | page_code); + payload.cfg_pg[1 ] = +cpu_to_le32 ((LTEMPHIL <<24 ) | (RTEMPHIL <<8 )); pm8001_dbg(pm8001_ha, DEV, "Setting up thermal config. cfg_pg 0 0x%x cfg_pg 1 0x%x\n",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 483/913 scsi: pm8001: Fix le32 values handling in pm80xx_set_sas_protocol_timer_config()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit ca374f5d92b8ae778f6a37dd3e7ed809bbf7a953 ]
All fields of the SASProtocolTimerConfig structure have the __le32 type. As such, use cpu_to_le32() to initialize them. This change suppresses many sparse warnings:
warning: incorrect type in assignment (different base types)
expected restricted __le32 [addressable] [usertype] pageCode got int
Note that the check to limit the value of the STP_IDLE_TMO field is removed as this field is initialized using the fixed (and small) value defined by the STP_IDLE_TIME macro.
The pm8001_dbg() calls printing the values of the SASProtocolTimerConfig structure fileds are changed to use le32_to_cpu() to present the values in human readable form.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 52 +++++++++++++++----------------- 1 file changed, 25 insertions(+), 27 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +25 -27
@@ -1246,43 +1246,41 @@ pm80xx_set_sas_protocol_timer_config(struct pm8001_hba_info *pm8001_ha) circularQ = &pm8001_ha->inbnd_q_tbl[0 ]; payload.tag =cpu_to_le32 (tag); - SASConfigPage.pageCode =SAS_PROTOCOL_TIMER_CONFIG_PAGE ; - SASConfigPage.MST_MSI =3 <<15 ; - SASConfigPage.STP_SSP_MCT_TMO = (STP_MCT_TMO <<16 ) |SSP_MCT_TMO ; - SASConfigPage.STP_FRM_TMO = (SAS_MAX_OPEN_TIME <<24 ) | - (SMP_MAX_CONN_TIMER <<16 ) |STP_FRM_TIMER ; - SASConfigPage.STP_IDLE_TMO =STP_IDLE_TIME ; - -if (SASConfigPage.STP_IDLE_TMO >0x3FFFFFF ) - SASConfigPage.STP_IDLE_TMO =0x3FFFFFF ; - - - SASConfigPage.OPNRJT_RTRY_INTVL = (SAS_MFD <<16 ) | -SAS_OPNRJT_RTRY_INTVL ; - SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = (SAS_DOPNRJT_RTRY_TMO <<16 ) - |SAS_COPNRJT_RTRY_TMO ; - SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = (SAS_DOPNRJT_RTRY_THR <<16 ) - |SAS_COPNRJT_RTRY_THR ; - SASConfigPage.MAX_AIP =SAS_MAX_AIP ; + SASConfigPage.pageCode =cpu_to_le32 (SAS_PROTOCOL_TIMER_CONFIG_PAGE ); + SASConfigPage.MST_MSI =cpu_to_le32 (3 <<15 ); + SASConfigPage.STP_SSP_MCT_TMO = +cpu_to_le32 ((STP_MCT_TMO <<16 ) |SSP_MCT_TMO ); + SASConfigPage.STP_FRM_TMO = +cpu_to_le32 ((SAS_MAX_OPEN_TIME <<24 ) | + (SMP_MAX_CONN_TIMER <<16 ) |STP_FRM_TIMER ); + SASConfigPage.STP_IDLE_TMO =cpu_to_le32 (STP_IDLE_TIME ); + + SASConfigPage.OPNRJT_RTRY_INTVL = +cpu_to_le32 ((SAS_MFD <<16 ) |SAS_OPNRJT_RTRY_INTVL ); + SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = +cpu_to_le32 ((SAS_DOPNRJT_RTRY_TMO <<16 ) |SAS_COPNRJT_RTRY_TMO ); + SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = +cpu_to_le32 ((SAS_DOPNRJT_RTRY_THR <<16 ) |SAS_COPNRJT_RTRY_THR ); + SASConfigPage.MAX_AIP =cpu_to_le32 (SAS_MAX_AIP );pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.pageCode 0x%08x\n" , - SASConfigPage.pageCode); +le32_to_cpu (SASConfigPage.pageCode));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.MST_MSI 0x%08x\n" , - SASConfigPage.MST_MSI); +le32_to_cpu (SASConfigPage.MST_MSI));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.STP_SSP_MCT_TMO 0x%08x\n" , - SASConfigPage.STP_SSP_MCT_TMO); +le32_to_cpu (SASConfigPage.STP_SSP_MCT_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.STP_FRM_TMO 0x%08x\n" , - SASConfigPage.STP_FRM_TMO); +le32_to_cpu (SASConfigPage.STP_FRM_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.STP_IDLE_TMO 0x%08x\n" , - SASConfigPage.STP_IDLE_TMO); +le32_to_cpu (SASConfigPage.STP_IDLE_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.OPNRJT_RTRY_INTVL 0x%08x\n" , - SASConfigPage.OPNRJT_RTRY_INTVL); +le32_to_cpu (SASConfigPage.OPNRJT_RTRY_INTVL));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO 0x%08x\n" , - SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO); +le32_to_cpu (SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR 0x%08x\n" , - SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR); +le32_to_cpu (SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.MAX_AIP 0x%08x\n" , - SASConfigPage.MAX_AIP); +le32_to_cpu (SASConfigPage.MAX_AIP));memcpy (&payload.cfg_pg, &SASConfigPage,sizeof (SASProtocolTimerConfig_t));
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 484/913 scsi: pm8001: Fix payload initialization in pm80xx_encrypt_update()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit f8b12dfb476dad38ce755aaf5e2df46f06f1822e ]
All fields of the kek_mgmt_req structure have the type __le32. So make sure to use cpu_to_le32() to initialize them. This suppresses the sparse warning:
warning: incorrect type in assignment (different base types)
expected restricted __le32 [addressable] [assigned] [usertype] new_curidx_ksop got int
--- drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +4 -3
@@ -1406,12 +1406,13 @@ static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha)/* Currently only one key is used. New KEK index is 1. * Current KEK index is 1. Store KEK to NVRAM is 1. */ - payload.new_curidx_ksop = ((1 <<24 ) | (1 <<16 ) | (1 <<8 ) | -KEK_MGMT_SUBOP_KEYCARDUPDATE ); + payload.new_curidx_ksop = +cpu_to_le32 (((1 <<24 ) | (1 <<16 ) | (1 <<8 ) | +KEK_MGMT_SUBOP_KEYCARDUPDATE ));pm8001_dbg (pm8001_ha,DEV ,"Saving Encryption info to flash. payload 0x%x\n" , - payload.new_curidx_ksop); +le32_to_cpu (payload.new_curidx_ksop)); rc =pm8001_mpi_build_cmd (pm8001_ha, circularQ, opc, &payload,sizeof (payload),0 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 485/913 scsi: pm8001: Fix le32 values handling in pm80xx_chip_ssp_io_req()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 970404cc5744b1033b6ee601be4ef0e2d1fbcf72 ]
Make sure that the __le32 fields of struct ssp_ini_io_start_req are manipulated after applying the correct endian conversion. That is, use cpu_to_le32() for assigning values and le32_to_cpu() for consulting a field value. In particular, make sure that the calculations for the 4G boundary check are done using CPU endianness and *not* little endian values. With these fixes, many sparse warnings are removed.
While at it, add blank lines after variable declarations and in some other places to make this code more readable.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 41 +++++++++++++++++++------------- 1 file changed, 25 insertions(+), 16 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +25 -16
@@ -4381,13 +4381,15 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,struct ssp_ini_io_start_req ssp_cmd;u32 tag = ccb->ccb_tag;int ret; -u64 phys_addr, start_addr, end_addr; +u64 phys_addr, end_addr;u32 end_addr_high, end_addr_low;struct inbound_queue_table *circularQ;u32 q_index, cpu_id;u32 opc =OPC_INB_SSPINIIOSTART ; +memset (&ssp_cmd,0 ,sizeof (ssp_cmd));memcpy (ssp_cmd.ssp_iu.lun, task->ssp_task.LUN,8 ); +/* data address domain added for spcv; set to 0 by host, * used internally by controller * 0 for SAS 1.1 and SAS 2.0 compatible TLR
@@ -4398,7 +4400,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.device_id =cpu_to_le32 (pm8001_dev->device_id); ssp_cmd.tag =cpu_to_le32 (tag);if (task->ssp_task.enable_first_burst) - ssp_cmd.ssp_iu.efb_prio_attr |=0x80 ; + ssp_cmd.ssp_iu.efb_prio_attr =0x80 ; ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_prio <<3 ); ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr &7 ); memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd,
@@ -4430,21 +4432,24 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); + ssp_cmd.enc_addr_low =cpu_to_le32 (lower_32_bits (dma_addr)); ssp_cmd.enc_addr_high =cpu_to_le32 (upper_32_bits (dma_addr)); ssp_cmd.enc_len =cpu_to_le32 (task->total_xfer_len); ssp_cmd.enc_esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + ssp_cmd.enc_len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); -if (end_addr_high != ssp_cmd.enc_addr_high) { + end_addr = dma_addr +le32_to_cpu (ssp_cmd.enc_len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr); + +if (end_addr_high !=le32_to_cpu (ssp_cmd.enc_addr_high)) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, ssp_cmd.enc_len, + dma_addr, +le32_to_cpu (ssp_cmd.enc_len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd);
@@ -4453,7 +4458,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,cpu_to_le32 (lower_32_bits (phys_addr)); ssp_cmd.enc_addr_high =cpu_to_le32 (upper_32_bits (phys_addr)); - ssp_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); + ssp_cmd.enc_esgl =cpu_to_le32 (1U <<31 ); } }else if (task->num_scatter ==0 ) { ssp_cmd.enc_addr_low =0 ;
@@ -4461,8 +4466,10 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.enc_len =cpu_to_le32 (task->total_xfer_len); ssp_cmd.enc_esgl =0 ; } +/* XTS mode. All other fields are 0 */ - ssp_cmd.key_cmode =0x6 <<4 ; + ssp_cmd.key_cmode =cpu_to_le32 (0x6 <<4 ); +/* set tweak values. Should be the start lba */ ssp_cmd.twk_val0 = cpu_to_le32((task->ssp_task.cmd->cmnd[2] << 24) | (task->ssp_task.cmd->cmnd[3] << 16) |
@@ -4484,20 +4491,22 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.esgl =cpu_to_le32 (1 <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); + ssp_cmd.addr_low =cpu_to_le32 (lower_32_bits (dma_addr)); ssp_cmd.addr_high =cpu_to_le32 (upper_32_bits (dma_addr)); ssp_cmd.len =cpu_to_le32 (task->total_xfer_len); ssp_cmd.esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + ssp_cmd.len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); -if (end_addr_high != ssp_cmd.addr_high) { + end_addr = dma_addr +le32_to_cpu (ssp_cmd.len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr); +if (end_addr_high !=le32_to_cpu (ssp_cmd.addr_high)) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, ssp_cmd.len, + dma_addr, +le32_to_cpu (ssp_cmd.len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 486/913 scsi: pm8001: Fix le32 values handling in pm80xx_chip_sata_req()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit fd6d0e376211d7ed759db96b0fbd9a1cee67d462 ]
Make sure that the __le32 fields of struct sata_cmd are manipulated after applying the correct endian conversion. That is, use cpu_to_le32() for assigning values and le32_to_cpu() for consulting a field value. In particular, make sure that the calculations for the 4G boundary check are done using CPU endianness and *not* little endian values. With these fixes, many sparse warnings are removed.
While at it, fix some code identation and add blank lines after variable declarations and in some other places to make this code more readable.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 82 ++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 37 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +45 -37
@@ -4540,7 +4540,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,u32 q_index, cpu_id;struct sata_start_req sata_cmd;u32 hdr_tag, ncg_tag =0 ; -u64 phys_addr, start_addr, end_addr; +u64 phys_addr, end_addr;u32 end_addr_high, end_addr_low;u32 ATAP =0x0 ;u32 dir;
@@ -4601,32 +4601,38 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,pm8001_chip_make_sg (task->scatter, ccb->n_elem, ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; - sata_cmd.enc_addr_low =lower_32_bits (phys_addr); - sata_cmd.enc_addr_high =upper_32_bits (phys_addr); + sata_cmd.enc_addr_low = +cpu_to_le32 (lower_32_bits (phys_addr)); + sata_cmd.enc_addr_high = +cpu_to_le32 (upper_32_bits (phys_addr)); sata_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); - sata_cmd.enc_addr_low =lower_32_bits (dma_addr); - sata_cmd.enc_addr_high =upper_32_bits (dma_addr); + + sata_cmd.enc_addr_low = +cpu_to_le32 (lower_32_bits (dma_addr)); + sata_cmd.enc_addr_high = +cpu_to_le32 (upper_32_bits (dma_addr)); sata_cmd.enc_len =cpu_to_le32 (task->total_xfer_len); sata_cmd.enc_esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + sata_cmd.enc_len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); -if (end_addr_high != sata_cmd.enc_addr_high) { + end_addr = dma_addr +le32_to_cpu (sata_cmd.enc_len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr); +if (end_addr_high !=le32_to_cpu (sata_cmd.enc_addr_high)) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, sata_cmd.enc_len, + dma_addr, +le32_to_cpu (sata_cmd.enc_len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; sata_cmd.enc_addr_low = -lower_32_bits (phys_addr); +cpu_to_le32 (lower_32_bits (phys_addr)); sata_cmd.enc_addr_high = -upper_32_bits (phys_addr); +cpu_to_le32 (upper_32_bits (phys_addr)); sata_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); }
@@ -4637,7 +4643,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, sata_cmd.enc_esgl =0 ; }/* XTS mode. All other fields are 0 */ - sata_cmd.key_index_mode =0x6 <<4 ; + sata_cmd.key_index_mode =cpu_to_le32 (0x6 <<4 ); +/* set tweak values. Should be the start lba */ sata_cmd.twk_val0 = cpu_to_le32((sata_cmd.sata_fis.lbal_exp << 24) |
@@ -4663,31 +4670,31 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, phys_addr = ccb->ccb_dma_handle; sata_cmd.addr_low =lower_32_bits (phys_addr); sata_cmd.addr_high =upper_32_bits (phys_addr); - sata_cmd.esgl =cpu_to_le32 (1 <<31 ); + sata_cmd.esgl =cpu_to_le32 (1U <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); + sata_cmd.addr_low =lower_32_bits (dma_addr); sata_cmd.addr_high =upper_32_bits (dma_addr); sata_cmd.len =cpu_to_le32 (task->total_xfer_len); sata_cmd.esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + sata_cmd.len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); + end_addr = dma_addr +le32_to_cpu (sata_cmd.len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr);if (end_addr_high != sata_cmd.addr_high) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%xend_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, sata_cmd.len, + dma_addr, +le32_to_cpu (sata_cmd.len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; - sata_cmd.addr_low = -lower_32_bits (phys_addr); - sata_cmd.addr_high = -upper_32_bits (phys_addr); - sata_cmd.esgl =cpu_to_le32 (1 <<31 ); + sata_cmd.addr_low =lower_32_bits (phys_addr); + sata_cmd.addr_high =upper_32_bits (phys_addr); + sata_cmd.esgl =cpu_to_le32 (1U <<31 ); } }else if (task->num_scatter ==0 ) { sata_cmd.addr_low =0 ;
@@ -4695,27 +4702,28 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, sata_cmd.len =cpu_to_le32 (task->total_xfer_len); sata_cmd.esgl =0 ; } +/* scsi cdb */ sata_cmd.atapi_scsi_cdb[0 ] =cpu_to_le32 (((task->ata_task.atapi_packet[0 ]) | - (task->ata_task.atapi_packet[1 ] <<8 ) | - (task->ata_task.atapi_packet[2 ] <<16 ) | - (task->ata_task.atapi_packet[3 ] <<24 ))); + (task->ata_task.atapi_packet[1 ] <<8 ) | + (task->ata_task.atapi_packet[2 ] <<16 ) | + (task->ata_task.atapi_packet[3 ] <<24 ))); sata_cmd.atapi_scsi_cdb[1 ] =cpu_to_le32 (((task->ata_task.atapi_packet[4 ]) | - (task->ata_task.atapi_packet[5 ] <<8 ) | - (task->ata_task.atapi_packet[6 ] <<16 ) | - (task->ata_task.atapi_packet[7 ] <<24 ))); + (task->ata_task.atapi_packet[5 ] <<8 ) | + (task->ata_task.atapi_packet[6 ] <<16 ) | + (task->ata_task.atapi_packet[7 ] <<24 ))); sata_cmd.atapi_scsi_cdb[2 ] =cpu_to_le32 (((task->ata_task.atapi_packet[8 ]) | - (task->ata_task.atapi_packet[9 ] <<8 ) | - (task->ata_task.atapi_packet[10 ] <<16 ) | - (task->ata_task.atapi_packet[11 ] <<24 ))); + (task->ata_task.atapi_packet[9 ] <<8 ) | + (task->ata_task.atapi_packet[10 ] <<16 ) | + (task->ata_task.atapi_packet[11 ] <<24 ))); sata_cmd.atapi_scsi_cdb[3 ] =cpu_to_le32 (((task->ata_task.atapi_packet[12 ]) | - (task->ata_task.atapi_packet[13 ] <<8 ) | - (task->ata_task.atapi_packet[14 ] <<16 ) | - (task->ata_task.atapi_packet[15 ] <<24 ))); + (task->ata_task.atapi_packet[13 ] <<8 ) | + (task->ata_task.atapi_packet[14 ] <<16 ) | + (task->ata_task.atapi_packet[15 ] <<24 ))); }/* Check for read log for failed drive and return */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 487/913 scsi: pm8001: Fix NCQ NON DATA command task initialization
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit aa028141ab0bc62c44a84d42f09db35d82df82a2 ]
In the pm8001_chip_sata_req() and pm80xx_chip_sata_req() functions, all tasks with a DMA direction of DMA_NONE (no data transfer) are initialized using the ATAP value 0x04. However, NCQ NON DATA commands, while being DMA_NONE commands are NCQ commands and need to be initialized using the value 0x07 for ATAP, similarly to other NCQ commands.
Make sure that NCQ NON DATA command tasks are initialized similarly to other NCQ commands by also testing the task "use_ncq" field in addition to the DMA direction. While at it, reorganize the code into a chain of if - else if - else to avoid useless affectations and debug messages.
--- drivers/scsi/pm8001/pm8001_hwi.c | 14 +++++++------- drivers/scsi/pm8001/pm80xx_hwi.c | 13 ++++++------- 2 files changed, 13 insertions(+), 14 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +7 -7
@@ -4278,22 +4278,22 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,u32 opc =OPC_INB_SATA_HOST_OPSTART ;memset (&sata_cmd,0 ,sizeof (sata_cmd)); circularQ = &pm8001_ha->inbnd_q_tbl[0 ]; -if (task->data_dir ==DMA_NONE ) { + +if (task->data_dir ==DMA_NONE && !task->ata_task.use_ncq) {ATAP =0x04 ;/* no data*/ pm8001_dbg (pm8001_ha,IO ,"no data\n" ); }else if (likely (!task->ata_task.device_control_reg_update)) { -if (task->ata_task.dma_xfer) { +if (task->ata_task.use_ncq && + dev->sata_dev.class !=ATA_DEV_ATAPI ) { +ATAP =0x07 ;/* FPDMA */ +pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); + }else if (task->ata_task.dma_xfer) {ATAP =0x06 ;/* DMA */ pm8001_dbg (pm8001_ha,IO ,"DMA\n" ); }else {ATAP =0x05 ;/* PIO*/ pm8001_dbg (pm8001_ha,IO ,"PIO\n" ); } -if (task->ata_task.use_ncq && - dev->sata_dev.class !=ATA_DEV_ATAPI ) { -ATAP =0x07 ;/* FPDMA */ -pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); - } }if (task->ata_task.use_ncq &&pm8001_get_ncq_tag (task, &hdr_tag)) { task->ata_task.fis.sector_count |= (u8) (hdr_tag <<3 );
drivers/scsi/pm8001/pm80xx_hwi.c +6 -7
@@ -4552,22 +4552,21 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, q_index = (u32) (cpu_id) % (pm8001_ha->max_q_num); circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; -if (task->data_dir ==DMA_NONE ) { +if (task->data_dir ==DMA_NONE && !task->ata_task.use_ncq) {ATAP =0x04 ;/* no data*/ pm8001_dbg (pm8001_ha,IO ,"no data\n" ); }else if (likely (!task->ata_task.device_control_reg_update)) { -if (task->ata_task.dma_xfer) { +if (task->ata_task.use_ncq && + dev->sata_dev.class !=ATA_DEV_ATAPI ) { +ATAP =0x07 ;/* FPDMA */ +pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); + }else if (task->ata_task.dma_xfer) {ATAP =0x06 ;/* DMA */ pm8001_dbg (pm8001_ha,IO ,"DMA\n" ); }else {ATAP =0x05 ;/* PIO*/ pm8001_dbg (pm8001_ha,IO ,"PIO\n" ); } -if (task->ata_task.use_ncq && - dev->sata_dev.class !=ATA_DEV_ATAPI ) { -ATAP =0x07 ;/* FPDMA */ -pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); - } }if (task->ata_task.use_ncq &&pm8001_get_ncq_tag (task, &hdr_tag)) { task->ata_task.fis.sector_count |= (u8) (hdr_tag <<3 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 488/913 scsi: pm8001: Fix NCQ NON DATA command completion handling
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 1d6736c3e162061dc811c76e605f35ef3234bffa ]
NCQ NON DATA is an NCQ command with the DMA_NONE DMA direction and so a register-device-to-host-FIS response is expected for it.
However, for an IO_SUCCESS case, mpi_sata_completion() expects a set-device-bits-FIS for any ata task with an use_ncq field true, which includes NCQ NON DATA commands.
Fix this to correctly treat NCQ NON DATA commands as non-data by also testing for the DMA_NONE DMA direction.
--- drivers/scsi/pm8001/pm8001_hwi.c | 3 ++- drivers/scsi/pm8001/pm80xx_hwi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +2 -1
@@ -2421,7 +2421,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) len =sizeof (struct pio_setup_fis );pm8001_dbg (pm8001_ha,IO ,"PIO read len = %d\n" , len); - }else if (t->ata_task.use_ncq) { + }else if (t->ata_task.use_ncq && + t->data_dir !=DMA_NONE ) { len =sizeof (struct set_dev_bits_fis );pm8001_dbg (pm8001_ha,IO ,"FPDMA len = %d\n" , len);
drivers/scsi/pm8001/pm80xx_hwi.c +2 -1
@@ -2518,7 +2518,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, len =sizeof (struct pio_setup_fis );pm8001_dbg (pm8001_ha,IO ,"PIO read len = %d\n" , len); - }else if (t->ata_task.use_ncq) { + }else if (t->ata_task.use_ncq && + t->data_dir !=DMA_NONE ) { len =sizeof (struct set_dev_bits_fis );pm8001_dbg (pm8001_ha,IO ,"FPDMA len = %d\n" , len);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 489/913 scsi: pm8001: Fix abort all task initialization
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 7f12845c8389855dbcc67baa068b6832dc4a396e ]
In pm80xx_send_abort_all(), the n_elem field of the ccb used is not initialized to 0. This missing initialization sometimes lead to the task completion path seeing the ccb with a non-zero n_elem resulting in the execution of invalid dma_unmap_sg() calls in pm8001_ccb_task_free(), causing a crash such as:
[ 197.676341] RIP: 0010:iommu_dma_unmap_sg+0x6d/0x280 [ 197.700204] RSP: 0018:ffff889bbcf89c88 EFLAGS: 00010012 [ 197.705485] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff83d0bda0 [ 197.712687] RDX: 0000000000000002 RSI: 0000000000000000 RDI: ffff88810dffc0d0 [ 197.719887] RBP: 0000000000000000 R08: 0000000000000000 R09: ffff8881c790098b [ 197.727089] R10: ffffed1038f20131 R11: 0000000000000001 R12: 0000000000000000 [ 197.734296] R13: ffff88810dffc0d0 R14: 0000000000000010 R15: 0000000000000000 [ 197.741493] FS: 0000000000000000(0000) GS:ffff889bbcf80000(0000) knlGS:0000000000000000 [ 197.749659] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 197.755459] CR2: 00007f16c1b42734 CR3: 0000000004814000 CR4: 0000000000350ee0 [ 197.762656] Call Trace: [ 197.765127] <IRQ> [ 197.767162] pm8001_ccb_task_free+0x5f1/0x820 [pm80xx] [ 197.772364] ? do_raw_spin_unlock+0x54/0x220 [ 197.776680] pm8001_mpi_task_abort_resp+0x2ce/0x4f0 [pm80xx] [ 197.782406] process_oq+0xe85/0x7890 [pm80xx] [ 197.786817] ? lock_acquire+0x194/0x490 [ 197.790697] ? handle_irq_event+0x10e/0x1b0 [ 197.794920] ? mpi_sata_completion+0x2d70/0x2d70 [pm80xx] [ 197.800378] ? __wake_up_bit+0x100/0x100 [ 197.804340] ? lock_is_held_type+0x98/0x110 [ 197.808565] pm80xx_chip_isr+0x94/0x130 [pm80xx] [ 197.813243] tasklet_action_common.constprop.0+0x24b/0x2f0 [ 197.818785] __do_softirq+0x1b5/0x82d [ 197.822485] ? do_raw_spin_unlock+0x54/0x220 [ 197.826799] __irq_exit_rcu+0x17e/0x1e0 [ 197.830678] irq_exit_rcu+0xa/0x20 [ 197.834114] common_interrupt+0x78/0x90 [ 197.840051] </IRQ> [ 197.844236] <TASK> [ 197.848397] asm_common_interrupt+0x1e/0x40
Avoid this issue by always initializing the ccb n_elem field to 0 in pm8001_send_abort_all(), pm8001_send_read_log() and pm80xx_send_abort_all().
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 ++ drivers/scsi/pm8001/pm80xx_hwi.c | 1 + 2 files changed, 3 insertions(+)
drivers/scsi/pm8001/pm8001_hwi.c +2 -0
@@ -1783,6 +1783,7 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem =0 ; circularQ = &pm8001_ha->inbnd_q_tbl[0 ];
@@ -1844,6 +1845,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem =0 ; pm8001_ha_dev->id |=NCQ_READ_LOG_FLAG ; pm8001_ha_dev->id |=NCQ_2ND_RLE_FLAG ;
drivers/scsi/pm8001/pm80xx_hwi.c +1 -0
@@ -1801,6 +1801,7 @@ static void pm80xx_send_abort_all(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem =0 ; circularQ = &pm8001_ha->inbnd_q_tbl[0 ];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 490/913 RDMA/mlx5: Fix the flow of a miss in the allocation of a cache ODP MR
In reply to Greg Kroah-HartmanFrom: Aharon Landau <[email protected]>
[ Upstream commit 2f0e60d5e9f96341a0c8a01be8878cdb3b29ff20 ]
When an ODP MR cache entry is empty and trying to allocate it, increment the ent->miss counter and call to queue_adjust_cache_locked() to verify the entry is balanced.
--- drivers/infiniband/hw/mlx5/mr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/mlx5/mr.c +2 -0
@@ -580,6 +580,8 @@ struct mlx5_ib_mr *mlx5_mr_cache_alloc(struct mlx5_ib_dev *dev, ent = &cache->ent[entry];spin_lock_irq (&ent->lock);if (list_empty (&ent->head)) { +queue_adjust_cache_locked (ent); + ent->miss++;spin_unlock_irq (&ent->lock); mr =create_cache_mr (ent);if (IS_ERR (mr))
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 491/913 drm/amd/display: Remove vupdate_int_entry definition
In reply to Greg Kroah-HartmanFrom: Maíra Canal <[email protected]>
[ Upstream commit 3679b8518cd213c25d555553ef212e233faf698c ]
Remove the vupdate_int_entry definition and utilization to avoid the following warning by Clang:
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:410:2:
warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
vupdate_no_lock_int_entry(0),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:404:2:
note: previous initialization is here
vupdate_int_entry(0),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:411:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(1),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:405:2:
note: previous initialization is here
vupdate_int_entry(1),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:412:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(2),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:406:2:
note: previous initialization is here
vupdate_int_entry(2),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:413:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(3),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:407:2:
note: previous initialization is here
vupdate_int_entry(3),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:414:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(4),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:408:2:
note: previous initialization is here
vupdate_int_entry(4),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:415:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(5),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:409:2:
note: previous initialization is here
vupdate_int_entry(5),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~6 warnings generated.
--- .../amd/display/dc/irq/dcn21/irq_service_dcn21.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c +0 -14
@@ -266,14 +266,6 @@ static const struct irq_source_info_funcs vline0_irq_info_funcs = { .funcs = &pflip_irq_info_funcs\ } -#define vupdate_int_entry (reg_num)\ - [DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\ - IRQ_REG_ENTRY(OTG, reg_num,\ - OTG_GLOBAL_SYNC_STATUS, VUPDATE_INT_EN,\ - OTG_GLOBAL_SYNC_STATUS, VUPDATE_EVENT_CLEAR),\ - .funcs = &vblank_irq_info_funcs\ - } -/* vupdate_no_lock_int_entry maps to DC_IRQ_SOURCE_VUPDATEx, to match semantic * of DCE's DC_IRQ_SOURCE_VUPDATEx. */
@@ -402,12 +394,6 @@ irq_source_info_dcn21[DAL_IRQ_SOURCES_NUMBER] = { dc_underflow_int_entry(6), [DC_IRQ_SOURCE_DMCU_SCP] = dummy_irq_entry(), [DC_IRQ_SOURCE_VBIOS_SW ] =dummy_irq_entry (), -vupdate_int_entry (0 ), -vupdate_int_entry (1 ), -vupdate_int_entry (2 ), -vupdate_int_entry (3 ), -vupdate_int_entry (4 ), -vupdate_int_entry (5 ),vupdate_no_lock_int_entry (0 ),vupdate_no_lock_int_entry (1 ), vupdate_no_lock_int_entry(2),
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 492/913 TOMOYO: fix __setup handlers return values
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 39844b7e3084baecef52d1498b5fa81afa2cefa9 ]
__setup() handlers should return 1 if the parameter is handled. Returning 0 causes the entire string to be added to init's environment strings (limited to 32 strings), unnecessarily polluting it.
Using the documented strings "TOMOYO_loader=string1" and "TOMOYO_trigger=string2" causes an Unknown parameter message:
Unknown kernel command line parameters
"BOOT_IMAGE=/boot/bzImage-517rc5 TOMOYO_loader=string1 \
TOMOYO_trigger=string2", will be passed to user space.
and these strings are added to init's environment string space:
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc5
TOMOYO_loader=string1
TOMOYO_trigger=string2With this change, these __setup handlers act as expected, and init's environment is not polluted with these strings.
--- security/tomoyo/load_policy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/tomoyo/load_policy.c +2 -2
@@ -24,7 +24,7 @@ static const char *tomoyo_loader;static int __init tomoyo_loader_setup (char *str) { tomoyo_loader = str; -return 0 ; +return 1 ; }__setup ("TOMOYO_loader=" , tomoyo_loader_setup);
@@ -64,7 +64,7 @@ static const char *tomoyo_trigger;static int __init tomoyo_trigger_setup (char *str) { tomoyo_trigger = str; -return 0 ; +return 1 ; }__setup ("TOMOYO_trigger=" , tomoyo_trigger_setup);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 493/913 power: supply: sbs-charger: Dont cancel work that is not initialized
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit de85193cff0d94d030a53656d8fcc41794807bef ]
This driver can use an interrupt or polling in order get the charger's status.
When using polling, a delayed work is used.
However, the remove() function unconditionally call cancel_delayed_work_sync(), even if the delayed work is not used and is not initialized.
In order to fix it, use devm_delayed_work_autocancel() and remove the now useless remove() function.
--- drivers/power/supply/sbs-charger.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/power/supply/sbs-charger.c +7 -11
@@ -18,6 +18,7 @@#include <linux/interrupt.h> #include <linux/regmap.h> #include <linux/bitops.h> +#include <linux/devm-helpers.h> #define SBS_CHARGER_REG_SPEC_INFO 0x11#define SBS_CHARGER_REG_STATUS 0x13
@@ -209,7 +210,12 @@ static int sbs_probe(struct i2c_client *client,if (ret)return dev_err_probe (&client->dev, ret,"Failed to request irq\n" ); }else { -INIT_DELAYED_WORK (&chip->work, sbs_delayed_work); + ret =devm_delayed_work_autocancel (&client->dev, &chip->work, + sbs_delayed_work); +if (ret) +return dev_err_probe (&client->dev, ret, +"Failed to init work for polling\n" ); +schedule_delayed_work (&chip->work,msecs_to_jiffies (SBS_CHARGER_POLL_TIME )); }
@@ -220,15 +226,6 @@ static int sbs_probe(struct i2c_client *client,return 0 ; } -static int sbs_remove (struct i2c_client *client) -{ -struct sbs_info *chip =i2c_get_clientdata (client); - -cancel_delayed_work_sync (&chip->work); - -return 0 ; -} -#ifdef CONFIG_OF static const struct of_device_id sbs_dt_ids[] = { { .compatible = "sbs,sbs-charger" },
@@ -245,7 +242,6 @@ MODULE_DEVICE_TABLE(i2c, sbs_id);static struct i2c_driver sbs_driver = { .probe = sbs_probe, - .remove = sbs_remove, .id_table = sbs_id, .driver = { .name ="sbs-charger" ,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 494/913 ext2: correct max file size computing
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
[ Upstream commit 50b3a818991074177a56c87124c7a7bdf5fa4f67 ]
We need to calculate the max file size accurately if the total blocks that can address by block tree exceed the upper_limit. But this check is not correct now, it only compute the total data blocks but missing metadata blocks are needed. So in the case of "data blocks < upper_limit && total blocks > upper_limit", we will get wrong result. Fortunately, this case could not happen in reality, but it's confused and better to correct the computing.
bits data blocks metadatablocks upper_limit
10 16843020 66051 2147483647
11 134480396 263171 1073741823
12 1074791436 1050627 536870911 (*) 13 8594130956 4198403 268435455 (*) 14 68736258060 16785411 134217727 (*)
15 549822930956 67125251 67108863 (*)
16 4398314962956 268468227 33554431 (*)
[*] Need to calculate in depth.
--- fs/ext2/super.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext2/super.c +5 -1
@@ -753,8 +753,12 @@ static loff_t ext2_max_size(int bits) res +=1LL << (bits-2 ); res +=1LL << (2 *(bits-2 )); res +=1LL << (3 *(bits-2 )); +/* Compute how many metadata blocks are needed */ + meta_blocks =1 ; + meta_blocks +=1 + ppb; + meta_blocks +=1 + ppb + ppb * ppb;/* Does block tree limit file size? */ -if (res < upper_limit) +if (res + meta_blocks <= upper_limit) goto check_lfs; res = upper_limit;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 495/913 drm/tegra: Fix reference leak in tegra_dsi_ganged_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 221e3638feb8bc42143833c9a704fa89b6c366bb ]
The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add put_device() call to fix this.
--- drivers/gpu/drm/tegra/dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/dsi.c +3 -1
@@ -1538,8 +1538,10 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi) dsi->slave =platform_get_drvdata (gangster);of_node_put (np); -if (!dsi->slave) +if (!dsi->slave) { +put_device (&gangster->dev);return -EPROBE_DEFER ; + } dsi->slave->master = dsi; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 496/913 power: supply: bq24190_charger: Fix bq24190_vbus_is_enabled() wrong false return
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit f7731754fdce33dad19be746f647d6ac47c5d695 ]
The datasheet says that the BQ24190_REG_POC_CHG_CONFIG bits can have a value of either 10(0x2) or 11(0x3) for OTG (5V boost regulator) mode.
Sofar bq24190_vbus_is_enabled() was only checking for 10 but some BIOS-es uses 11 when enabling the regulator at boot.
Make bq24190_vbus_is_enabled() also check for 11 so that it does not wrongly returns false when the bits are set to 11.
--- drivers/power/supply/bq24190_charger.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/power/supply/bq24190_charger.c +6 -1
@@ -39,6 +39,7 @@#define BQ24190_REG_POC_CHG_CONFIG_DISABLE 0x0#define BQ24190_REG_POC_CHG_CONFIG_CHARGE 0x1#define BQ24190_REG_POC_CHG_CONFIG_OTG 0x2 +#define BQ24190_REG_POC_CHG_CONFIG_OTG_ALT 0x3#define BQ24190_REG_POC_SYS_MIN_MASK (BIT(3) | BIT(2) | BIT(1))#define BQ24190_REG_POC_SYS_MIN_SHIFT 1#define BQ24190_REG_POC_SYS_MIN_MIN 3000
@@ -550,7 +551,11 @@ static int bq24190_vbus_is_enabled(struct regulator_dev *dev)pm_runtime_mark_last_busy (bdi->dev);pm_runtime_put_autosuspend (bdi->dev); -return ret ? ret : val ==BQ24190_REG_POC_CHG_CONFIG_OTG ; +if (ret) +return ret; + +return (val ==BQ24190_REG_POC_CHG_CONFIG_OTG || + val ==BQ24190_REG_POC_CHG_CONFIG_OTG_ALT ); }static const struct regulator_ops bq24190_vbus_ops = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 497/913 scsi: hisi_sas: Change permission of parameter prot_mask
In reply to Greg Kroah-HartmanFrom: Xiang Chen <[email protected]>
[ Upstream commit c4e070457a93705e56ed06b3910d9e5fe56d3be3 ]
Currently the permission of parameter prot_mask is 0x0, which means that the member does not appear in sysfs. Change it as other module parameters to 0444 for world-readable.
[mkp: s/v3/v2/]
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -1
@@ -527,7 +527,7 @@ MODULE_PARM_DESC(intr_conv, "interrupt converge enable (0-1)");/* permit overriding the host protection capabilities mask (EEDP/T10 PI) */ static int prot_mask; -module_param (prot_mask, int,0 ); +module_param (prot_mask, int,0444 );MODULE_PARM_DESC (prot_mask," host protection capabilities mask, def=0x0 " );static void debugfs_work_handler_v3_hw (struct work_struct *work);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 498/913 drm/bridge: cdns-dsi: Make sure to to create proper aliases for dt
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
[ Upstream commit ffb5c099aaa13ab7f73c29ea6ae26bce8d7575ae ]
Add MODULE_DEVICE_TABLE to the device tree table to create required aliases needed for module to be loaded with device tree based platform.
--- drivers/gpu/drm/bridge/cdns-dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/cdns-dsi.c +1 -0
@@ -1286,6 +1286,7 @@ static const struct of_device_id cdns_dsi_of_match[] = { { .compatible = "cdns,dsi" }, { }, }; +MODULE_DEVICE_TABLE (of, cdns_dsi_of_match);static struct platform_driver cdns_dsi_platform_driver = { .probe = cdns_dsi_drm_probe,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 499/913 bpf, arm64: Call build_prologue() first in first JIT pass
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit 68e4f238b0e9d3670a1612ad900a6e98b2b3f7dd ]
BPF line info needs ctx->offset to be the instruction offset in the whole JITed image instead of the body itself, so also call build_prologue() first in first JIT pass.
--- arch/arm64/net/bpf_jit_comp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/arm64/net/bpf_jit_comp.c +8 -5
@@ -1042,15 +1042,18 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) goto out_off; } -/* 1. Initial fake pass to compute ctx->idx. */ - -/* Fake pass to fill in ctx->offset. */ -if (build_body (&ctx, extra_pass)) { +/* +* 1. Initial fake pass to compute ctx->idx and ctx->offset. +* +* BPF line info needs ctx->offset[i] to be the offset of +* instruction[i] in jited image, so build prologue first. +*/ +if (build_prologue (&ctx, was_classic)) { prog = orig_prog; goto out_off; } -if (build_prologue (&ctx, was_classic)) { +if (build_body (&ctx, extra_pass)) { prog = orig_prog; goto out_off; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 500/913 bpf, arm64: Feed byte-offset into bpf line info
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit dda7596c109fc382876118627e29db7607cde35d ]
insn_to_jit_off passed to bpf_prog_fill_jited_linfo() is calculated in instruction granularity instead of bytes granularity, but BPF line info requires byte offset.
bpf_prog_fill_jited_linfo() will be the last user of ctx.offset before it is freed, so convert the offset into byte-offset before calling into bpf_prog_fill_jited_linfo() in order to fix the line info dump on arm64.
--- arch/arm64/net/bpf_jit_comp.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/net/bpf_jit_comp.c +5 -0
@@ -1126,6 +1126,11 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) prog->jited_len = prog_size;if (!prog->is_func || extra_pass) { +int i; + +/* offset[prog->len] is the size of program */ +for (i =0 ; i <= prog->len; i++) + ctx.offset[i] *=AARCH64_INSN_SIZE ;bpf_prog_fill_jited_linfo (prog, ctx.offset +1 ); out_off:kfree (ctx.offset);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 501/913 xsk: Fix race at socket teardown
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit 18b1ab7aa76bde181bdb1ab19a87fa9523c32f21 ]
Fix a race in the xsk socket teardown code that can lead to a NULL pointer dereference splat. The current xsk unbind code in xsk_unbind_dev() starts by setting xs->state to XSK_UNBOUND, sets xs->dev to NULL and then waits for any NAPI processing to terminate using synchronize_net(). After that, the release code starts to tear down the socket state and free allocated memory.
BUG: kernel NULL pointer dereference, address: 00000000000000c0 PGD 8000000932469067 P4D 8000000932469067 PUD 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 25 PID: 69132 Comm: grpcpp_sync_ser Tainted: G I 5.16.0+ #2 Hardware name: Dell Inc. PowerEdge R730/0599V5, BIOS 1.2.10 03/09/2015 RIP: 0010:__xsk_sendmsg+0x2c/0x690 [...] RSP: 0018:ffffa2348bd13d50 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000040 RCX: ffff8d5fc632d258 RDX: 0000000000400000 RSI: ffffa2348bd13e10 RDI: ffff8d5fc5489800 RBP: ffffa2348bd13db0 R08: 0000000000000000 R09: 00007ffffffff000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff8d5fc5489800 R13: ffff8d5fcb0f5140 R14: ffff8d5fcb0f5140 R15: 0000000000000000 FS: 00007f991cff9400(0000) GS:ffff8d6f1f700000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000000000c0 CR3: 0000000114888005 CR4: 00000000001706e0 Call Trace: <TASK> ? aa_sk_perm+0x43/0x1b0 xsk_sendmsg+0xf0/0x110 sock_sendmsg+0x65/0x70 __sys_sendto+0x113/0x190 ? debug_smp_processor_id+0x17/0x20 ? fpregs_assert_state_consistent+0x23/0x50 ? exit_to_user_mode_prepare+0xa5/0x1d0 __x64_sys_sendto+0x29/0x30 do_syscall_64+0x3b/0xc0 entry_SYSCALL_64_after_hwframe+0x44/0xae
There are two problems with the current code. First, setting xs->dev to NULL before waiting for all users to stop using the socket is not correct. The entry to the data plane functions xsk_poll(), xsk_sendmsg(), and xsk_recvmsg() are all guarded by a test that xs->state is in the state XSK_BOUND and if not, it returns right away. But one process might have passed this test but still have not gotten to the point in which it uses xs->dev in the code. In this interim, a second process executing xsk_unbind_dev() might have set xs->dev to NULL which will lead to a crash for the first process. The solution here is just to get rid of this NULL assignment since it is not used anymore. Before commit 42fddcc7c64b ("xsk: use state member for socket synchronization"), xs->dev was the gatekeeper to admit processes into the data plane functions, but it was replaced with the state variable xs->state in the aforementioned commit.
The second problem is that synchronize_net() does not wait for any process in xsk_poll(), xsk_sendmsg(), or xsk_recvmsg() to complete, which means that the state they rely on might be cleaned up prematurely. This can happen when the notifier gets called (at driver unload for example) as it uses xsk_unbind_dev(). Solve this by extending the RCU critical region from just the ndo_xsk_wakeup to the whole functions mentioned above, so that both the test of xs->state == XSK_BOUND and the last use of any member of xs is covered by the RCU critical section. This will guarantee that when synchronize_net() completes, there will be no processes left executing xsk_poll(), xsk_sendmsg(), or xsk_recvmsg() and state can be cleaned up safely. Note that we need to drop the RCU lock for the skb xmit path as it uses functions that might sleep. Due to this, we have to retest the xs->state after we grab the mutex that protects the skb xmit code from, among a number of things, an xsk_unbind_dev() being executed from the notifier at the same time.
--- net/xdp/xsk.c | 69 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 19 deletions(-)
net/xdp/xsk.c +50 -19
@@ -418,18 +418,8 @@ EXPORT_SYMBOL(xsk_tx_peek_release_desc_batch);static int xsk_wakeup (struct xdp_sock *xs,u8 flags) {struct net_device *dev = xs->dev; -int err; - -rcu_read_lock (); - err = dev->netdev_ops->ndo_xsk_wakeup (dev, xs->queue_id, flags); -rcu_read_unlock (); - -return err; -} -static int xsk_zc_xmit (struct xdp_sock *xs) -{ -return xsk_wakeup (xs,XDP_WAKEUP_TX ); +return dev->netdev_ops->ndo_xsk_wakeup (dev, xs->queue_id, flags); }static void xsk_destruct_skb (struct sk_buff *skb)
@@ -548,6 +538,12 @@ static int xsk_generic_xmit(struct sock *sk)mutex_lock (&xs->mutex); +/* Since we dropped the RCU read lock, the socket state might have changed. */ +if (unlikely (!xsk_is_bound (xs))) { + err = -ENXIO ; + goto out; + } +if (xs->queue_id >= xs->dev->real_num_tx_queues) goto out;
@@ -611,16 +607,26 @@ static int xsk_generic_xmit(struct sock *sk)return err; } -static int __xsk_sendmsg (struct sock *sk) +static int xsk_xmit (struct sock *sk) {struct xdp_sock *xs =xdp_sk (sk); +int ret;if (unlikely (!(xs->dev->flags &IFF_UP )))return -ENETDOWN ;if (unlikely (!xs->tx))return -ENOBUFS ; -return xs->zc ?xsk_zc_xmit (xs) :xsk_generic_xmit (sk); +if (xs->zc) +return xsk_wakeup (xs,XDP_WAKEUP_TX ); + +/* Drop the RCU lock since the SKB path might sleep. */ +rcu_read_unlock (); + ret =xsk_generic_xmit (sk); +/* Reaquire RCU lock before going into common code. */ +rcu_read_lock (); + +return ret; }static bool xsk_no_wakeup (struct sock *sk)
@@ -634,7 +640,7 @@ static bool xsk_no_wakeup(struct sock *sk)#endif } -static int xsk_sendmsg (struct socket *sock,struct msghdr *m,size_t total_len) +static int __xsk_sendmsg (struct socket *sock,struct msghdr *m,size_t total_len) {bool need_wait = !(m->msg_flags &MSG_DONTWAIT );struct sock *sk = sock->sk;
@@ -654,11 +660,22 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) pool = xs->pool;if (pool->cached_need_wakeup &XDP_WAKEUP_TX ) -return __xsk_sendmsg (sk); +return xsk_xmit (sk);return 0 ; } -static int xsk_recvmsg (struct socket *sock,struct msghdr *m,size_t len,int flags) +static int xsk_sendmsg (struct socket *sock,struct msghdr *m,size_t total_len) +{ +int ret; + +rcu_read_lock (); + ret =__xsk_sendmsg (sock, m, total_len); +rcu_read_unlock (); + +return ret; +} + +static int __xsk_recvmsg (struct socket *sock,struct msghdr *m,size_t len,int flags) {bool need_wait = !(flags &MSG_DONTWAIT );struct sock *sk = sock->sk;
@@ -684,6 +701,17 @@ static int xsk_recvmsg(struct socket *sock, struct msghdr *m, size_t len, int flreturn 0 ; } +static int xsk_recvmsg (struct socket *sock,struct msghdr *m,size_t len,int flags) +{ +int ret; + +rcu_read_lock (); + ret =__xsk_recvmsg (sock, m, len, flags); +rcu_read_unlock (); + +return ret; +} +static __poll_t xsk_poll (struct file *file,struct socket *sock,struct poll_table_struct *wait) {
@@ -694,8 +722,11 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock,sock_poll_wait (file, sock, wait); -if (unlikely (!xsk_is_bound (xs))) +rcu_read_lock (); +if (unlikely (!xsk_is_bound (xs))) { +rcu_read_unlock ();return mask; + } pool = xs->pool;
@@ -704,7 +735,7 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock,xsk_wakeup (xs, pool->cached_need_wakeup); else/* Poll needs to drive Tx also in copy mode */ -__xsk_sendmsg (sk ); +xsk_xmit (sk ); }if (xs->rx && !xskq_prod_is_empty (xs->rx))
@@ -712,6 +743,7 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock,if (xs->tx &&xsk_tx_writeable (xs)) mask |=EPOLLOUT |EPOLLWRNORM ; +rcu_read_unlock ();return mask; }
@@ -743,7 +775,6 @@ static void xsk_unbind_dev(struct xdp_sock *xs)/* Wait for driver to stop using the xdp socket. */ xp_del_xsk (xs->pool, xs); - xs->dev =NULL ;synchronize_net ();dev_put (dev); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 502/913 RDMA/irdma: Fix netdev notifications for vlans
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 6702bc14744847842a87fed21a795b6e8bab6965 ]
Currently, events on vlan netdevs are being ignored. Fix this by finding the real netdev and processing the notifications for vlan netdevs.
--- drivers/infiniband/hw/irdma/utils.c | 48 ++++++++++++++++++----------- 1 file changed, 30 insertions(+), 18 deletions(-)
drivers/infiniband/hw/irdma/utils.c +30 -18
@@ -150,31 +150,35 @@ int irdma_inetaddr_event(struct notifier_block *notifier, unsigned long event, void *ptr) {struct in_ifaddr *ifa = ptr; -struct net_device *netdev = ifa->ifa_dev->dev; +struct net_device *real_dev, *netdev = ifa->ifa_dev->dev;struct irdma_device *iwdev;struct ib_device *ibdev;u32 local_ipaddr; - ibdev =ib_device_get_by_netdev (netdev,RDMA_DRIVER_IRDMA ); + real_dev =rdma_vlan_dev_real_dev (netdev); +if (!real_dev) + real_dev = netdev; + + ibdev =ib_device_get_by_netdev (real_dev,RDMA_DRIVER_IRDMA );if (!ibdev)return NOTIFY_DONE ; iwdev =to_iwdev (ibdev); local_ipaddr =ntohl (ifa->ifa_address);ibdev_dbg (&iwdev->ibdev, -"DEV: netdev %p event %lu local_ip=%pI4 MAC=%pM\n" , netdev, - event, &local_ipaddr, netdev->dev_addr); +"DEV: netdev %p event %lu local_ip=%pI4 MAC=%pM\n" , real_dev, + event, &local_ipaddr, real_dev->dev_addr);switch (event) {case NETDEV_DOWN : -irdma_manage_arp_cache (iwdev->rf, netdev->dev_addr, +irdma_manage_arp_cache (iwdev->rf, real_dev->dev_addr, &local_ipaddr, true,IRDMA_ARP_DELETE ); -irdma_if_notify (iwdev, netdev, &local_ipaddr, true, false); +irdma_if_notify (iwdev, real_dev, &local_ipaddr, true, false);irdma_gid_change_event (&iwdev->ibdev);break ;case NETDEV_UP :case NETDEV_CHANGEADDR : -irdma_add_arp (iwdev->rf, &local_ipaddr, true, netdev->dev_addr); -irdma_if_notify (iwdev, netdev, &local_ipaddr, true, true); +irdma_add_arp (iwdev->rf, &local_ipaddr, true, real_dev->dev_addr); +irdma_if_notify (iwdev, real_dev, &local_ipaddr, true, true);irdma_gid_change_event (&iwdev->ibdev);break ;default :
@@ -196,32 +200,36 @@ int irdma_inet6addr_event(struct notifier_block *notifier, unsigned long event, void *ptr) {struct inet6_ifaddr *ifa = ptr; -struct net_device *netdev = ifa->idev->dev; +struct net_device *real_dev, *netdev = ifa->idev->dev;struct irdma_device *iwdev;struct ib_device *ibdev;u32 local_ipaddr6[4 ]; - ibdev =ib_device_get_by_netdev (netdev,RDMA_DRIVER_IRDMA ); + real_dev =rdma_vlan_dev_real_dev (netdev); +if (!real_dev) + real_dev = netdev; + + ibdev =ib_device_get_by_netdev (real_dev,RDMA_DRIVER_IRDMA );if (!ibdev)return NOTIFY_DONE ; iwdev =to_iwdev (ibdev);irdma_copy_ip_ntohl (local_ipaddr6, ifa->addr.in6_u.u6_addr32);ibdev_dbg (&iwdev->ibdev, -"DEV: netdev %p event %lu local_ip=%pI6 MAC=%pM\n" , netdev, - event, local_ipaddr6, netdev->dev_addr); +"DEV: netdev %p event %lu local_ip=%pI6 MAC=%pM\n" , real_dev, + event, local_ipaddr6, real_dev->dev_addr);switch (event) {case NETDEV_DOWN : -irdma_manage_arp_cache (iwdev->rf, netdev->dev_addr, +irdma_manage_arp_cache (iwdev->rf, real_dev->dev_addr, local_ipaddr6, false,IRDMA_ARP_DELETE ); -irdma_if_notify (iwdev, netdev, local_ipaddr6, false, false); +irdma_if_notify (iwdev, real_dev, local_ipaddr6, false, false);irdma_gid_change_event (&iwdev->ibdev);break ;case NETDEV_UP :case NETDEV_CHANGEADDR :irdma_add_arp (iwdev->rf, local_ipaddr6, false, - netdev->dev_addr); -irdma_if_notify (iwdev, netdev, local_ipaddr6, false, true); + real_dev->dev_addr); +irdma_if_notify (iwdev, real_dev, local_ipaddr6, false, true);irdma_gid_change_event (&iwdev->ibdev);break ;default :
@@ -243,14 +251,18 @@ int irdma_net_event(struct notifier_block *notifier, unsigned long event, void *ptr) {struct neighbour *neigh = ptr; +struct net_device *real_dev, *netdev = (struct net_device *)neigh->dev;struct irdma_device *iwdev;struct ib_device *ibdev;__be32 *p;u32 local_ipaddr[4 ] = {};bool ipv4 = true; - ibdev =ib_device_get_by_netdev ((struct net_device *)neigh->dev, -RDMA_DRIVER_IRDMA ); + real_dev =rdma_vlan_dev_real_dev (netdev); +if (!real_dev) + real_dev = netdev; + + ibdev =ib_device_get_by_netdev (real_dev,RDMA_DRIVER_IRDMA );if (!ibdev)return NOTIFY_DONE ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 503/913 RDMA/irdma: Fix Passthrough mode in VM
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit b200189626b5cefbaf8be9cadd7a28215e065bb9 ]
Using PCI_FUNC macro in a VM, when the device is in passthrough mode does not provide the real function instance. This means that currently, devices will not probe unless the instance in the VM matches the instance in the host.
Fix this by getting the pf_id from the LAN during the probe.
--- drivers/infiniband/hw/irdma/hw.c | 2 +- drivers/infiniband/hw/irdma/i40iw_if.c | 1 + drivers/infiniband/hw/irdma/main.c | 1 + drivers/infiniband/hw/irdma/main.h | 1 + 4 files changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/hw/irdma/hw.c +1 -1
@@ -1608,7 +1608,7 @@ static enum irdma_status_code irdma_initialize_dev(struct irdma_pci_f *rf) info.fpm_commit_buf = mem.va; info.bar0 = rf->hw.hw_addr; - info.hmc_fn_id =PCI_FUNC (rf->pcidev->devfn); + info.hmc_fn_id = rf->pf_id; info.hw = &rf->hw; status =irdma_sc_dev_init (rf->rdma_ver, &rf->sc_dev, &info);if (status)
drivers/infiniband/hw/irdma/i40iw_if.c +1 -0
@@ -77,6 +77,7 @@ static void i40iw_fill_device_info(struct irdma_device *iwdev, struct i40e_info rf->rdma_ver =IRDMA_GEN_1 ; rf->gen_ops.request_reset = i40iw_request_reset; rf->pcidev = cdev_info->pcidev; + rf->pf_id = cdev_info->fid; rf->hw.hw_addr = cdev_info->hw_addr; rf->cdev = cdev_info; rf->msix_count = cdev_info->msix_count;
drivers/infiniband/hw/irdma/main.c +1 -0
@@ -226,6 +226,7 @@ static void irdma_fill_device_info(struct irdma_device *iwdev, struct ice_pf *pf rf->hw.hw_addr = pf->hw.hw_addr; rf->pcidev = pf->pdev; rf->msix_count = pf->num_rdma_msix; + rf->pf_id = pf->hw.pf_id; rf->msix_entries = &pf->msix_entries[pf->rdma_base_vector]; rf->default_vsi.vsi_idx = vsi->vsi_num; rf->protocol_used =IRDMA_ROCE_PROTOCOL_ONLY ;
drivers/infiniband/hw/irdma/main.h +1 -0
@@ -257,6 +257,7 @@ struct irdma_pci_f {u8 *mem_rsrc;u8 rdma_ver;u8 rst_to; +u8 pf_id;enum irdma_protocol_used protocol_used;u32 sd_type;u32 msix_count;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 504/913 RDMA/irdma: Remove incorrect masking of PD
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 17850f2b0b4b806e47cc44df94186bfc2cdd490b ]
The PD id is masked with 0x7fff, while PD can be 18 bits for GEN2 HW. Remove the masking as it should not be needed and can cause incorrect PD id to be used.
--- drivers/infiniband/hw/irdma/verbs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +2 -2
@@ -2506,7 +2506,7 @@ static int irdma_dealloc_mw(struct ib_mw *ibmw) cqp_info = &cqp_request->info; info = &cqp_info->in.u.dealloc_stag.info;memset (info,0 ,sizeof (*info)); - info->pd_id = iwpd->sc_pd.pd_id &0x00007fff ; + info->pd_id = iwpd->sc_pd.pd_id; info->stag_idx = ibmw->rkey >>IRDMA_CQPSQ_STAG_IDX_S ; info->mr = false; cqp_info->cqp_cmd =IRDMA_OP_DEALLOC_STAG ;
@@ -3018,7 +3018,7 @@ static int irdma_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata) cqp_info = &cqp_request->info; info = &cqp_info->in.u.dealloc_stag.info;memset (info,0 ,sizeof (*info)); - info->pd_id = iwpd->sc_pd.pd_id &0x00007fff ; + info->pd_id = iwpd->sc_pd.pd_id; info->stag_idx = ib_mr->rkey >>IRDMA_CQPSQ_STAG_IDX_S ; info->mr = true;if (iwpbl->pbl_allocated)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 505/913 gpu: host1x: Fix a memory leak in host1x_remove()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 025c6643a81564f066d8381b9e2f4603e0f8438f ]
Add a missing 'host1x_channel_list_free()' call in the remove function, as already done in the error handling path of the probe function.
--- drivers/gpu/host1x/dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/host1x/dev.c +1 -0
@@ -526,6 +526,7 @@ static int host1x_remove(struct platform_device *pdev)host1x_syncpt_deinit (host);reset_control_assert (host->rst);clk_disable_unprepare (host->clk); +host1x_channel_list_free (&host->channel_list);host1x_iommu_exit (host);return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 506/913 libbpf: Skip forward declaration when counting duplicated type names
In reply to Greg Kroah-HartmanFrom: Xu Kuohai <[email protected]>
[ Upstream commit 4226961b0019b2e1612029e8950a9e911affc995 ]
Currently if a declaration appears in the BTF before the definition, the definition is dumped as a conflicting name, e.g.:
$ bpftool btf dump file vmlinux format raw | grep "'unix_sock'"
[81287] FWD 'unix_sock' fwd_kind=struct
[89336] STRUCT 'unix_sock' size=1024 vlen=14 $ bpftool btf dump file vmlinux format c | grep "struct unix_sock"
struct unix_sock;
struct unix_sock___2 { <--- conflict, the "___2" is unexpected
struct unix_sock___2 *unix_sk;This causes a compilation error if the dump output is used as a header file.
Fix it by skipping declaration when counting duplicated type names.
--- tools/lib/bpf/btf_dump.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/lib/bpf/btf_dump.c +5 -0
@@ -1481,6 +1481,11 @@ static const char *btf_dump_resolve_name(struct btf_dump *d, __u32 id,if (s->name_resolved)return *cached_name ? *cached_name : orig_name; +if (btf_is_fwd (t) || (btf_is_enum (t) &&btf_vlen (t) ==0 )) { + s->name_resolved =1 ; +return orig_name; + } + dup_cnt =btf_dump_name_dups (d, name_map, orig_name);if (dup_cnt >1 ) {const size_t max_len =256 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 507/913 powerpc/mm/numa: skip NUMA_NO_NODE onlining in parse_numa_properties()
In reply to Greg Kroah-HartmanFrom: Daniel Henrique Barboza <[email protected]>
[ Upstream commit 749ed4a20657bcea66a6e082ca3dc0d228cbec80 ]
Executing node_set_online() when nid = NUMA_NO_NODE results in an undefined behavior. node_set_online() will call node_set_state(), into __node_set(), into set_bit(), and since NUMA_NO_NODE is -1 we'll end up doing a negative shift operation inside arch/powerpc/include/asm/bitops.h. This potential UB was detected running a kernel with CONFIG_UBSAN.
The behavior was introduced by commit 10f78fd0dabb ("powerpc/numa: Fix a regression on memoryless node 0"), where the check for nid > 0 was removed to fix a problem that was happening with nid = 0, but the result is that now we're trying to online NUMA_NO_NODE nids as well.
Checking for nid >= 0 will allow node 0 to be onlined while avoiding this UB with NUMA_NO_NODE.
--- arch/powerpc/mm/numa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/mm/numa.c +3 -1
@@ -956,7 +956,9 @@ static int __init parse_numa_properties(void)of_node_put (cpu); } -node_set_online (nid); +/* node_set_online() is an UB if 'nid' is negative */ +if (likely (nid >=0 )) +node_set_online (nid); }get_n_mem_cells (&n_mem_addr_cells, &n_mem_size_cells);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 508/913 powerpc/Makefile: Dont pass -mcpu=powerpc64 when building 32-bit
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 2863dd2db23e0407f6c50b8ba5c0e55abef894f1 ]
When CONFIG_GENERIC_CPU=y (true for all our defconfigs) we pass -mcpu=powerpc64 to the compiler, even when we're building a 32-bit kernel.
This happens because we have an ifdef CONFIG_PPC_BOOK3S_64/else block in the Makefile that was written before 32-bit supported GENERIC_CPU. Prior to that the else block only applied to 64-bit Book3E.
The GCC man page says -mcpu=powerpc64 "[specifies] a pure ... 64-bit big endian PowerPC ... architecture machine [type], with an appropriate, generic processor model assumed for scheduling purposes."
It's unclear how that interacts with -m32, which we are also passing, although obviously -m32 is taking precedence in some sense, as the 32-bit kernel only contains 32-bit instructions.
This was noticed by inspection, not via any bug reports, but it does affect code generation. Comparing before/after code generation, there are some changes to instruction scheduling, and the after case (with -mcpu=powerpc64 removed) the compiler seems more keen to use r8.
Fix it by making the else case only apply to Book3E 64, which excludes 32-bit.
--- arch/powerpc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Makefile +1 -1
@@ -173,7 +173,7 @@ else CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) endif -else +else ifdef CONFIG_PPC_BOOK3E_64 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 509/913 KVM: x86: Fix emulation in writing cr8
In reply to Greg Kroah-HartmanFrom: Zhenzhong Duan <[email protected]>
[ Upstream commit f66af9f222f08d5b11ea41c1bd6c07a0f12daa07 ]
In emulation of writing to cr8, one of the lowest four bits in TPR[3:0] is kept.
According to Intel SDM 10.8.6.1(baremetal scenario):
"APIC.TPR[bits 7:4] = CR8[bits 3:0], APIC.TPR[bits 3:0] = 0";
and SDM 28.3(use TPR shadow):
"MOV to CR8. The instruction stores bits 3:0 of its source operand into bits 7:4 of VTPR; the remainder of VTPR (bits 3:0 and bits 31:8) are cleared.";
and AMD's APM 16.6.4:
"Task Priority Sub-class (TPS)-Bits 3 : 0. The TPS field indicates the current sub-priority to be used when arbitrating lowest-priority messages. This field is written with zero when TPR is written using the architectural CR8 register.";
so in KVM emulated scenario, clear TPR[3:0] to make a consistent behavior as in other scenarios.
This doesn't impact evaluation and delivery of pending virtual interrupts because processor does not use the processor-priority sub-class to determine which interrupts to delivery and which to inhibit.
Sub-class is used by hardware to arbitrate lowest priority interrupts, but KVM just does a round-robin style delivery.
Message-Id: <[email protected]>
--- arch/x86/kvm/lapic.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kvm/lapic.c +1 -4
@@ -2242,10 +2242,7 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data)void kvm_lapic_set_tpr (struct kvm_vcpu *vcpu,unsigned long cr8) { -struct kvm_lapic *apic = vcpu->arch.apic; - -apic_set_tpr (apic, ((cr8 &0x0f ) <<4 ) - | (kvm_lapic_get_reg (apic,APIC_TASKPRI ) &4 )); +apic_set_tpr (vcpu->arch.apic, (cr8 &0x0f ) <<4 ); }u64 kvm_lapic_get_cr8 (struct kvm_vcpu *vcpu)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 510/913 KVM: x86/emulator: Defer not-present segment check in __load_segment_descriptor()
In reply to Greg Kroah-HartmanFrom: Hou Wenlong <[email protected]>
[ Upstream commit ca85f002258fdac3762c57d12d5e6e401b6a41af ]
Per Intel's SDM on the "Instruction Set Reference", when loading segment descriptor, not-present segment check should be after all type and privilege checks. But the emulator checks it first, then #NP is triggered instead of #GP if privilege fails and segment is not present. Put not-present segment check after type and privilege checks in __load_segment_descriptor().
Message-Id: <52573c01d369f506cadcf7233812427cf7db81a7.1644292363.git.houwenlong.hwl@antgroup.com>
--- arch/x86/kvm/emulate.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/x86/kvm/emulate.c +9 -5
@@ -1614,11 +1614,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, goto exception; } -if (!seg_desc.p) { - err_vec = (seg ==VCPU_SREG_SS ) ?SS_VECTOR :NP_VECTOR ; - goto exception; - } - dpl = seg_desc.dpl;switch (seg) {
@@ -1658,6 +1653,10 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,case VCPU_SREG_TR :if (seg_desc.s || (seg_desc.type !=1 && seg_desc.type !=9 )) goto exception; +if (!seg_desc.p) { + err_vec =NP_VECTOR ; + goto exception; + } old_desc = seg_desc; seg_desc.type |=2 ;/* busy */ ret = ctxt->ops->cmpxchg_emulated(ctxt, desc_addr, &old_desc, &seg_desc,
@@ -1682,6 +1681,11 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,break ; } +if (!seg_desc.p) { + err_vec = (seg ==VCPU_SREG_SS ) ?SS_VECTOR :NP_VECTOR ; + goto exception; + } +if (seg_desc.s) {/* mark segment as accessed */ if (!(seg_desc.type &1 )) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 511/913 hv_balloon: rate-limit "Unhandled message" warning
In reply to Greg Kroah-HartmanFrom: Anssi Hannula <[email protected]>
[ Upstream commit 1d7286729aa616772be334eb908e11f527e1e291 ]
For a couple of times I have encountered a situation where
hv_balloon: Unhandled message: type: 12447
is being flooded over 1 million times per second with various values, filling the log and consuming cycles, making debugging difficult.
Add rate limiting to the message.
Most other Hyper-V drivers already have similar rate limiting in their message callbacks.
The cause of the floods in my case was probably fixed by 96d9d1fa5cd5 ("Drivers: hv: balloon: account for vmbus packet header in max_pkt_size").
--- drivers/hv/hv_balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hv/hv_balloon.c +1 -1
@@ -1563,7 +1563,7 @@ static void balloon_onchannelcallback(void *context)break ;default : -pr_warn ("Unhandled message: type: %d\n" , dm_hdr->type); +pr_warn_ratelimited ("Unhandled message: type: %d\n" , dm_hdr->type); } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 512/913 i2c: xiic: Make bus names unique
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 1d366c2f9df8279df2adbb60471f86fc40a1c39e ]
This driver is for an FPGA logic core, so there can be arbitrarily many instances of the bus on a given system. Previously all of the I2C bus names were "xiic-i2c" which caused issues with lm_sensors when trying to map human-readable names to sensor inputs because it could not properly distinguish the busses, for example. Append the platform device name to the I2C bus name so it is unique between different instances.
--- drivers/i2c/busses/i2c-xiic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-xiic.c +2 -1
@@ -756,7 +756,6 @@ static const struct i2c_adapter_quirks xiic_quirks = {static const struct i2c_adapter xiic_adapter = { .owner =THIS_MODULE , - .name =DRIVER_NAME , .class =I2C_CLASS_DEPRECATED , .algo = &xiic_algorithm, .quirks = &xiic_quirks,
@@ -793,6 +792,8 @@ static int xiic_i2c_probe(struct platform_device *pdev)i2c_set_adapdata (&i2c->adap, i2c); i2c->adap.dev.parent = &pdev->dev; i2c->adap.dev.of_node = pdev->dev.of_node; +snprintf (i2c->adap.name,sizeof (i2c->adap.name), +DRIVER_NAME " %s" , pdev->name);mutex_init (&i2c->lock);init_waitqueue_head (&i2c->wait);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 513/913 power: supply: wm8350-power: Handle error for wm8350_register_irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit b0b14b5ba11bec56fad344a4a0b2e16449cc8b94 ]
As the potential failure of the wm8350_register_irq(), it should be better to check it and return error if fails. Also, use 'free_' in order to avoid same code.
--- drivers/power/supply/wm8350_power.c | 96 ++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 14 deletions(-)
drivers/power/supply/wm8350_power.c +82 -14
@@ -408,44 +408,112 @@ static const struct power_supply_desc wm8350_usb_desc = {* Initialisation *********************************************************************/ -static void wm8350_init_charger (struct wm8350 *wm8350) +static int wm8350_init_charger (struct wm8350 *wm8350) { +int ret; +/* register our interest in charger events */ -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_HOT , + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_HOT , wm8350_charger_handler,0 ,"Battery hot" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_COLD , +if (ret) + goto err; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_COLD , wm8350_charger_handler,0 ,"Battery cold" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_FAIL , +if (ret) + goto free_chg_bat_hot; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_FAIL , wm8350_charger_handler,0 ,"Battery fail" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_TO , +if (ret) + goto free_chg_bat_cold; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_TO , wm8350_charger_handler,0 ,"Charger timeout" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_END , +if (ret) + goto free_chg_bat_fail; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_END , wm8350_charger_handler,0 ,"Charge end" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_START , +if (ret) + goto free_chg_to; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_START , wm8350_charger_handler,0 ,"Charge start" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , +if (ret) + goto free_chg_end; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , wm8350_charger_handler,0 ,"Fast charge ready" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , +if (ret) + goto free_chg_start; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , wm8350_charger_handler,0 ,"Battery <3.9V" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , +if (ret) + goto free_chg_fast_rdy; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , wm8350_charger_handler,0 ,"Battery <3.1V" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , +if (ret) + goto free_chg_vbatt_lt_3p9; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , wm8350_charger_handler,0 ,"Battery <2.85V" , wm8350); +if (ret) + goto free_chg_vbatt_lt_3p1;/* and supply change events */ -wm8350_register_irq (wm8350,WM8350_IRQ_EXT_USB_FB , + ret =wm8350_register_irq (wm8350,WM8350_IRQ_EXT_USB_FB , wm8350_charger_handler,0 ,"USB" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_EXT_WALL_FB , +if (ret) + goto free_chg_vbatt_lt_2p85; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_EXT_WALL_FB , wm8350_charger_handler,0 ,"Wall" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_EXT_BAT_FB , +if (ret) + goto free_ext_usb_fb; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_EXT_BAT_FB , wm8350_charger_handler,0 ,"Battery" , wm8350); +if (ret) + goto free_ext_wall_fb; + +return 0 ; + +free_ext_wall_fb: +wm8350_free_irq (wm8350,WM8350_IRQ_EXT_WALL_FB , wm8350); +free_ext_usb_fb: +wm8350_free_irq (wm8350,WM8350_IRQ_EXT_USB_FB , wm8350); +free_chg_vbatt_lt_2p85: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , wm8350); +free_chg_vbatt_lt_3p1: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , wm8350); +free_chg_vbatt_lt_3p9: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , wm8350); +free_chg_fast_rdy: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , wm8350); +free_chg_start: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_START , wm8350); +free_chg_end: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_END , wm8350); +free_chg_to: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_TO , wm8350); +free_chg_bat_fail: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_BAT_FAIL , wm8350); +free_chg_bat_cold: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_BAT_COLD , wm8350); +free_chg_bat_hot: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_BAT_HOT , wm8350); +err: +return ret; }static void free_charger_irq (struct wm8350 *wm8350)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 514/913 power: supply: wm8350-power: Add missing free in free_charger_irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 6dee930f6f6776d1e5a7edf542c6863b47d9f078 ]
In free_charger_irq(), there is no free for 'WM8350_IRQ_CHG_FAST_RDY'. Therefore, it should be better to add it in order to avoid the memory leak.
--- drivers/power/supply/wm8350_power.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/wm8350_power.c +1 -0
@@ -524,6 +524,7 @@ static void free_charger_irq(struct wm8350 *wm8350)wm8350_free_irq (wm8350,WM8350_IRQ_CHG_TO , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_END , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_START , wm8350); +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , wm8350);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 515/913 IB/hfi1: Allow larger MTU without AIP
In reply to Greg Kroah-HartmanFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit b135e324d7a2e7fa0a7ef925076136e799b79f44 ]
The AIP code signals the phys_mtu in the following query_port() fragment:
props->phys_mtu = HFI1_CAP_IS_KSET(AIP) ? hfi1_max_mtu : ib_mtu_enum_to_int(props->max_mtu);
Using the largest MTU possible should not depend on AIP.
Fix by unconditionally using the hfi1_max_mtu value.
--- drivers/infiniband/hw/hfi1/verbs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/hfi1/verbs.c +1 -2
@@ -1397,8 +1397,7 @@ static int query_port(struct rvt_dev_info *rdi, u32 port_num, 4096 : hfi1_max_mtu), IB_MTU_4096); props->active_mtu = !valid_ib_mtu (ppd->ibmtu) ? props->max_mtu :mtu_to_enum (ppd->ibmtu,IB_MTU_4096 ); - props->phys_mtu =HFI1_CAP_IS_KSET (AIP ) ? hfi1_max_mtu : -ib_mtu_enum_to_int (props->max_mtu); + props->phys_mtu = hfi1_max_mtu;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 516/913 RDMA/core: Fix ib_qp_usecnt_dec() called when error
In reply to Greg Kroah-HartmanFrom: Yajun Deng <[email protected]>
[ Upstream commit 7c4a539ec38f4ce400a0f3fcb5ff6c940fcd67bb ]
ib_destroy_qp() would called by ib_create_qp_user() if error, the former contains ib_qp_usecnt_dec(), but ib_qp_usecnt_inc() was not called before.
So move ib_qp_usecnt_inc() into create_qp().
--- drivers/infiniband/core/uverbs_cmd.c | 1 - drivers/infiniband/core/uverbs_std_types_qp.c | 1 - drivers/infiniband/core/verbs.c | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +0 -1
@@ -1438,7 +1438,6 @@ static int create_qp(struct uverbs_attr_bundle *attrs, ret =PTR_ERR (qp); goto err_put; } -ib_qp_usecnt_inc (qp); obj->uevent.uobject.object = qp; obj->uevent.event_file =READ_ONCE (attrs->ufile->default_async_file);
drivers/infiniband/core/uverbs_std_types_qp.c +0 -1
@@ -254,7 +254,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)( ret =PTR_ERR (qp); goto err_put; } -ib_qp_usecnt_inc (qp);if (attr.qp_type ==IB_QPT_XRC_TGT ) { obj->uxrcd = container_of(xrcd_uobj, struct ib_uxrcd_object,
drivers/infiniband/core/verbs.c +1 -2
@@ -1253,6 +1253,7 @@ static struct ib_qp *create_qp(struct ib_device *dev, struct ib_pd *pd,if (ret) goto err_security; +ib_qp_usecnt_inc (qp);rdma_restrack_add (&qp->res);return qp;
@@ -1353,8 +1354,6 @@ struct ib_qp *ib_create_qp_kernel(struct ib_pd *pd,if (IS_ERR (qp))return qp; -ib_qp_usecnt_inc (qp); -if (qp_init_attr->cap.max_rdma_ctxs) { ret =rdma_rw_init_mrs (qp, qp_init_attr);if (ret)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 517/913 PCI: Reduce warnings on possible RW1C corruption
In reply to Greg Kroah-HartmanFrom: Mark Tomlinson <[email protected]>
[ Upstream commit 92c45b63ce22c8898aa41806e8d6692bcd577510 ]
For hardware that only supports 32-bit writes to PCI there is the possibility of clearing RW1C (write-one-to-clear) bits. A rate-limited messages was introduced by fb2659230120, but rate-limiting is not the best choice here. Some devices may not show the warnings they should if another device has just produced a bunch of warnings. Also, the number of messages can be a nuisance on devices which are otherwise working fine.
Change the ratelimit to a single warning per bus. This ensures no bus is 'starved' of emitting a warning and also that there isn't a continuous stream of warnings. It would be preferable to have a warning per device, but the pci_dev structure is not available here, and a lookup from devfn would be far too slow.
--- drivers/pci/access.c | 9 ++++++--- include/linux/pci.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/pci/access.c +6 -3
@@ -160,9 +160,12 @@ int pci_generic_config_write32(struct pci_bus *bus, unsigned int devfn,* write happen to have any RW1C (write-one-to-clear) bits set, we * just inadvertently cleared something we shouldn't have. */ -dev_warn_ratelimited (&bus->dev,"%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n" , - size,pci_domain_nr (bus), bus->number, -PCI_SLOT (devfn),PCI_FUNC (devfn), where); +if (!bus->unsafe_warn) { +dev_warn (&bus->dev,"%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n" , + size,pci_domain_nr (bus), bus->number, +PCI_SLOT (devfn),PCI_FUNC (devfn), where); + bus->unsafe_warn =1 ; + } mask = ~(((1 << (size *8 )) -1 ) << ((where &0x3 ) *8 )); tmp =readl (addr) & mask;
include/linux/pci.h +1 -0
@@ -656,6 +656,7 @@ struct pci_bus {struct bin_attribute *legacy_io;/* Legacy I/O for this bus */ struct bin_attribute *legacy_mem;/* Legacy mem */ unsigned int is_added:1; + unsigned int unsafe_warn:1; /* warned about RW1C config write */ };#define to_pci_bus (n) container_of(n, struct pci_bus, dev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 518/913 net: axienet: fix RX ring refill allocation failure handling
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 7a7d340ba4d9351e4c8847b898a2b996727a922a ]
If a memory allocation error occurred during an attempt to refill a slot in the RX ring after the packet was received, the hardware tail pointer would still have been updated to point to or past the slot which remained marked as previously completed. This would likely result in the DMA engine raising an error when it eventually tried to use that slot again.
If a slot cannot be refilled, then just stop processing and do not move the tail pointer past it. On the next attempt, we should skip receiving the packet from the empty slot and just try to refill it again.
This failure mode has not actually been observed, but was found as part of other driver updates.
--- .../net/ethernet/xilinx/xilinx_axienet_main.c | 72 +++++++++++-------- 1 file changed, 42 insertions(+), 30 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +42 -30
@@ -857,46 +857,53 @@ static void axienet_recv(struct net_device *ndev)while ((cur_p->status &XAXIDMA_BD_STS_COMPLETE_MASK )) {dma_addr_t phys; - tail_p = lp->rx_bd_p +sizeof (*lp->rx_bd_v) * lp->rx_bd_ci; -/* Ensure we see complete descriptor update */ dma_rmb (); - phys =desc_get_phys_addr (lp, cur_p); -dma_unmap_single (ndev->dev.parent, phys, lp->max_frm_size, -DMA_FROM_DEVICE ); skb = cur_p->skb; cur_p->skb =NULL ; - length = cur_p->app4 &0x0000FFFF ; - -skb_put (skb, length); - skb->protocol =eth_type_trans (skb, ndev); -/*skb_checksum_none_assert(skb);*/ - skb->ip_summed =CHECKSUM_NONE ; - -/* if we're doing Rx csum offload, set it up */ -if (lp->features &XAE_FEATURE_FULL_RX_CSUM ) { - csumstatus = (cur_p->app2 & -XAE_FULL_CSUM_STATUS_MASK ) >>3 ; -if ((csumstatus ==XAE_IP_TCP_CSUM_VALIDATED ) || - (csumstatus ==XAE_IP_UDP_CSUM_VALIDATED )) { - skb->ip_summed =CHECKSUM_UNNECESSARY ; + +/* skb could be NULL if a previous pass already received the +* packet for this slot in the ring, but failed to refill it +* with a newly allocated buffer. In this case, don't try to +* receive it again. +*/ +if (likely (skb)) { + length = cur_p->app4 &0x0000FFFF ; + + phys =desc_get_phys_addr (lp, cur_p); +dma_unmap_single (ndev->dev.parent, phys, lp->max_frm_size, +DMA_FROM_DEVICE ); + +skb_put (skb, length); + skb->protocol =eth_type_trans (skb, ndev); +/*skb_checksum_none_assert(skb);*/ + skb->ip_summed =CHECKSUM_NONE ; + +/* if we're doing Rx csum offload, set it up */ +if (lp->features &XAE_FEATURE_FULL_RX_CSUM ) { + csumstatus = (cur_p->app2 & +XAE_FULL_CSUM_STATUS_MASK ) >>3 ; +if (csumstatus ==XAE_IP_TCP_CSUM_VALIDATED || + csumstatus ==XAE_IP_UDP_CSUM_VALIDATED ) { + skb->ip_summed =CHECKSUM_UNNECESSARY ; + } + }else if ((lp->features &XAE_FEATURE_PARTIAL_RX_CSUM ) !=0 && + skb->protocol ==htons (ETH_P_IP ) && + skb->len >64 ) { + skb->csum =be32_to_cpu (cur_p->app3 &0xFFFF ); + skb->ip_summed =CHECKSUM_COMPLETE ; } - }else if ((lp->features &XAE_FEATURE_PARTIAL_RX_CSUM ) !=0 && - skb->protocol ==htons (ETH_P_IP ) && - skb->len >64 ) { - skb->csum =be32_to_cpu (cur_p->app3 &0xFFFF ); - skb->ip_summed =CHECKSUM_COMPLETE ; - } -netif_rx (skb); +netif_rx (skb); - size += length; - packets++; + size += length; + packets++; + } new_skb =netdev_alloc_skb_ip_align (ndev, lp->max_frm_size);if (!new_skb) -return ; +break ; phys = dma_map_single(ndev->dev.parent, new_skb->data, lp->max_frm_size,
@@ -905,7 +912,7 @@ static void axienet_recv(struct net_device *ndev)if (net_ratelimit ())netdev_err (ndev,"RX DMA mapping error\n" );dev_kfree_skb (new_skb); -return ; +break ; }desc_set_phys_addr (lp, phys, cur_p);
@@ -913,6 +920,11 @@ static void axienet_recv(struct net_device *ndev) cur_p->status =0 ; cur_p->skb = new_skb; +/* Only update tail_p to mark this slot as usable after it has +* been successfully refilled. +*/ + tail_p = lp->rx_bd_p +sizeof (*lp->rx_bd_v) * lp->rx_bd_ci; +if (++lp->rx_bd_ci >= lp->rx_bd_num) lp->rx_bd_ci =0 ; cur_p = &lp->rx_bd_v[lp->rx_bd_ci];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 519/913 drm/msm/a6xx: Fix missing ARRAY_SIZE() check
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit cca96584b35765bf9eb5f38ca55a144ea2ba0de4 ]
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +8 -4
@@ -658,19 +658,23 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu) {struct adreno_gpu *adreno_gpu =to_adreno_gpu (gpu);const u32 *regs = a6xx_protect; -unsigned i, count =ARRAY_SIZE (a6xx_protect), count_max =32 ; - -BUILD_BUG_ON (ARRAY_SIZE (a6xx_protect) >32 ); -BUILD_BUG_ON (ARRAY_SIZE (a650_protect) >48 ); +unsigned i, count, count_max;if (adreno_is_a650 (adreno_gpu)) { regs = a650_protect; count =ARRAY_SIZE (a650_protect); count_max =48 ; +BUILD_BUG_ON (ARRAY_SIZE (a650_protect) >48 ); }else if (adreno_is_a660_family (adreno_gpu)) { regs = a660_protect; count =ARRAY_SIZE (a660_protect); count_max =48 ; +BUILD_BUG_ON (ARRAY_SIZE (a660_protect) >48 ); + }else { + regs = a6xx_protect; + count =ARRAY_SIZE (a6xx_protect); + count_max =32 ; +BUILD_BUG_ON (ARRAY_SIZE (a6xx_protect) >32 ); }/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 520/913 mips: DEC: honor CONFIG_MIPS_FP_SUPPORT=n
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 97bf0395c226907e1a9b908511a35192bf1e09bb ]
Include the DECstation interrupt handler in opting out of FPU support.
Fixes a linker error:
mips-linux-ld: arch/mips/dec/int-handler.o: in function `fpu':
(.text+0x148): undefined reference to `handle_fpe_int'
--- arch/mips/dec/int-handler.S | 6 +++--- arch/mips/dec/setup.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/mips/dec/int-handler.S +3 -3
@@ -131,7 +131,7 @@ */ mfc0 t0,CP0_CAUSE # get pending interrupts mfc0 t1,CP0_STATUS -#ifdef CONFIG_32BIT +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) lw t2,cpu_fpu_mask #endif andi t0,ST0_IM # CAUSE.CE may be non-zero!
@@ -139,7 +139,7 @@ beqz t0,spurious -#ifdef CONFIG_32BIT +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) and t2,t0 bnez t2,fpu # handle FPU immediately #endif
@@ -280,7 +280,7 @@ handle_it: j dec_irq_dispatch nop -#ifdef CONFIG_32BIT +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) fpu: lw t0,fpu_kstat_irq nop
arch/mips/dec/setup.c +2 -1
@@ -746,7 +746,8 @@ void __init arch_init_irq(void) dec_interrupt[DEC_IRQ_HALT ] =-1 ;/* Register board interrupts: FPU and cascade. */ -if (dec_interrupt[DEC_IRQ_FPU ] >=0 && cpu_has_fpu) { +if (IS_ENABLED (CONFIG_MIPS_FP_SUPPORT ) && + dec_interrupt[DEC_IRQ_FPU ] >=0 && cpu_has_fpu) {struct irq_desc *desc_fpu;int irq_fpu;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 521/913 MIPS: Sanitise Cavium switch cases in TLB handler synthesizers
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
[ Upstream commit 6ddcba9d480b6bcced4223a729794dfa6becb7eb ]
It makes no sense to fall through to `break'. Therefore reorder the switch statements so as to have the Cavium cases first, followed by the default case, which improves readability and pacifies code analysis tools. No change in semantics, assembly produced is exactly the same.
--- arch/mips/mm/tlbex.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
arch/mips/mm/tlbex.c +10 -13
@@ -2167,16 +2167,14 @@ static void build_r4000_tlb_load_handler(void)uasm_i_tlbr (&p);switch (current_cpu_type ()) { -default : -if (cpu_has_mips_r2_exec_hazard) { -uasm_i_ehb (&p); - fallthrough; -case CPU_CAVIUM_OCTEON :case CPU_CAVIUM_OCTEON_PLUS :case CPU_CAVIUM_OCTEON2 : -break ; - } +break ; +default : +if (cpu_has_mips_r2_exec_hazard) +uasm_i_ehb (&p); +break ; }/* Examine entrylo 0 or 1 based on ptr. */
@@ -2243,15 +2241,14 @@ static void build_r4000_tlb_load_handler(void)uasm_i_tlbr (&p);switch (current_cpu_type ()) { -default : -if (cpu_has_mips_r2_exec_hazard) { -uasm_i_ehb (&p); -case CPU_CAVIUM_OCTEON :case CPU_CAVIUM_OCTEON_PLUS :case CPU_CAVIUM_OCTEON2 : -break ; - } +break ; +default : +if (cpu_has_mips_r2_exec_hazard) +uasm_i_ehb (&p); +break ; }/* Examine entrylo 0 or 1 based on ptr. */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 522/913 powerpc/sysdev: fix incorrect use to determine if list is empty
In reply to Greg Kroah-HartmanFrom: Jakob Koschel <[email protected]>
[ Upstream commit fa1321b11bd01752f5be2415e74a0e1a7c378262 ]
'gtm' will *always* be set by list_for_each_entry().
It is incorrect to assume that the iterator value will be NULL if the list is empty.
Instead of checking the pointer it should be checked if the list is empty.
--- arch/powerpc/sysdev/fsl_gtm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/fsl_gtm.c +2 -2
@@ -86,7 +86,7 @@ static LIST_HEAD(gtms);*/ struct gtm_timer *gtm_get_timer16 (void ) { -struct gtm *gtm =NULL ; +struct gtm *gtm;int i;list_for_each_entry (gtm, >ms, list_node) {
@@ -103,7 +103,7 @@ struct gtm_timer *gtm_get_timer16(void)spin_unlock_irq (>m->lock); } -if (gtm) +if (!list_empty (>ms))return ERR_PTR (-EBUSY );return ERR_PTR (-ENODEV ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 523/913 powerpc/64s: Dont use DSISR for SLB faults
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit d4679ac8ea2e5078704aa1c026db36580cc1bf9a ]
Since commit 46ddcb3950a2 ("powerpc/mm: Show if a bad page fault on data is read or write.") we use page_fault_is_write(regs->dsisr) in __bad_page_fault() to determine if the fault is for a read or write, and change the message printed accordingly.
But SLB faults, aka Data Segment Interrupts, don't set DSISR (Data Storage Interrupt Status Register) to a useful value. All ISA versions from v2.03 through v3.1 specify that the Data Segment Interrupt sets DSISR "to an undefined value". As far as I can see there's no mention of SLB faults setting DSISR in any BookIV content either.
This manifests as accesses that should be a read being incorrectly reported as writes, for example, using the xmon "dump" command:
0:mon> d 0x5deadbeef0000000
5deadbeef0000000
[359526.415354][ C6] BUG: Unable to handle kernel data access on write at 0x5deadbeef0000000
[359526.415611][ C6] Faulting instruction address: 0xc00000000010a300
cpu 0x6: Vector: 380 (Data SLB Access) at [c00000000ffbf400]
pc: c00000000010a300: mread+0x90/0x190If we disassemble the PC, we see a load instruction:
0:mon> di c00000000010a300
c00000000010a300 89490000 lbz r10,0(r9)
We can also see in exceptions-64s.S that the data_access_slb block doesn't set IDSISR=1, which means it doesn't load DSISR into pt_regs. So the value we're using to determine if the fault is a read/write is some stale value in pt_regs from a previous page fault.
Rework the printing logic to separate the SLB fault case out, and only print read/write in the cases where we can determine it.
The result looks like eg:
0:mon> d 0x5deadbeef0000000
5deadbeef0000000
[ 721.779525][ C6] BUG: Unable to handle kernel data access at 0x5deadbeef0000000 [ 721.779697][ C6] Faulting instruction address: 0xc00000000014cbe0 cpu 0x6: Vector: 380 (Data SLB Access) at [c00000000ffbf390]
0:mon> d 0
0000000000000000
[ 742.793242][ C6] BUG: Kernel NULL pointer dereference at 0x00000000 [ 742.793316][ C6] Faulting instruction address: 0xc00000000014cbe0 cpu 0x6: Vector: 380 (Data SLB Access) at [c00000000ffbf390]
--- arch/powerpc/mm/fault.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
arch/powerpc/mm/fault.c +10 -4
@@ -568,18 +568,24 @@ NOKPROBE_SYMBOL(hash__do_page_fault);static void __bad_page_fault (struct pt_regs *regs,int sig) {int is_write =page_fault_is_write (regs->dsisr); +const char *msg;/* kernel has accessed a bad area */ +if (regs->dar <PAGE_SIZE ) + msg ="Kernel NULL pointer dereference" ; +else + msg ="Unable to handle kernel data access" ; +switch (TRAP (regs)) {case INTERRUPT_DATA_STORAGE : -case INTERRUPT_DATA_SEGMENT :case INTERRUPT_H_DATA_STORAGE : -pr_alert ("BUG: %s on %s at 0x%08lx\n" , - regs->dar <PAGE_SIZE ?"Kernel NULL pointer dereference" : -"Unable to handle kernel data access" , +pr_alert ("BUG: %s on %s at 0x%08lx\n" , msg, is_write ?"write" :"read" , regs->dar);break ; +case INTERRUPT_DATA_SEGMENT : +pr_alert ("BUG: %s at 0x%08lx\n" , msg, regs->dar); +break ;case INTERRUPT_INST_STORAGE :case INTERRUPT_INST_SEGMENT : pr_alert("BUG: Unable to handle kernel instruction fetch%s",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 524/913 mfd: mc13xxx: Add check for mc13xxx_irq_request
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit e477e51a41cb5d6034f3c5ea85a71ad4613996b9 ]
As the potential failure of the devm_request_threaded_irq(), it should be better to check the return value of the mc13xxx_irq_request() and return error if fails.
--- drivers/mfd/mc13xxx-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/mc13xxx-core.c +3 -1
@@ -323,8 +323,10 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, adc1 |=MC13783_ADC1_ATOX ;dev_dbg (mc13xxx->dev,"%s: request irq\n" , __func__); -mc13xxx_irq_request (mc13xxx,MC13XXX_IRQ_ADCDONE , + ret =mc13xxx_irq_request (mc13xxx,MC13XXX_IRQ_ADCDONE , mc13xxx_handler_adcdone, __func__, &adcdone_data); +if (ret) + goto out;mc13xxx_reg_write (mc13xxx,MC13XXX_ADC0 , adc0);mc13xxx_reg_write (mc13xxx,MC13XXX_ADC1 , adc1);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 525/913 libbpf: Unmap rings when umem deleted
In reply to Greg Kroah-HartmanFrom: lic121 <[email protected]>
[ Upstream commit 9c6e6a80ee741adf6cb3cfd8eef7d1554f91fceb ]
xsk_umem__create() does mmap for fill/comp rings, but xsk_umem__delete() doesn't do the unmap. This works fine for regular cases, because xsk_socket__delete() does unmap for the rings. But for the case that xsk_socket__create_shared() fails, umem rings are not unmapped.
fill_save/comp_save are checked to determine if rings have already be unmapped by xsk. If fill_save and comp_save are NULL, it means that the rings have already been used by xsk. Then they are supposed to be unmapped by xsk_socket__delete(). Otherwise, xsk_umem__delete() does the unmap.
--- tools/lib/bpf/xsk.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/lib/bpf/xsk.c +11 -0
@@ -1210,12 +1210,23 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,int xsk_umem__delete (struct xsk_umem *umem) { +struct xdp_mmap_offsets off; +int err; +if (!umem)return 0 ;if (umem->refcount)return -EBUSY ; + err =xsk_get_mmap_offsets (umem->fd, &off); +if (!err && umem->fill_save && umem->comp_save) { +munmap (umem->fill_save->ring - off.fr.desc, + off.fr.desc + umem->config.fill_size *sizeof (__u64)); +munmap (umem->comp_save->ring - off.cr.desc, + off.cr.desc + umem->config.comp_size *sizeof (__u64)); + } +close (umem->fd);free (umem);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 526/913 selftests/bpf: Make test_lwt_ip_encap more stable and faster
In reply to Greg Kroah-HartmanFrom: Felix Maurer <[email protected]>
[ Upstream commit d23a8720327d33616f584d76c80824bfa4699be6 ]
In test_lwt_ip_encap, the ingress IPv6 encap test failed from time to time. The failure occured when an IPv4 ping through the IPv6 GRE encapsulation did not receive a reply within the timeout. The IPv4 ping and the IPv6 ping in the test used different timeouts (1 sec for IPv4 and 6 sec for IPv6), probably taking into account that IPv6 might need longer to successfully complete. However, when IPv4 pings (with the short timeout) are encapsulated into the IPv6 tunnel, the delays of IPv6 apply.
The actual reason for the long delays with IPv6 was that the IPv6 neighbor discovery sometimes did not complete in time. This was caused by the outgoing interface only having a tentative link local address, i.e., not having completed DAD for that lladdr. The ND was successfully retried after 1 sec but that was too late for the ping timeout.
The IPv6 addresses for the test were already added with nodad. However, for the lladdrs, DAD was still performed. We now disable DAD in the test netns completely and just assume that the two lladdrs on each veth pair do not collide. This removes all the delays for IPv6 traffic in the test.
Without the delays, we can now also reduce the delay of the IPv6 ping to 1 sec. This makes the whole test complete faster because we don't need to wait for the excessive timeout for each IPv6 ping that is supposed to fail.
--- tools/testing/selftests/bpf/test_lwt_ip_encap.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/test_lwt_ip_encap.sh +9 -1
@@ -120,6 +120,14 @@ setup() ip netns exec ${NS2} sysctl -wq net.ipv4.conf.default.rp_filter=0 ip netns exec ${NS3} sysctl -wq net.ipv4.conf.default.rp_filter=0 + # disable IPv6 DAD because it sometimes takes too long and fails tests + ip netns exec ${NS1} sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec ${NS2} sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec ${NS3} sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec ${NS1} sysctl -wq net.ipv6.conf.default.accept_dad=0 + ip netns exec ${NS2} sysctl -wq net.ipv6.conf.default.accept_dad=0 + ip netns exec ${NS3} sysctl -wq net.ipv6.conf.default.accept_dad=0 + ip link add veth1 type veth peer name veth2 ip link add veth3 type veth peer name veth4 ip link add veth5 type veth peer name veth6
@@ -289,7 +297,7 @@ test_ping() ip netns exec ${NS1} ping -c 1 -W 1 -I veth1 ${IPv4_DST} 2>&1 > /dev/null RET=$? elif [ "${PROTO}" == "IPv6" ] ; then - ip netns exec ${NS1} ping6 -c 1 -W 6 -I veth1 ${IPv6_DST} 2>&1 > /dev/null + ip netns exec ${NS1} ping6 -c 1 -W 1 -I veth1 ${IPv6_DST} 2>&1 > /dev/null RET=$? else echo " test_ping: unknown PROTO: ${PROTO}"
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 527/913 platform/x86: huawei-wmi: check the return value of device_create_file()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit c91a5b1c221a58d008485cf7d02ccce73108b119 ]
The function device_create_file() in huawei_wmi_battery_add() can fail, so its return value should be checked.
--- drivers/platform/x86/huawei-wmi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/platform/x86/huawei-wmi.c +10 -3
@@ -470,10 +470,17 @@ static DEVICE_ATTR_RW(charge_control_thresholds);static int huawei_wmi_battery_add (struct power_supply *battery) { -device_create_file (&battery->dev, &dev_attr_charge_control_start_threshold); -device_create_file (&battery->dev, &dev_attr_charge_control_end_threshold); +int err =0 ; -return 0 ; + err =device_create_file (&battery->dev, &dev_attr_charge_control_start_threshold); +if (err) +return err; + + err =device_create_file (&battery->dev, &dev_attr_charge_control_end_threshold); +if (err) +device_remove_file (&battery->dev, &dev_attr_charge_control_start_threshold); + +return err; }static int huawei_wmi_battery_remove (struct power_supply *battery)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 528/913 scsi: mpt3sas: Fix incorrect 4GB boundary check
In reply to Greg Kroah-HartmanFrom: Sreekanth Reddy <[email protected]>
[ Upstream commit 208cc9fe6f21112b5cc6cb87065fb8ab66e79316 ]
The driver must perform its 4GB boundary check using the pool's DMA address instead of using the virtual address.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +12 -13
@@ -5737,14 +5737,13 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)*/ static int -mpt3sas_check_same_4gb_region (long reply_pool_start_address,u32 pool_sz) +mpt3sas_check_same_4gb_region (dma_addr_t start_address,u32 pool_sz) { -long reply_pool_end_address; +dma_addr_t end_address; - reply_pool_end_address = reply_pool_start_address + pool_sz; + end_address = start_address + pool_sz -1 ; -if (upper_32_bits (reply_pool_start_address) == -upper_32_bits (reply_pool_end_address)) +if (upper_32_bits (start_address) ==upper_32_bits (end_address))return 1 ;else return 0 ;
@@ -5805,7 +5804,7 @@ _base_allocate_pcie_sgl_pool(struct MPT3SAS_ADAPTER *ioc, u32 sz) }if (!mpt3sas_check_same_4gb_region ( - (long )ioc->pcie_sg_lookup[i].pcie_sgl, sz)) { + ioc->pcie_sg_lookup[i].pcie_sgl_dma, sz)) { ioc_err(ioc, "PCIE SGLs are not in same 4G !! pcie sgl (0x%p) dma = (0x%llx)\n", ioc->pcie_sg_lookup[i].pcie_sgl, (unsigned long long)
@@ -5860,8 +5859,8 @@ _base_allocate_chain_dma_pool(struct MPT3SAS_ADAPTER *ioc, u32 sz) GFP_KERNEL, &ctr->chain_buffer_dma);if (!ctr->chain_buffer)return -EAGAIN ; -if (!mpt3sas_check_same_4gb_region ((long ) - ctr->chain_buffer, ioc->chain_segment_sz)) { +if (!mpt3sas_check_same_4gb_region ( + ctr->chain_buffer_dma, ioc->chain_segment_sz)) { ioc_err(ioc, "Chain buffers are not in same 4G !!! Chain buff (0x%p) dma = (0x%llx)\n", ctr->chain_buffer,
@@ -5897,7 +5896,7 @@ _base_allocate_sense_dma_pool(struct MPT3SAS_ADAPTER *ioc, u32 sz) GFP_KERNEL, &ioc->sense_dma);if (!ioc->sense)return -EAGAIN ; -if (!mpt3sas_check_same_4gb_region ((long )ioc->sense, sz)) { +if (!mpt3sas_check_same_4gb_region (ioc->sense_dma, sz)) {dinitprintk (ioc,pr_err ("Bad Sense Pool! sense (0x%p) sense_dma = (0x%llx)\n" , ioc->sense, (unsigned long long ) ioc->sense_dma));
@@ -5930,7 +5929,7 @@ _base_allocate_reply_pool(struct MPT3SAS_ADAPTER *ioc, u32 sz) &ioc->reply_dma);if (!ioc->reply)return -EAGAIN ; -if (!mpt3sas_check_same_4gb_region ((long )ioc->reply_free, sz)) { +if (!mpt3sas_check_same_4gb_region (ioc->reply_dma, sz)) {dinitprintk (ioc,pr_err ("Bad Reply Pool! Reply (0x%p) Reply dma = (0x%llx)\n" , ioc->reply, (unsigned long long ) ioc->reply_dma));
@@ -5965,7 +5964,7 @@ _base_allocate_reply_free_dma_pool(struct MPT3SAS_ADAPTER *ioc, u32 sz) GFP_KERNEL, &ioc->reply_free_dma);if (!ioc->reply_free)return -EAGAIN ; -if (!mpt3sas_check_same_4gb_region ((long )ioc->reply_free, sz)) { +if (!mpt3sas_check_same_4gb_region (ioc->reply_free_dma, sz)) {dinitprintk (ioc,pr_err ("Bad Reply Free Pool! Reply Free (0x%p) Reply Free dma = (0x%llx)\n" , ioc->reply_free, (unsigned long long ) ioc->reply_free_dma));
@@ -6004,7 +6003,7 @@ _base_allocate_reply_post_free_array(struct MPT3SAS_ADAPTER *ioc, GFP_KERNEL, &ioc->reply_post_free_array_dma);if (!ioc->reply_post_free_array)return -EAGAIN ; -if (!mpt3sas_check_same_4gb_region ((long )ioc->reply_post_free_array, +if (!mpt3sas_check_same_4gb_region (ioc->reply_post_free_array_dma, reply_post_free_array_sz)) { dinitprintk(ioc, pr_err( "Bad Reply Free Pool! Reply Free (0x%p) Reply Free dma = (0x%llx)\n",
@@ -6069,7 +6068,7 @@ base_alloc_rdpq_dma_pool(struct MPT3SAS_ADAPTER *ioc, int sz)* resources and set DMA mask to 32 and allocate. */ if (!mpt3sas_check_same_4gb_region ( - (long )ioc->reply_post[i].reply_post_free, sz)) { + ioc->reply_post[i].reply_post_free_dma, sz)) { dinitprintk(ioc, ioc_err(ioc, "bad Replypost free pool(0x%p)" "reply_post_free_dma = (0x%llx)\n",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 529/913 powerpc: 8xx: fix a return value error in mpc8xx_pic_init
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit 3fd46e551f67f4303c3276a0d6cd20baf2d192c4 ]
mpc8xx_pic_init() should return -ENOMEM instead of 0 when irq_domain_add_linear() return NULL. This cause mpc8xx_pics_init to continue executing even if mpc8xx_pic_host is NULL.
--- arch/powerpc/platforms/8xx/pic.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/8xx/pic.c +1 -0
@@ -153,6 +153,7 @@ int __init mpc8xx_pic_init(void)if (mpc8xx_pic_host ==NULL ) {printk (KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n" ); ret = -ENOMEM ; + goto out; } ret =0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 530/913 vxcan: enable local echo for sent CAN frames
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit 259bdba27e32368b4404f69d613b1c1014c07cbf ]
The vxcan driver provides a pair of virtual CAN interfaces to exchange CAN traffic between different namespaces - analogue to veth.
In opposite to the vcan driver the local sent CAN traffic on this interface is not echo'ed back but only sent to the remote peer. This is unusual and can be easily fixed by removing IFF_ECHO from the netdevice flags that are set for vxcan interfaces by default at startup.
Without IFF_ECHO set on driver level, the local sent CAN frames are echo'ed in af_can.c in can_send(). This patch makes vxcan interfaces adopt the same local echo behavior and procedures as known from the vcan interfaces.
--- drivers/net/can/vxcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/vxcan.c +1 -1
@@ -148,7 +148,7 @@ static void vxcan_setup(struct net_device *dev) dev->hard_header_len =0 ; dev->addr_len =0 ; dev->tx_queue_len =0 ; - dev->flags = (IFF_NOARP |IFF_ECHO ); + dev->flags =IFF_NOARP ; dev->netdev_ops = &vxcan_netdev_ops; dev->needs_free_netdev = true;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 531/913 ath10k: Fix error handling in ath10k_setup_msa_resources
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 9747a78d5f758a5284751a10aee13c30d02bd5f1 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
This function only calls of_node_put() in the regular path. And it will cause refcount leak in error path.
--- drivers/net/wireless/ath/ath10k/snoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/snoc.c +1 -1
@@ -1556,11 +1556,11 @@ static int ath10k_setup_msa_resources(struct ath10k *ar, u32 msa_size) node =of_parse_phandle (dev->of_node,"memory-region" ,0 );if (node) { ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret) {dev_err (dev,"failed to resolve msa fixed region\n" );return ret; } -of_node_put (node); ar->msa.paddr = r.start; ar->msa.mem_size =resource_size (&r);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 532/913 mips: cdmm: Fix refcount leak in mips_cdmm_phys_base
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 4528668ca331f7ce5999b7746657b46db5b3b785 ]
The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.
--- drivers/bus/mips_cdmm.c | 1 + 1 file changed, 1 insertion(+)
drivers/bus/mips_cdmm.c +1 -0
@@ -351,6 +351,7 @@ phys_addr_t __weak mips_cdmm_phys_base(void) np =of_find_compatible_node (NULL ,NULL ,"mti,mips-cdmm" );if (np) { err =of_address_to_resource (np,0 , &res); +of_node_put (np);if (!err)return res.start; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 533/913 MIPS: RB532: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 8755d57ba1ff910666572fab9e32890e8cc6ed3b ]
__setup() handlers should return 1 to obsolete_checksetup() in init/main.c to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) argument or environment strings. Also, error return codes don't mean anything to obsolete_checksetup() -- only non-zero (usually 1) or zero. So return 1 from setup_kmac().
From: Igor Zhbanov <[email protected]>
--- arch/mips/rb532/devices.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/mips/rb532/devices.c +2 -4
@@ -301,11 +301,9 @@ static int __init plat_setup_devices(void)static int __init setup_kmac (char *s) {printk (KERN_INFO "korina mac = %s\n" , s); -if (!mac_pton (s, korina_dev0_data.mac)) { +if (!mac_pton (s, korina_dev0_data.mac))printk (KERN_ERR "Invalid mac\n" ); -return -EINVAL ; - } -return 0 ; +return 1 ; }__setup ("kmac=" , setup_kmac);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 534/913 MIPS: pgalloc: fix memory leak caused by pgd_free()
In reply to Greg Kroah-HartmanFrom: Yaliang Wang <[email protected]>
[ Upstream commit 2bc5bab9a763d520937e4f3fe8df51c6a1eceb97 ]
pgd page is freed by generic implementation pgd_free() since commit f9cb654cb550 ("asm-generic: pgalloc: provide generic pgd_free()"), however, there are scenarios that the system uses more than one page as the pgd table, in such cases the generic implementation pgd_free() won't be applicable anymore. For example, when PAGE_SIZE_4KB is enabled and MIPS_VA_BITS_48 is not enabled in a 64bit system, the macro "PGD_ORDER" will be set as "1", which will cause allocating two pages as the pgd table. Well, at the same time, the generic implementation pgd_free() just free one pgd page, which will result in the memory leak.
The memory leak can be easily detected by executing shell command:
"while true; do ls > /dev/null; grep MemFree /proc/meminfo; done"
--- arch/mips/include/asm/pgalloc.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/include/asm/pgalloc.h +6 -0
@@ -15,6 +15,7 @@#define __HAVE_ARCH_PMD_ALLOC_ONE#define __HAVE_ARCH_PUD_ALLOC_ONE +#define __HAVE_ARCH_PGD_FREE#include <asm-generic/pgalloc.h> static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
@@ -48,6 +49,11 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)extern void pgd_init (unsigned long page);extern pgd_t *pgd_alloc (struct mm_struct *mm); +static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) +{ +free_pages ((unsigned long )pgd,PGD_ORDER ); +} +#define __pte_free_tlb (tlb,pte,address) \ do { \ pgtable_pte_page_dtor(pte); \
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 535/913 mtd: rawnand: atmel: fix refcount issue in atmel_nand_controller_init
In reply to Greg Kroah-HartmanFrom: Xin Xiong <[email protected]>
[ Upstream commit fecbd4a317c95d73c849648c406bcf1b6a0ec1cf ]
The reference counting issue happens in several error handling paths on a refcounted object "nc->dmac". In these paths, the function simply returns the error code, forgetting to balance the reference count of "nc->dmac", increased earlier by dma_request_channel(), which may cause refcount leaks.
Fix it by decrementing the refcount of specific object in those error paths.
--- drivers/mtd/nand/raw/atmel/nand-controller.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +11 -3
@@ -2060,13 +2060,15 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, nc->mck =of_clk_get (dev->parent->of_node,0 );if (IS_ERR (nc->mck)) {dev_err (dev,"Failed to retrieve MCK clk\n" ); -return PTR_ERR (nc->mck); + ret =PTR_ERR (nc->mck); + goto out_release_dma; } np =of_parse_phandle (dev->parent->of_node,"atmel,smc" ,0 );if (!np) {dev_err (dev,"Missing or invalid atmel,smc property\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto out_release_dma; } nc->smc =syscon_node_to_regmap (np);
@@ -2074,10 +2076,16 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc,if (IS_ERR (nc->smc)) { ret =PTR_ERR (nc->smc);dev_err (dev,"Could not get SMC regmap (err = %d)\n" , ret); -return ret; + goto out_release_dma; }return 0 ; + +out_release_dma: +if (nc->dmac) +dma_release_channel (nc->dmac); + +return ret; } static int
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 536/913 power: ab8500_chargalg: Use CLOCK_MONOTONIC
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit c22fca40522e2be8af168f3087d87d85e404ea72 ]
The HRTimer in the AB8500 charging code is using CLOCK_REALTIME to set an alarm some hours forward in time +/- 5 min for a safety timer.
I have observed that this will sometimes fire sporadically early when charging a battery with the result that charging stops.
As CLOCK_REALTIME can be subject to adjustments of time from sources such as NTP, this cannot be trusted and will likely for example fire events if the clock is set forward some hours by say NTP.
Use CLOCK_MONOTONIC as indicated in other instances and the problem goes away. Also initialize the timer to REL mode as this is what will be used later.
--- drivers/power/supply/ab8500_chargalg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/supply/ab8500_chargalg.c +2 -2
@@ -2019,11 +2019,11 @@ static int ab8500_chargalg_probe(struct platform_device *pdev) psy_cfg.drv_data = di;/* Initilialize safety timer */ -hrtimer_init (&di->safety_timer,CLOCK_REALTIME ,HRTIMER_MODE_ABS ); +hrtimer_init (&di->safety_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); di->safety_timer.function = ab8500_chargalg_safety_timer_expired;/* Initilialize maintenance timer */ -hrtimer_init (&di->maintenance_timer,CLOCK_REALTIME ,HRTIMER_MODE_ABS ); +hrtimer_init (&di->maintenance_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); di->maintenance_timer.function = ab8500_chargalg_maintenance_timer_expired;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 537/913 RDMA/irdma: Prevent some integer underflows
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 6f6dbb819dfc1a35bcb8b709b5c83a3ea8beff75 ]
My static checker complains that:
drivers/infiniband/hw/irdma/ctrl.c:3605 irdma_sc_ceq_init()
warn: can subtract underflow 'info->dev->hmc_fpm_misc.max_ceqs'?It appears that "info->dev->hmc_fpm_misc.max_ceqs" comes from the firmware in irdma_sc_parse_fpm_query_buf() so, yes, there is a chance that it could be zero. Even if we trust the firmware, it's easy enough to change the condition just as a hardenning measure.
--- drivers/infiniband/hw/irdma/ctrl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/hw/irdma/ctrl.c +5 -5
@@ -431,7 +431,7 @@ enum irdma_status_code irdma_sc_qp_create(struct irdma_sc_qp *qp, struct irdma_c cqp = qp->dev->cqp;if (qp->qp_uk.qp_id < cqp->dev->hw_attrs.min_hw_qp_id || - qp->qp_uk.qp_id > (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_QP ].max_cnt -1 )) + qp->qp_uk.qp_id >= (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_QP ].max_cnt))return IRDMA_ERR_INVALID_QP_ID ; wqe =irdma_sc_cqp_get_next_send_wqe (cqp, scratch);
@@ -2551,10 +2551,10 @@ static enum irdma_status_code irdma_sc_cq_create(struct irdma_sc_cq *cq,enum irdma_status_code ret_code =0 ; cqp = cq->dev->cqp; -if (cq->cq_uk.cq_id > (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_CQ ].max_cnt -1 )) +if (cq->cq_uk.cq_id >= (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_CQ ].max_cnt))return IRDMA_ERR_INVALID_CQ_ID ; -if (cq->ceq_id > (cq->dev->hmc_fpm_misc.max_ceqs -1 )) +if (cq->ceq_id >= (cq->dev->hmc_fpm_misc.max_ceqs))return IRDMA_ERR_INVALID_CEQ_ID ; ceq = cq->dev->ceq[cq->ceq_id];
@@ -3656,7 +3656,7 @@ enum irdma_status_code irdma_sc_ceq_init(struct irdma_sc_ceq *ceq, info->elem_cnt > info->dev->hw_attrs.max_hw_ceq_size)return IRDMA_ERR_INVALID_SIZE ; -if (info->ceq_id > (info->dev->hmc_fpm_misc.max_ceqs -1 )) +if (info->ceq_id >= (info->dev->hmc_fpm_misc.max_ceqs))return IRDMA_ERR_INVALID_CEQ_ID ; pble_obj_cnt = info->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_PBLE ].cnt;
@@ -4205,7 +4205,7 @@ enum irdma_status_code irdma_sc_ccq_init(struct irdma_sc_cq *cq, info->num_elem > info->dev->hw_attrs.uk_attrs.max_hw_cq_size)return IRDMA_ERR_INVALID_SIZE ; -if (info->ceq_id > (info->dev->hmc_fpm_misc.max_ceqs -1 )) +if (info->ceq_id >= (info->dev->hmc_fpm_misc.max_ceqs ))return IRDMA_ERR_INVALID_CEQ_ID ; pble_obj_cnt = info->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_PBLE ].cnt;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 538/913 Revert "RDMA/core: Fix ib_qp_usecnt_dec() called when error"
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 7922d3de4d270a9aedb71212fc0d5ae697ced516 ]
This reverts commit 7c4a539ec38f4ce400a0f3fcb5ff6c940fcd67bb. which causes to the following error in mlx4.
Destroy of kernel CQ shouldn't fail
WARNING: CPU: 4 PID: 18064 at include/rdma/ib_verbs.h:3936 mlx4_ib_dealloc_xrcd+0x12e/0x1b0 [mlx4_ib] Modules linked in: bonding ib_ipoib ip_gre ipip tunnel4 geneve rdma_ucm nf_tables ib_umad mlx4_en mlx4_ib ib_uverbs mlx4_core ip6_gre gre ip6_tunnel tunnel6 iptable_raw openvswitch nsh rpcrdma ib_iser libiscsi scsi_transport_iscsi rdma_cm iw_cm ib_cm ib_core xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter overlay fuse [last unloaded: mlx4_core] CPU: 4 PID: 18064 Comm: ibv_xsrq_pingpo Not tainted 5.17.0-rc7_master_62c6ecb #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:mlx4_ib_dealloc_xrcd+0x12e/0x1b0 [mlx4_ib] Code: 1e 93 08 00 40 80 fd 01 0f 87 fa f1 04 00 83 e5 01 0f 85 2b ff ff ff 48 c7 c7 20 4f b6 a0 c6 05 fd 92 08 00 01 e8 47 c9 82 e2 <0f> 0b e9 11 ff ff ff 0f b6 2d eb 92 08 00 40 80 fd 01 0f 87 b1 f1 RSP: 0018:ffff8881a4957750 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff8881ac4b6800 RCX: 0000000000000000 RDX: 0000000000000027 RSI: 0000000000000004 RDI: ffffed103492aedc RBP: 0000000000000000 R08: 0000000000000001 R09: ffff8884d2e378eb R10: ffffed109a5c6f1d R11: 0000000000000001 R12: ffff888132620000 R13: ffff8881a4957a90 R14: ffff8881aa2d4000 R15: ffff8881a4957ad0 FS: 00007f0401747740(0000) GS:ffff8884d2e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055f8ae036118 CR3: 000000012fe94005 CR4: 0000000000370ea0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ib_dealloc_xrcd_user+0xce/0x120 [ib_core] ib_uverbs_dealloc_xrcd+0xad/0x210 [ib_uverbs] uverbs_free_xrcd+0xe8/0x190 [ib_uverbs] destroy_hw_idr_uobject+0x7a/0x130 [ib_uverbs] uverbs_destroy_uobject+0x164/0x730 [ib_uverbs] uobj_destroy+0x72/0xf0 [ib_uverbs] ib_uverbs_cmd_verbs+0x19fb/0x3110 [ib_uverbs] ib_uverbs_ioctl+0x169/0x260 [ib_uverbs] __x64_sys_ioctl+0x856/0x1550 do_syscall_64+0x3d/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
--- drivers/infiniband/core/uverbs_cmd.c | 1 + drivers/infiniband/core/uverbs_std_types_qp.c | 1 + drivers/infiniband/core/verbs.c | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/core/uverbs_cmd.c +1 -0
@@ -1438,6 +1438,7 @@ static int create_qp(struct uverbs_attr_bundle *attrs, ret =PTR_ERR (qp); goto err_put; } +ib_qp_usecnt_inc (qp); obj->uevent.uobject.object = qp; obj->uevent.event_file =READ_ONCE (attrs->ufile->default_async_file);
drivers/infiniband/core/uverbs_std_types_qp.c +1 -0
@@ -254,6 +254,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)( ret =PTR_ERR (qp); goto err_put; } +ib_qp_usecnt_inc (qp);if (attr.qp_type ==IB_QPT_XRC_TGT ) { obj->uxrcd = container_of(xrcd_uobj, struct ib_uxrcd_object,
drivers/infiniband/core/verbs.c +2 -1
@@ -1253,7 +1253,6 @@ static struct ib_qp *create_qp(struct ib_device *dev, struct ib_pd *pd,if (ret) goto err_security; -ib_qp_usecnt_inc (qp);rdma_restrack_add (&qp->res);return qp;
@@ -1354,6 +1353,8 @@ struct ib_qp *ib_create_qp_kernel(struct ib_pd *pd,if (IS_ERR (qp))return qp; +ib_qp_usecnt_inc (qp); +if (qp_init_attr->cap.max_rdma_ctxs) { ret =rdma_rw_init_mrs (qp, qp_init_attr);if (ret)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 539/913 RDMA/mlx5: Fix memory leak in error flow for subscribe event routine
In reply to Greg Kroah-HartmanFrom: Yongzhi Liu <[email protected]>
[ Upstream commit 087f9c3f2309ed183f7e4b85ae57121d8663224d ]
In case the second xa_insert() fails, the obj_event is not released. Fix the error unwind flow to free that memory to avoid a memory leak.
--- drivers/infiniband/hw/mlx5/devx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/devx.c +3 -1
@@ -1891,8 +1891,10 @@ subscribe_event_xa_alloc(struct mlx5_devx_event_table *devx_event_table, key_level2, obj_event, GFP_KERNEL); -if (err) +if (err) { +kfree (obj_event);return err; + }INIT_LIST_HEAD (&obj_event->obj_sub_list); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 540/913 bpf, sockmap: Fix memleak in sk_psock_queue_msg
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 938d3480b92fa5e454b7734294f12a7b75126f09 ]
If tcp_bpf_sendmsg is running during a tear down operation we may enqueue data on the ingress msg queue while tear down is trying to free it.
sk1 (redirect sk2) sk2
------------------- ---------------tcp_bpf_sendmsg()
tcp_bpf_send_verdict()
tcp_bpf_sendmsg_redir()
bpf_tcp_ingress()
sock_map_close()
lock_sock()
lock_sock() ... blocking
sk_psock_stop
sk_psock_clear_state(psock, SK_PSOCK_TX_ENABLED);
release_sock(sk);
lock_sock()
sk_mem_charge()
get_page()
sk_psock_queue_msg()
sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED);
drop_sk_msg()
release_sock()While drop_sk_msg(), the msg has charged memory form sk by sk_mem_charge and has sg pages need to put. To fix we use sk_msg_free() and then kfee() msg.
This issue can cause the following info:
WARNING: CPU: 0 PID: 9202 at net/core/stream.c:205 sk_stream_kill_queues+0xc8/0xe0 Call Trace: <IRQ> inet_csk_destroy_sock+0x55/0x110 tcp_rcv_state_process+0xe5f/0xe90 ? sk_filter_trim_cap+0x10d/0x230 ? tcp_v4_do_rcv+0x161/0x250 tcp_v4_do_rcv+0x161/0x250 tcp_v4_rcv+0xc3a/0xce0 ip_protocol_deliver_rcu+0x3d/0x230 ip_local_deliver_finish+0x54/0x60 ip_local_deliver+0xfd/0x110 ? ip_protocol_deliver_rcu+0x230/0x230 ip_rcv+0xd6/0x100 ? ip_local_deliver+0x110/0x110 __netif_receive_skb_one_core+0x85/0xa0 process_backlog+0xa4/0x160 __napi_poll+0x29/0x1b0 net_rx_action+0x287/0x300 __do_softirq+0xff/0x2fc do_softirq+0x79/0x90 </IRQ> WARNING: CPU: 0 PID: 531 at net/ipv4/af_inet.c:154 inet_sock_destruct+0x175/0x1b0 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 ? process_one_work+0x3c0/0x3c0 worker_thread+0x30/0x350 ? process_one_work+0x3c0/0x3c0 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 </TASK>
--- include/linux/skmsg.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
include/linux/skmsg.h +4 -9
@@ -310,21 +310,16 @@ static inline void sock_drop(struct sock *sk, struct sk_buff *skb)kfree_skb (skb); } -static inline void drop_sk_msg (struct sk_psock *psock,struct sk_msg *msg) -{ -if (msg->skb) -sock_drop (psock->sk, msg->skb); -kfree (msg); -} -static inline void sk_psock_queue_msg (struct sk_psock *psock,struct sk_msg *msg) {spin_lock_bh (&psock->ingress_lock);if (sk_psock_test_state (psock,SK_PSOCK_TX_ENABLED ))list_add_tail (&msg->list, &psock->ingress_msg); -else -drop_sk_msg (psock, msg); +else { +sk_msg_free (psock->sk, msg); +kfree (msg); + }spin_unlock_bh (&psock->ingress_lock); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 541/913 bpf, sockmap: Fix memleak in tcp_bpf_sendmsg while sk msg is full
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 9c34e38c4a870eb30b13f42f5b44f42e9d19ccb8 ]
If tcp_bpf_sendmsg() is running while sk msg is full. When sk_msg_alloc() returns -ENOMEM error, tcp_bpf_sendmsg() goes to wait_for_memory. If partial memory has been alloced by sk_msg_alloc(), that is, msg_tx->sg.size is greater than osize after sk_msg_alloc(), memleak occurs. To fix we use sk_msg_trim() to release the allocated memory, then goto wait for memory.
Other call paths of sk_msg_alloc() have the similar issue, such as tls_sw_sendmsg(), so handle sk_msg_trim logic inside sk_msg_alloc(), as Cong Wang suggested.
This issue can cause the following info:
WARNING: CPU: 3 PID: 7950 at net/core/stream.c:208 sk_stream_kill_queues+0xd4/0x1a0 Call Trace: <TASK> inet_csk_destroy_sock+0x55/0x110 __tcp_close+0x279/0x470 tcp_close+0x1f/0x60 inet_release+0x3f/0x80 __sock_release+0x3d/0xb0 sock_close+0x11/0x20 __fput+0x92/0x250 task_work_run+0x6a/0xa0 do_exit+0x33b/0xb60 do_group_exit+0x2f/0xa0 get_signal+0xb6/0x950 arch_do_signal_or_restart+0xac/0x2a0 exit_to_user_mode_prepare+0xa9/0x200 syscall_exit_to_user_mode+0x12/0x30 do_syscall_64+0x46/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae </TASK> WARNING: CPU: 3 PID: 2094 at net/ipv4/af_inet.c:155 inet_sock_destruct+0x13c/0x260 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 kthread+0xe6/0x110 ret_from_fork+0x22/0x30 </TASK>
--- net/core/skmsg.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
net/core/skmsg.c +13 -4
@@ -27,6 +27,7 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, int elem_first_coalesce) {struct page_frag *pfrag =sk_page_frag (sk); +u32 osize = msg->sg.size;int ret =0 ; len -= msg->sg.size;
@@ -35,13 +36,17 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len,u32 orig_offset;int use, i; -if (!sk_page_frag_refill (sk, pfrag)) -return -ENOMEM ; +if (!sk_page_frag_refill (sk, pfrag)) { + ret = -ENOMEM ; + goto msg_trim; + } orig_offset = pfrag->offset; use =min_t (int, len, pfrag->size - orig_offset); -if (!sk_wmem_schedule (sk, use)) -return -ENOMEM ; +if (!sk_wmem_schedule (sk, use)) { + ret = -ENOMEM ; + goto msg_trim; + } i = msg->sg.end;sk_msg_iter_var_prev (i);
@@ -71,6 +76,10 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, }return ret; + +msg_trim: +sk_msg_trim (sk, msg, osize); +return ret; }EXPORT_SYMBOL_GPL (sk_msg_alloc);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 542/913 bpf, sockmap: Fix more uncharged while msg has more_data
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 84472b436e760ba439e1969a9e3c5ae7c86de39d ]
In tcp_bpf_send_verdict(), if msg has more data after tcp_bpf_sendmsg_redir():
tcp_bpf_send_verdict()
tosend = msg->sg.size //msg->sg.size = 22220
case __SK_REDIRECT:
sk_msg_return() //uncharged msg->sg.size(22220) sk->sk_forward_alloc tcp_bpf_sendmsg_redir() //after tcp_bpf_sendmsg_redir, msg->sg.size=11000
goto more_data;
tosend = msg->sg.size //msg->sg.size = 11000
case __SK_REDIRECT:
sk_msg_return() //uncharged msg->sg.size(11000) to sk->sk_forward_alloc
The msg->sg.size(11000) has been uncharged twice, to fix we can charge the remaining msg->sg.size before goto more data.
This issue can cause the following info:
WARNING: CPU: 0 PID: 9860 at net/core/stream.c:208 sk_stream_kill_queues+0xd4/0x1a0 Call Trace: <TASK> inet_csk_destroy_sock+0x55/0x110 __tcp_close+0x279/0x470 tcp_close+0x1f/0x60 inet_release+0x3f/0x80 __sock_release+0x3d/0xb0 sock_close+0x11/0x20 __fput+0x92/0x250 task_work_run+0x6a/0xa0 do_exit+0x33b/0xb60 do_group_exit+0x2f/0xa0 get_signal+0xb6/0x950 arch_do_signal_or_restart+0xac/0x2a0 ? vfs_write+0x237/0x290 exit_to_user_mode_prepare+0xa9/0x200 syscall_exit_to_user_mode+0x12/0x30 do_syscall_64+0x46/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae </TASK> WARNING: CPU: 0 PID: 2136 at net/ipv4/af_inet.c:155 inet_sock_destruct+0x13c/0x260 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 worker_thread+0x30/0x350 ? process_one_work+0x3c0/0x3c0 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 </TASK>
--- net/ipv4/tcp_bpf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/ipv4/tcp_bpf.c +5 -2
@@ -335,7 +335,7 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock, cork = true; psock->cork =NULL ; } -sk_msg_return (sk, msg, tosend); +sk_msg_return (sk, msg, msg->sg.size);release_sock (sk); ret =tcp_bpf_sendmsg_redir (sk_redir, msg, tosend, flags);
@@ -375,8 +375,11 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock, }if (msg && msg->sg.data[msg->sg.start].page_link && - msg->sg.data[msg->sg.start].length) + msg->sg.data[msg->sg.start].length) { +if (eval == __SK_REDIRECT) +sk_mem_charge (sk, msg->sg.size); goto more_data; + } }return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 543/913 bpf, sockmap: Fix double uncharge the mem of sk_msg
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 2486ab434b2c2a14e9237296db00b1e1b7ae3273 ]
If tcp_bpf_sendmsg is running during a tear down operation, psock may be freed.
tcp_bpf_sendmsg()
tcp_bpf_send_verdict()
sk_msg_return()
tcp_bpf_sendmsg_redir()
unlikely(!psock))
sk_msg_free()
The mem of msg has been uncharged in tcp_bpf_send_verdict() by sk_msg_return(), and would be uncharged by sk_msg_free() again. When psock is null, we can simply returning an error code, this would then trigger the sk_msg_free_nocharge in the error path of __SK_REDIRECT and would have the side effect of throwing an error up to user space. This would be a slight change in behavior from user side but would look the same as an error if the redirect on the socket threw an error.
This issue can cause the following info:
WARNING: CPU: 0 PID: 2136 at net/ipv4/af_inet.c:155 inet_sock_destruct+0x13c/0x260 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 worker_thread+0x30/0x350 ? process_one_work+0x3c0/0x3c0 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 </TASK>
--- net/ipv4/tcp_bpf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/ipv4/tcp_bpf.c +3 -4
@@ -138,10 +138,9 @@ int tcp_bpf_sendmsg_redir(struct sock *sk, struct sk_msg *msg,struct sk_psock *psock =sk_psock_get (sk);int ret; -if (unlikely (!psock)) { -sk_msg_free (sk, msg); -return 0 ; - } +if (unlikely (!psock)) +return -EPIPE ; + ret = ingress ?bpf_tcp_ingress (sk, psock, msg, bytes, flags) :tcp_bpf_push_locked (sk, msg, bytes, flags, false);sk_psock_put (sk, psock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 544/913 samples/bpf, xdpsock: Fix race when running for fix duration of time
In reply to Greg Kroah-HartmanFrom: Niklas Söderlund <[email protected]>
[ Upstream commit 8fa42d78f6354bb96ad3a079dcbef528ca9fa9e0 ]
When running xdpsock for a fix duration of time before terminating using --duration=<n>, there is a race condition that may cause xdpsock to terminate immediately.
When running for a fixed duration of time the check to determine when to terminate execution is in is_benchmark_done() and is being executed in the context of the poller thread,
if (opt_duration > 0) {
unsigned long dt = (get_nsecs() - start_time);
if (dt >= opt_duration)
benchmark_done = true;
}However start_time is only set after the poller thread have been created. This leaves a small window when the poller thread is starting and calls is_benchmark_done() for the first time that start_time is not yet set. In that case start_time have its initial value of 0 and the duration check fails as it do not correlate correctly for the applications start time and immediately sets benchmark_done which in turn terminates the xdpsock application.
Fix this by setting start_time before creating the poller thread.
--- samples/bpf/xdpsock_user.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
samples/bpf/xdpsock_user.c +3 -2
@@ -1673,14 +1673,15 @@ int main(int argc, char **argv)setlocale (LC_ALL ,"" ); + prev_time =get_nsecs (); + start_time = prev_time; +if (!opt_quiet) { ret =pthread_create (&pt,NULL , poller,NULL );if (ret)exit_with_error (ret); } - prev_time =get_nsecs (); - start_time = prev_time;if (opt_bench ==BENCH_RXDROP )rx_drop_all ();
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 545/913 USB: storage: ums-realtek: fix error code in rts51x_read_mem()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b07cabb8361dc692522538205552b1b9dab134be ]
The rts51x_read_mem() function should return negative error codes. Currently if the kmalloc() fails it returns USB_STOR_TRANSPORT_ERROR (3) which is treated as success by the callers.
--- drivers/usb/storage/realtek_cr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/realtek_cr.c +1 -1
@@ -365,7 +365,7 @@ static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len) buf =kmalloc (len,GFP_NOIO );if (buf ==NULL ) -return USB_STOR_TRANSPORT_ERROR ; +return -ENOMEM ;usb_stor_dbg (us,"addr = 0x%x, len = %d\n" , addr, len);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 546/913 drm/i915/display: Fix HPD short pulse handling for eDP
In reply to Greg Kroah-HartmanFrom: José Roberto de Souza <[email protected]>
[ Upstream commit 3a84fd1ed53582b31e843a152ee3219e9e4ccb8c ]
Commit 13ea6db2cf24 ("drm/i915/edp: Ignore short pulse when panel powered off") completely broke short pulse handling for eDP as it is usually generated by sink when it is displaying image and there is some error or status that source needs to handle.
When power panel is enabled, this state is enough to power aux transactions and VDD override is disabled, so intel_pps_have_power() is always returning false causing short pulses to be ignored.
So here better naming this function that intends to check if aux lines are powered to avoid the endless cycle mentioned in the commit being fixed and fixing the check for what it is intended.
v2:
- renamed to intel_pps_have_panel_power_or_vdd()
- fixed indentation
--- drivers/gpu/drm/i915/display/intel_dp.c | 2 +- drivers/gpu/drm/i915/display/intel_pps.c | 6 +++--- drivers/gpu/drm/i915/display/intel_pps.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +1 -1
@@ -4599,7 +4599,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *dig_port, bool long_hpd)struct intel_dp *intel_dp = &dig_port->dp;if (dig_port->base.type ==INTEL_OUTPUT_EDP && - (long_hpd || !intel_pps_have_power (intel_dp))) { + (long_hpd || !intel_pps_have_panel_power_or_vdd (intel_dp))) {/* * vdd off can generate a long/short pulse on eDP which * would require vdd on to handle it, and thus we
drivers/gpu/drm/i915/display/intel_pps.c +3 -3
@@ -1074,14 +1074,14 @@ static void intel_pps_vdd_sanitize(struct intel_dp *intel_dp)edp_panel_vdd_schedule_off (intel_dp); } -bool intel_pps_have_power (struct intel_dp *intel_dp) +bool intel_pps_have_panel_power_or_vdd (struct intel_dp *intel_dp) {intel_wakeref_t wakeref;bool have_power = false; with_intel_pps_lock(intel_dp, wakeref) { - have_power =edp_have_panel_power (intel_dp) && -edp_have_panel_vdd (intel_dp); + have_power =edp_have_panel_power (intel_dp) || +edp_have_panel_vdd (intel_dp); }return have_power;
drivers/gpu/drm/i915/display/intel_pps.h +1 -1
@@ -36,7 +36,7 @@ void intel_pps_vdd_on(struct intel_dp *intel_dp);void intel_pps_on (struct intel_dp *intel_dp);void intel_pps_off (struct intel_dp *intel_dp);void intel_pps_vdd_off_sync (struct intel_dp *intel_dp); -bool intel_pps_have_power (struct intel_dp *intel_dp); +bool intel_pps_have_panel_power_or_vdd (struct intel_dp *intel_dp);void intel_pps_wait_power_cycle (struct intel_dp *intel_dp);void intel_pps_init (struct intel_dp *intel_dp);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 547/913 netfilter: flowtable: Fix QinQ and pppoe support for inet table
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 0492d857636e1c52cd71594a723c4b26a7b31978 ]
nf_flow_offload_inet_hook() does not check for 802.1q and PPPoE. Fetch inner ethertype from these encapsulation protocols.
--- include/net/netfilter/nf_flow_table.h | 18 ++++++++++++++++++ net/netfilter/nf_flow_table_inet.c | 17 +++++++++++++++++ net/netfilter/nf_flow_table_ip.c | 18 ------------------ 3 files changed, 35 insertions(+), 18 deletions(-)
include/net/netfilter/nf_flow_table.h +18 -0
@@ -10,6 +10,8 @@#include <linux/netfilter/nf_conntrack_tuple_common.h> #include <net/flow_offload.h> #include <net/dst.h> +#include <linux/if_pppox.h> +#include <linux/ppp_defs.h> struct nf_flowtable ;struct nf_flow_rule ;
@@ -313,4 +315,20 @@ int nf_flow_rule_route_ipv6(struct net *net, const struct flow_offload *flow,int nf_flow_table_offload_init (void );void nf_flow_table_offload_exit (void ); +static inline __be16 nf_flow_pppoe_proto (const struct sk_buff *skb) +{ +__be16 proto; + + proto = *((__be16 *)(skb_mac_header (skb) +ETH_HLEN + +sizeof (struct pppoe_hdr ))); +switch (proto) { +case htons (PPP_IP ): +return htons (ETH_P_IP ); +case htons (PPP_IPV6 ): +return htons (ETH_P_IPV6 ); + } + +return 0 ; +} +#endif /* _NF_FLOW_TABLE_H */
net/netfilter/nf_flow_table_inet.c +17 -0
@@ -6,12 +6,29 @@#include <linux/rhashtable.h> #include <net/netfilter/nf_flow_table.h> #include <net/netfilter/nf_tables.h> +#include <linux/if_vlan.h> static unsigned int nf_flow_offload_inet_hook (void *priv,struct sk_buff *skb,const struct nf_hook_state *state) { +struct vlan_ethhdr *veth; +__be16 proto; +switch (skb->protocol) { +case htons (ETH_P_8021Q ): + veth = (struct vlan_ethhdr *)skb_mac_header (skb); + proto = veth->h_vlan_encapsulated_proto; +break ; +case htons (ETH_P_PPP_SES ): + proto =nf_flow_pppoe_proto (skb); +break ; +default : + proto = skb->protocol; +break ; + } + +switch (proto) {case htons (ETH_P_IP ):return nf_flow_offload_ip_hook (priv, skb, state);case htons (ETH_P_IPV6 ):
net/netfilter/nf_flow_table_ip.c +0 -18
@@ -8,8 +8,6 @@#include <linux/ipv6.h> #include <linux/netdevice.h> #include <linux/if_ether.h> -#include <linux/if_pppox.h> -#include <linux/ppp_defs.h> #include <net/ip.h> #include <net/ipv6.h> #include <net/ip6_route.h>
@@ -239,22 +237,6 @@ static unsigned int nf_flow_xmit_xfrm(struct sk_buff *skb,return NF_STOLEN ; } -static inline __be16 nf_flow_pppoe_proto (const struct sk_buff *skb) -{ -__be16 proto; - - proto = *((__be16 *)(skb_mac_header (skb) +ETH_HLEN + -sizeof (struct pppoe_hdr ))); -switch (proto) { -case htons (PPP_IP ): -return htons (ETH_P_IP ); -case htons (PPP_IPV6 ): -return htons (ETH_P_IPV6 ); - } - -return 0 ; -} -static bool nf_flow_skb_encap_protocol (const struct sk_buff *skb,__be16 proto,u32 *offset) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 548/913 mt76: mt7921: fix mt7921_queues_acq implementation
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 849ee6ac9dd3efd0a57cbc98b9a9d6ae87374aff ]
Fix mt7921_queues_acq implementation according to the vendor sdk.
--- drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 13 ++++++------- drivers/net/wireless/mediatek/mt76/mt7921/regs.h | 11 +++++------ 2 files changed, 11 insertions(+), 13 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +6 -7
@@ -130,23 +130,22 @@ mt7921_queues_acq(struct seq_file *s, void *data)mt7921_mutex_acquire (dev); -for (i =0 ; i <16 ; i++) { -int j, acs = i /4 , index = i %4 ; +for (i =0 ; i <4 ; i++) {u32 ctrl, val, qlen =0 ; +int j; - val =mt76_rr (dev,MT_PLE_AC_QEMPTY (acs, index)); - ctrl =BIT (31 ) |BIT (15 ) | (acs <<8 ); + val =mt76_rr (dev,MT_PLE_AC_QEMPTY (i)); + ctrl =BIT (31 ) |BIT (11 ) | (i <<24 );for (j =0 ; j <32 ; j++) {if (val &BIT (j))continue ; -mt76_wr (dev,MT_PLE_FL_Q0_CTRL , - ctrl | (j + (index <<5 ))); +mt76_wr (dev,MT_PLE_FL_Q0_CTRL , ctrl | j); qlen +=mt76_get_field (dev,MT_PLE_FL_Q3_CTRL ,GENMASK (11 ,0 )); } -seq_printf (s,"AC%d%d: queued=%d\n" , acs, index, qlen); +seq_printf (s,"AC%d: queued=%d\n" , i, qlen); }mt7921_mutex_release (dev);
drivers/net/wireless/mediatek/mt76/mt7921/regs.h +5 -6
@@ -17,13 +17,12 @@#define MT_PLE_BASE 0x8000#define MT_PLE (ofs) (MT_PLE_BASE + (ofs)) -#define MT_PLE_FL_Q0_CTRL MT_PLE(0x1b0) -#define MT_PLE_FL_Q1_CTRL MT_PLE(0x1b4) -#define MT_PLE_FL_Q2_CTRL MT_PLE(0x1b8) -#define MT_PLE_FL_Q3_CTRL MT_PLE(0x1bc) +#define MT_PLE_FL_Q0_CTRL MT_PLE(0x3e0) +#define MT_PLE_FL_Q1_CTRL MT_PLE(0x3e4) +#define MT_PLE_FL_Q2_CTRL MT_PLE(0x3e8) +#define MT_PLE_FL_Q3_CTRL MT_PLE(0x3ec) -#define MT_PLE_AC_QEMPTY (ac, n) MT_PLE(0x300 + 0x10 * (ac) + \ - ((n) << 2)) +#define MT_PLE_AC_QEMPTY (_n) MT_PLE(0x500 + 0x40 * (_n))#define MT_PLE_AMSDU_PACK_MSDU_CNT (n) MT_PLE(0x10e0 + ((n) << 2))#define MT_MDP_BASE 0xf000
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 549/913 can: isotp: sanitize CAN ID checks in isotp_bind()
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
commit 3ea566422cbde9610c2734980d1286ab681bb40e upstream.
Syzbot created an environment that lead to a state machine status that can not be reached with a compliant CAN ID address configuration. The provided address information consisted of CAN ID 0x6000001 and 0xC28001 which both boil down to 11 bit CAN IDs 0x001 in sending and receiving.
Sanitize the SFF/EFF CAN ID values before performing the address checks.
--- net/can/isotp.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-)
net/can/isotp.c +20 -18
@@ -1104,6 +1104,7 @@ static int isotp_bind(struct socket *socstruct net *net =sock_net (sk);int ifindex;struct net_device *dev; +canid_t tx_id, rx_id;int err =0 ;int notify_enetdown =0 ;int do_rx_reg =1 ;
@@ -1111,8 +1112,18 @@ static int isotp_bind(struct socket *socif (len <ISOTP_MIN_NAMELEN )return -EINVAL ; -if (addr->can_addr.tp.tx_id & (CAN_ERR_FLAG |CAN_RTR_FLAG )) -return -EADDRNOTAVAIL ; +/* sanitize tx/rx CAN identifiers */ + tx_id = addr->can_addr.tp.tx_id; +if (tx_id &CAN_EFF_FLAG ) + tx_id &= (CAN_EFF_FLAG |CAN_EFF_MASK ); +else + tx_id &=CAN_SFF_MASK ; + + rx_id = addr->can_addr.tp.rx_id; +if (rx_id &CAN_EFF_FLAG ) + rx_id &= (CAN_EFF_FLAG |CAN_EFF_MASK ); +else + rx_id &=CAN_SFF_MASK ;if (!addr->can_ifindex)return -ENODEV ;
@@ -1124,21 +1135,13 @@ static int isotp_bind(struct socket *soc do_rx_reg =0 ;/* do not validate rx address for functional addressing */ -if (do_rx_reg) { -if (addr->can_addr.tp.rx_id == addr->can_addr.tp.tx_id) { - err = -EADDRNOTAVAIL ; - goto out; - } - -if (addr->can_addr.tp.rx_id & (CAN_ERR_FLAG |CAN_RTR_FLAG )) { - err = -EADDRNOTAVAIL ; - goto out; - } +if (do_rx_reg && rx_id == tx_id) { + err = -EADDRNOTAVAIL ; + goto out; }if (so->bound && addr->can_ifindex == so->ifindex && - addr->can_addr.tp.rx_id == so->rxid && - addr->can_addr.tp.tx_id == so->txid) + rx_id == so->rxid && tx_id == so->txid) goto out; dev =dev_get_by_index (net, addr->can_ifindex);
@@ -1162,8 +1165,7 @@ static int isotp_bind(struct socket *soc ifindex = dev->ifindex;if (do_rx_reg) -can_rx_register (net, dev, addr->can_addr.tp.rx_id, -SINGLE_MASK (addr->can_addr.tp.rx_id), +can_rx_register (net, dev, rx_id,SINGLE_MASK (rx_id), isotp_rcv, sk,"isotp" , sk);dev_put (dev);
@@ -1183,8 +1185,8 @@ static int isotp_bind(struct socket *soc/* switch to new settings */ so->ifindex = ifindex; - so->rxid = addr->can_addr.tp.rx_id; - so->txid = addr->can_addr.tp.tx_id; + so->rxid = rx_id; + so->txid = tx_id; so->bound =1 ; out:
Greg Kroah-Hartman
maintainerPATCH 550/913 can: isotp: return -EADDRNOTAVAIL when reading from unbound socket
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit 30ffd5332e06316bd69a654c06aa033872979b7c ]
When reading from an unbound can-isotp socket the syscall blocked indefinitely. As unbound sockets (without given CAN address information) do not make sense anyway we directly return -EADDRNOTAVAIL on read() analogue to the known behavior from sendmsg().
--- net/can/isotp.c | 4 ++++ 1 file changed, 4 insertions(+)
net/can/isotp.c +4 -0
@@ -1005,12 +1005,16 @@ static int isotp_recvmsg(struct socket * {struct sock *sk = sock->sk;struct sk_buff *skb; +struct isotp_sock *so =isotp_sk (sk);int err =0 ;int noblock; noblock = flags &MSG_DONTWAIT ; flags &= ~MSG_DONTWAIT ; +if (!so->bound) +return -EADDRNOTAVAIL ; + skb =skb_recv_datagram (sk, flags, noblock, &err);if (!skb)return err;
Greg Kroah-Hartman
maintainerPATCH 551/913 can: isotp: support MSG_TRUNC flag when reading from socket
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit 42bf50a1795a1854d48717b7361dbdbce496b16b ]
When providing the MSG_TRUNC flag via recvmsg() syscall the return value provides the real length of the packet or datagram, even when it was longer than the passed buffer.
--- net/can/isotp.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
net/can/isotp.c +15 -12
@@ -1006,29 +1006,28 @@ static int isotp_recvmsg(struct socket *struct sock *sk = sock->sk;struct sk_buff *skb;struct isotp_sock *so =isotp_sk (sk); -int err =0 ; -int noblock; +int noblock = flags &MSG_DONTWAIT ; +int ret =0 ; - noblock = flags &MSG_DONTWAIT ; - flags &= ~MSG_DONTWAIT ; +if (flags & ~(MSG_DONTWAIT |MSG_TRUNC )) +return -EINVAL ;if (!so->bound)return -EADDRNOTAVAIL ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags &= ~MSG_DONTWAIT ; + skb =skb_recv_datagram (sk, flags, noblock, &ret);if (!skb) -return err; +return ret;if (size < skb->len) msg->msg_flags |=MSG_TRUNC ;else size = skb->len; - err =memcpy_to_msg (msg, skb->data, size); -if (err <0 ) { -skb_free_datagram (sk, skb); -return err; - } + ret =memcpy_to_msg (msg, skb->data, size); +if (ret <0 ) + goto out_err;sock_recv_timestamp (msg, sk, skb);
@@ -1038,9 +1037,13 @@ static int isotp_recvmsg(struct socket *memcpy (msg->msg_name, skb->cb, msg->msg_namelen); } +/* set length of return value */ + ret = (flags &MSG_TRUNC ) ? skb->len : size; + +out_err:skb_free_datagram (sk, skb); -return size; +return ret; }static int isotp_release (struct socket *sock)
Greg Kroah-Hartman
maintainerPATCH 552/913 bareudp: use ipv6_mod_enabled to check if IPv6 enabled
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit e077ed58c243afc197bc2a2ba0e1ff61135e4ec2 ]
bareudp_create_sock() use AF_INET6 by default if IPv6 CONFIG enabled. But if user start kernel with ipv6.disable=1, the bareudp sock will created failed, which cause the interface open failed even with ethertype ip. e.g.
# ip link add bareudp1 type bareudp dstport 2 ethertype ip # ip link set bareudp1 up RTNETLINK answers: Address family not supported by protocol
Fix it by using ipv6_mod_enabled() to check if IPv6 enabled. There is no need to check IS_ENABLED(CONFIG_IPV6) as ipv6_mod_enabled() will return false when CONFIG_IPV6 no enabled in include/linux/ipv6.h.
--- drivers/net/bareudp.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/net/bareudp.c +10 -9
@@ -141,14 +141,14 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)skb_reset_network_header (skb);skb_reset_mac_header (skb); -if (!IS_ENABLED (CONFIG_IPV6 ) || family ==AF_INET ) +if (!ipv6_mod_enabled () || family ==AF_INET ) err =IP_ECN_decapsulate (oiph, skb);else err =IP6_ECN_decapsulate (oiph, skb);if (unlikely (err)) {if (log_ecn_error) { -if (!IS_ENABLED (CONFIG_IPV6 ) || family ==AF_INET ) +if (!ipv6_mod_enabled () || family ==AF_INET ) net_info_ratelimited("non-ECT from %pI4 " "with TOS=%#x\n", &((struct iphdr *)oiph)->saddr,
@@ -214,11 +214,12 @@ static struct socket *bareudp_create_sock(struct net *net, __be16 port)int err;memset (&udp_conf,0 ,sizeof (udp_conf)); -#if IS_ENABLED (CONFIG_IPV6 ) - udp_conf.family =AF_INET6 ; -#else - udp_conf.family =AF_INET ; -#endif + +if (ipv6_mod_enabled ()) + udp_conf.family =AF_INET6 ; +else + udp_conf.family =AF_INET ; + udp_conf.local_udp_port = port;/* Open UDP socket */ err =udp_sock_create (net, &udp_conf, &sock);
@@ -441,7 +442,7 @@ static netdev_tx_t bareudp_xmit(struct sk_buff *skb, struct net_device *dev) }rcu_read_lock (); -if (IS_ENABLED (CONFIG_IPV6 ) && info->mode &IP_TUNNEL_INFO_IPV6 ) +if (ipv6_mod_enabled () && info->mode &IP_TUNNEL_INFO_IPV6 ) err =bareudp6_xmit_skb (skb, dev, bareudp, info);else err =bareudp_xmit_skb (skb, dev, bareudp, info);
@@ -471,7 +472,7 @@ static int bareudp_fill_metadata_dst(struct net_device *dev, use_cache =ip_tunnel_dst_cache_usable (skb, info); -if (!IS_ENABLED (CONFIG_IPV6 ) ||ip_tunnel_info_af (info) ==AF_INET ) { +if (!ipv6_mod_enabled () ||ip_tunnel_info_af (info) ==AF_INET ) {struct rtable *rt;__be32 saddr;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 553/913 ibmvnic: fix race between xmit and reset
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
[ Upstream commit 4219196d1f662cb10a462eb9e076633a3fc31a15 ]
There is a race between reset and the transmit paths that can lead to ibmvnic_xmit() accessing an scrq after it has been freed in the reset path. It can result in a crash like:
Kernel attempted to read user page (0) - exploit attempt? (uid: 0) BUG: Kernel NULL pointer dereference on read at 0x00000000 Faulting instruction address: 0xc0080000016189f8 Oops: Kernel access of bad area, sig: 11 [#1] ... NIP [c0080000016189f8] ibmvnic_xmit+0x60/0xb60 [ibmvnic] LR [c000000000c0046c] dev_hard_start_xmit+0x11c/0x280 Call Trace: [c008000001618f08] ibmvnic_xmit+0x570/0xb60 [ibmvnic] (unreliable) [c000000000c0046c] dev_hard_start_xmit+0x11c/0x280 [c000000000c9cfcc] sch_direct_xmit+0xec/0x330 [c000000000bfe640] __dev_xmit_skb+0x3a0/0x9d0 [c000000000c00ad4] __dev_queue_xmit+0x394/0x730 [c008000002db813c] __bond_start_xmit+0x254/0x450 [bonding] [c008000002db8378] bond_start_xmit+0x40/0xc0 [bonding] [c000000000c0046c] dev_hard_start_xmit+0x11c/0x280 [c000000000c00ca4] __dev_queue_xmit+0x564/0x730 [c000000000cf97e0] neigh_hh_output+0xd0/0x180 [c000000000cfa69c] ip_finish_output2+0x31c/0x5c0 [c000000000cfd244] __ip_queue_xmit+0x194/0x4f0 [c000000000d2a3c4] __tcp_transmit_skb+0x434/0x9b0 [c000000000d2d1e0] __tcp_retransmit_skb+0x1d0/0x6a0 [c000000000d2d984] tcp_retransmit_skb+0x34/0x130 [c000000000d310e8] tcp_retransmit_timer+0x388/0x6d0 [c000000000d315ec] tcp_write_timer_handler+0x1bc/0x330 [c000000000d317bc] tcp_write_timer+0x5c/0x200 [c000000000243270] call_timer_fn+0x50/0x1c0 [c000000000243704] __run_timers.part.0+0x324/0x460 [c000000000243894] run_timer_softirq+0x54/0xa0 [c000000000ea713c] __do_softirq+0x15c/0x3e0 [c000000000166258] __irq_exit_rcu+0x158/0x190 [c000000000166420] irq_exit+0x20/0x40 [c00000000002853c] timer_interrupt+0x14c/0x2b0 [c000000000009a00] decrementer_common_virt+0x210/0x220 --- interrupt: 900 at plpar_hcall_norets_notrace+0x18/0x2c
The immediate cause of the crash is the access of tx_scrq in the following snippet during a reset, where the tx_scrq can be either NULL or an address that will soon be invalid:
ibmvnic_xmit()
{
...
tx_scrq = adapter->tx_scrq[queue_num];
txq = netdev_get_tx_queue(netdev, queue_num);
ind_bufp = &tx_scrq->ind_buf;
if (test_bit(0, &adapter->resetting)) {
...
}But beyond that, the call to ibmvnic_xmit() itself is not safe during a reset and the reset path attempts to avoid this by stopping the queue in ibmvnic_cleanup(). However just after the queue was stopped, an in-flight ibmvnic_complete_tx() could have restarted the queue even as the reset is progressing.
Since the queue was restarted we could get a call to ibmvnic_xmit() which can then access the bad tx_scrq (or other fields).
We cannot however simply have ibmvnic_complete_tx() check the ->resetting bit and skip starting the queue. This can race at the "back-end" of a good reset which just restarted the queue but has not cleared the ->resetting bit yet. If we skip restarting the queue due to ->resetting being true, the queue would remain stopped indefinitely potentially leading to transmit timeouts.
IOW ->resetting is too broad for this purpose. Instead use a new flag that indicates whether or not the queues are active. Only the open/ reset paths control when the queues are active. ibmvnic_complete_tx() and others wake up the queue only if the queue is marked active.
So we will have:
A. reset/open thread in ibmvnic_cleanup() and __ibmvnic_open() ->resetting = true ->tx_queues_active = false disable tx queues ... ->tx_queues_active = true start tx queues B. Tx interrupt in ibmvnic_complete_tx(): if (->tx_queues_active) netif_wake_subqueue();
To ensure that ->tx_queues_active and state of the queues are consistent, we need a lock which:
- must also be taken in the interrupt path (ibmvnic_complete_tx())
- shared across the multiple queues in the adapter (so they don't become serialized)
Use rcu_read_lock() and have the reset thread synchronize_rcu() after updating the ->tx_queues_active state.
While here, consolidate a few boolean fields in ibmvnic_adapter for better alignment.
Based on discussions with Brian King and Dany Madden.
--- drivers/net/ethernet/ibm/ibmvnic.c | 63 ++++++++++++++++++++++++------ drivers/net/ethernet/ibm/ibmvnic.h | 7 +++- 2 files changed, 55 insertions(+), 15 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +50 -13
@@ -1250,6 +1250,15 @@ static int __ibmvnic_open(struct net_device *netdev)return rc; } + adapter->tx_queues_active = true; + +/* Since queues were stopped until now, there shouldn't be any +* one in ibmvnic_complete_tx() or ibmvnic_xmit() so maybe we +* don't need the synchronize_rcu()? Leaving it for consistency +* with setting ->tx_queues_active = false. +*/ +synchronize_rcu (); +netif_tx_start_all_queues (netdev);if (prev_state ==VNIC_CLOSED ) {
@@ -1422,6 +1431,14 @@ static void ibmvnic_cleanup(struct net_device *netdev)struct ibmvnic_adapter *adapter =netdev_priv (netdev);/* ensure that transmissions are stopped if called by do_reset */ + + adapter->tx_queues_active = false; + +/* Ensure complete_tx() and ibmvnic_xmit() see ->tx_queues_active +* update so they don't restart a queue after we stop it below. +*/ +synchronize_rcu (); +if (test_bit (0 , &adapter->resetting))netif_tx_disable (netdev);else
@@ -1662,14 +1679,21 @@ static void ibmvnic_tx_scrq_clean_buffer(struct ibmvnic_adapter *adapter, tx_buff->skb =NULL ; adapter->netdev->stats.tx_dropped++; } + ind_bufp->index =0 ; +if (atomic_sub_return (entries, &tx_scrq->used) <= (adapter->req_tx_entries_per_subcrq /2 ) && -__netif_subqueue_stopped (adapter->netdev, queue_num) && - !test_bit (0 , &adapter->resetting)) { -netif_wake_subqueue (adapter->netdev, queue_num); -netdev_dbg (adapter->netdev,"Started queue %d\n" , - queue_num); +__netif_subqueue_stopped (adapter->netdev, queue_num)) { +rcu_read_lock (); + +if (adapter->tx_queues_active) { +netif_wake_subqueue (adapter->netdev, queue_num); +netdev_dbg (adapter->netdev,"Started queue %d\n" , + queue_num); + } + +rcu_read_unlock (); } }
@@ -1724,11 +1748,12 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)int index =0 ;u8 proto =0 ; - tx_scrq = adapter->tx_scrq[queue_num]; - txq =netdev_get_tx_queue (netdev, queue_num); - ind_bufp = &tx_scrq->ind_buf; - -if (test_bit (0 , &adapter->resetting)) { +/* If a reset is in progress, drop the packet since +* the scrqs may get torn down. Otherwise use the +* rcu to ensure reset waits for us to complete. +*/ +rcu_read_lock (); +if (!adapter->tx_queues_active) {dev_kfree_skb_any (skb); tx_send_failed++;
@@ -1737,6 +1762,10 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) goto out; } + tx_scrq = adapter->tx_scrq[queue_num]; + txq =netdev_get_tx_queue (netdev, queue_num); + ind_bufp = &tx_scrq->ind_buf; +if (ibmvnic_xmit_workarounds (skb, netdev)) { tx_dropped++; tx_send_failed++;
@@ -1744,6 +1773,7 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)ibmvnic_tx_scrq_flush (adapter, tx_scrq); goto out; } +if (skb_is_gso (skb)) tx_pool = &adapter->tso_pool[queue_num];else
@@ -1898,6 +1928,7 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)netif_carrier_off (netdev); } out: +rcu_read_unlock (); netdev->stats.tx_dropped += tx_dropped; netdev->stats.tx_bytes += tx_bytes; netdev->stats.tx_packets += tx_packets;
@@ -3482,9 +3513,15 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter, (adapter->req_tx_entries_per_subcrq / 2) && __netif_subqueue_stopped(adapter->netdev, scrq->pool_index)) { -netif_wake_subqueue (adapter->netdev, scrq->pool_index); -netdev_dbg (adapter->netdev,"Started queue %d\n" , - scrq->pool_index); +rcu_read_lock (); +if (adapter->tx_queues_active) { +netif_wake_subqueue (adapter->netdev, + scrq->pool_index); +netdev_dbg (adapter->netdev, +"Started queue %d\n" , + scrq->pool_index); + } +rcu_read_unlock (); } }
drivers/net/ethernet/ibm/ibmvnic.h +5 -2
@@ -1002,11 +1002,14 @@ struct ibmvnic_adapter {struct work_struct ibmvnic_reset;struct delayed_work ibmvnic_delayed_reset;unsigned long resetting; -bool napi_enabled, from_passive_init; -bool login_pending;/* last device reset time */ unsigned long last_reset_time; +bool napi_enabled; +bool from_passive_init; +bool login_pending; +/* protected by rcu */ +bool tx_queues_active;bool failover_pending;bool force_reset_recovery;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 554/913 af_unix: Fix some data-races around unix_sk(sk)->oob_skb.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit e82025c623e2bf04d162bafceb66a59115814479 ]
Out-of-band data automatically places a "mark" showing wherein the sequence the out-of-band data would have been. If the out-of-band data implies cancelling everything sent so far, the "mark" is helpful to flush them. When the socket's read pointer reaches the "mark", the ioctl() below sets a non zero value to the arg atmark:
The out-of-band data is queued in sk->sk_receive_queue as well as ordinary data and also saved in unix_sk(sk)->oob_skb. It can be used to test if the head of the receive queue is the out-of-band data meaning the socket is at the "mark".
While testing that, unix_ioctl() reads unix_sk(sk)->oob_skb locklessly. Thus, all accesses to oob_skb need some basic protection to avoid load/store tearing which KCSAN detects when these are called concurrently:
- ioctl(fd_a, SIOCATMARK, &atmark, sizeof(atmark))
- send(fd_b_connected_to_a, buf, sizeof(buf), MSG_OOB)
BUG: KCSAN: data-race in unix_ioctl / unix_stream_sendmsg
write to 0xffff888003d9cff0 of 8 bytes by task 175 on cpu 1:
unix_stream_sendmsg (net/unix/af_unix.c:2087 net/unix/af_unix.c:2191) sock_sendmsg (net/socket.c:705 net/socket.c:725) __sys_sendto (net/socket.c:2040) __x64_sys_sendto (net/socket.c:2048) do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:113)
read to 0xffff888003d9cff0 of 8 bytes by task 176 on cpu 0:
unix_ioctl (net/unix/af_unix.c:3101 (discriminator 1)) sock_do_ioctl (net/socket.c:1128) sock_ioctl (net/socket.c:1242) __x64_sys_ioctl (fs/ioctl.c:52 fs/ioctl.c:874 fs/ioctl.c:860 fs/ioctl.c:860) do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:113)
value changed: 0xffff888003da0c00 -> 0xffff888003da0d00
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 176 Comm: unix_race_oob_i Not tainted 5.17.0-rc5-59529-g83dc4c2af682 #12 Hardware name: Red Hat KVM, BIOS 1.11.0-2.amzn2 04/01/2014
--- net/unix/af_unix.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
net/unix/af_unix.c +5 -7
@@ -1996,7 +1996,7 @@ static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *otherif (ousk->oob_skb)consume_skb (ousk->oob_skb); - ousk->oob_skb = skb; +WRITE_ONCE (ousk->oob_skb, skb);scm_stat_add (other, skb);skb_queue_tail (&other->sk_receive_queue, skb);
@@ -2514,9 +2514,8 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state) oob_skb = u->oob_skb; -if (!(state->flags &MSG_PEEK )) { - u->oob_skb =NULL ; - } +if (!(state->flags &MSG_PEEK )) +WRITE_ONCE (u->oob_skb,NULL );unix_state_unlock (sk);
@@ -2551,7 +2550,7 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk, skb =NULL ; }else if (sock_flag (sk,SOCK_URGINLINE )) {if (!(flags &MSG_PEEK )) { - u->oob_skb =NULL ; +WRITE_ONCE (u->oob_skb,NULL );consume_skb (skb); } }else if (!(flags &MSG_PEEK )) {
@@ -3006,11 +3005,10 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)case SIOCATMARK : {struct sk_buff *skb; -struct unix_sock *u =unix_sk (sk);int answ =0 ; skb =skb_peek (&sk->sk_receive_queue); -if (skb && skb == u->oob_skb) +if (skb && skb ==READ_ONCE (unix_sk (sk)->oob_skb)) answ =1 ; err =put_user (answ, (int __user *)arg); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 555/913 selftests/bpf: Fix error reporting from sock_fields programs
In reply to Greg Kroah-HartmanFrom: Jakub Sitnicki <[email protected]>
[ Upstream commit a4c9fe0ed4a13e25e43fcd44d9f89bc19ba8fbb7 ]
The helper macro that records an error in BPF programs that exercise sock fields access has been inadvertently broken by adaptation work that happened in commit b18c1f0aa477 ("bpf: selftest: Adapt sock_fields test to use skel and global variables").
BPF_NOEXIST flag cannot be used to update BPF_MAP_TYPE_ARRAY. The operation always fails with -EEXIST, which in turn means the error never gets recorded, and the checks for errors always pass.
Revert the change in update flags.
--- tools/testing/selftests/bpf/progs/test_sock_fields.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/test_sock_fields.c +1 -1
@@ -113,7 +113,7 @@ static void tpcpy(struct bpf_tcp_sock *dst,#define RET_LOG () ({ \ linum = __LINE__; \ - bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_NOEXIST); \ + bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_ANY); \ return CG_OK; \ })
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 556/913 Bluetooth: hci_uart: add missing NULL check in h5_enqueue
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 32cb08e958696908a9aad5e49a78d74f7e32fffb ]
Syzbot hit general protection fault in __pm_runtime_resume(). The problem was in missing NULL check.
hu->serdev can be NULL and we should not blindly pass &serdev->dev somewhere, since it will cause GPF.
--- drivers/bluetooth/hci_h5.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_h5.c +5 -3
@@ -629,9 +629,11 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)break ; } -pm_runtime_get_sync (&hu->serdev->dev); -pm_runtime_mark_last_busy (&hu->serdev->dev); -pm_runtime_put_autosuspend (&hu->serdev->dev); +if (hu->serdev) { +pm_runtime_get_sync (&hu->serdev->dev); +pm_runtime_mark_last_busy (&hu->serdev->dev); +pm_runtime_put_autosuspend (&hu->serdev->dev); + }return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 557/913 Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed
In reply to Greg Kroah-HartmanFrom: Niels Dossche <[email protected]>
[ Upstream commit 9fa6b4cda3b414e990f008f45f9bcecbcb54d4d1 ]
hci_le_conn_failed function's documentation says that the caller must hold hdev->lock. The only callsite that does not hold that lock is hci_le_conn_failed. The other 3 callsites hold the hdev->lock very locally. The solution is to hold the lock during the call to hci_le_conn_failed.
--- net/bluetooth/hci_conn.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/hci_conn.c +2 -0
@@ -541,7 +541,9 @@ static void le_conn_timeout(struct work_struct *work)if (conn->role ==HCI_ROLE_SLAVE ) {/* Disable LE Advertising */ le_disable_advertising (hdev); +hci_dev_lock (hdev);hci_le_conn_failed (conn,HCI_ERROR_ADVERTISING_TIMEOUT ); +hci_dev_unlock (hdev);return ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 558/913 Bluetooth: btmtksdio: Fix kernel oops in btmtksdio_interrupt
In reply to Greg Kroah-HartmanFrom: Yake Yang <[email protected]>
[ Upstream commit b062a0b9c1dc1ff63094337dccfe1568d5b62023 ]
Fix the following kernel oops in btmtksdio_interrrupt
[ 14.339134] btmtksdio_interrupt+0x28/0x54 [ 14.339139] process_sdio_pending_irqs+0x68/0x1a0 [ 14.339144] sdio_irq_work+0x40/0x70 [ 14.339154] process_one_work+0x184/0x39c [ 14.339160] worker_thread+0x228/0x3e8 [ 14.339168] kthread+0x148/0x3ac [ 14.339176] ret_from_fork+0x10/0x30
That happened because hdev->power_on is already called before sdio_set_drvdata which btmtksdio_interrupt handler relies on is not properly set up.
The details are shown as the below: hci_register_dev would run queue_work(hdev->req_workqueue, &hdev->power_on) as WQ_HIGHPRI workqueue_struct to complete the power-on sequeunce and thus hci_power_on may run before sdio_set_drvdata is done in btmtksdio_probe.
The hci_dev_do_open in hci_power_on would initialize the device and enable the interrupt and thus it is possible that btmtksdio_interrupt is being called right before sdio_set_drvdata is filled out.
When btmtksdio_interrupt is being called and sdio_set_drvdata is not filled , the kernel oops is going to happen because btmtksdio_interrupt access an uninitialized pointer.
--- drivers/bluetooth/btmtksdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bluetooth/btmtksdio.c +2 -2
@@ -981,6 +981,8 @@ static int btmtksdio_probe(struct sdio_func *func, hdev->manufacturer =70 ;set_bit (HCI_QUIRK_NON_PERSISTENT_SETUP , &hdev->quirks); +sdio_set_drvdata (func, bdev); + err =hci_register_dev (hdev);if (err <0 ) {dev_err (&func->dev,"Can't register HCI device\n" );
@@ -988,8 +990,6 @@ static int btmtksdio_probe(struct sdio_func *func,return err; } -sdio_set_drvdata (func, bdev); -/* pm_runtime_enable would be done after the firmware is being * downloaded because the core layer probably already enables * runtime PM for this func such as the case host->caps &
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 559/913 ipv4: Fix route lookups when handling ICMP redirects and PMTU updates
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
[ Upstream commit 544b4dd568e3b09c1ab38a759d3187e7abda11a0 ]
The PMTU update and ICMP redirect helper functions initialise their fl4 variable with either __build_flow_key() or build_sk_flow_key(). These initialisation functions always set ->flowi4_scope with RT_SCOPE_UNIVERSE and might set the ECN bits of ->flowi4_tos. This is not a problem when the route lookup is later done via ip_route_output_key_hash(), which properly clears the ECN bits from ->flowi4_tos and initialises ->flowi4_scope based on the RTO_ONLINK flag. However, some helpers call fib_lookup() directly, without sanitising the tos and scope fields, so the route lookup can fail and, as a result, the ICMP redirect or PMTU update aren't taken into account.
Fix this by extracting the ->flowi4_tos and ->flowi4_scope sanitisation code into ip_rt_fix_tos(), then use this function in handlers that call fib_lookup() directly.
Note 1: We can't sanitise ->flowi4_tos and ->flowi4_scope in a central place (like __build_flow_key() or flowi4_init_output()), because ip_route_output_key_hash() expects non-sanitised values. When called with sanitised values, it can erroneously overwrite RT_SCOPE_LINK with RT_SCOPE_UNIVERSE in ->flowi4_scope. Therefore we have to be careful to sanitise the values only for those paths that don't call ip_route_output_key_hash().
Note 2: The problem is mostly about sanitising ->flowi4_tos. Having ->flowi4_scope initialised with RT_SCOPE_UNIVERSE instead of RT_SCOPE_LINK probably wasn't really a problem: sockets with the SOCK_LOCALROUTE flag set (those that'd result in RTO_ONLINK being set) normally shouldn't receive ICMP redirects or PMTU updates.
--- net/ipv4/route.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
net/ipv4/route.c +14 -4
@@ -506,6 +506,15 @@ void __ip_select_ident(struct net *net, struct iphdr *iph, int segs) }EXPORT_SYMBOL (__ip_select_ident); +static void ip_rt_fix_tos (struct flowi4 *fl4) +{ +__u8 tos =RT_FL_TOS (fl4); + + fl4->flowi4_tos = tos &IPTOS_RT_MASK ; + fl4->flowi4_scope = tos &RTO_ONLINK ? +RT_SCOPE_LINK :RT_SCOPE_UNIVERSE ; +} + static void __build_flow_key(const struct net *net, struct flowi4 *fl4, const struct sock *sk, const struct iphdr *iph,
@@ -831,6 +840,7 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf rt = (struct rtable *) dst;__build_flow_key (net, &fl4, sk, iph, oif, tos, prot, mark,0 ); +ip_rt_fix_tos (&fl4);__ip_do_redirect (rt, skb, &fl4, true); }
@@ -1055,6 +1065,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,struct flowi4 fl4;ip_rt_build_flow_key (&fl4, sk, skb); +ip_rt_fix_tos (&fl4);/* Don't make lookup fail for bridged encapsulations */ if (skb &&netif_is_any_bridge_port (skb->dev))
@@ -1129,6 +1140,8 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) goto out; new = true; + }else { +ip_rt_fix_tos (&fl4); }__ip_rt_update_pmtu ((struct rtable *)xfrm_dst_path (&rt->dst), &fl4, mtu);
@@ -2609,7 +2622,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,struct rtable *ip_route_output_key_hash (struct net *net,struct flowi4 *fl4,const struct sk_buff *skb) { -__u8 tos =RT_FL_TOS (fl4);struct fib_result res = { .type =RTN_UNSPEC , .fi =NULL ,
@@ -2619,9 +2631,7 @@ struct rtable *ip_route_output_key_hash(struct net *net, struct flowi4 *fl4,struct rtable *rth; fl4->flowi4_iif =LOOPBACK_IFINDEX ; - fl4->flowi4_tos = tos &IPTOS_RT_MASK ; - fl4->flowi4_scope = ((tos &RTO_ONLINK ) ? -RT_SCOPE_LINK :RT_SCOPE_UNIVERSE ); +ip_rt_fix_tos (fl4);rcu_read_lock (); rth =ip_route_output_key_hash_rcu (net, fl4, &res, skb);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 560/913 af_netlink: Fix shift out of bounds in group mask calculation
In reply to Greg Kroah-HartmanFrom: Petr Machata <[email protected]>
[ Upstream commit 0caf6d9922192dd1afa8dc2131abfb4df1443b9f ]
When a netlink message is received, netlink_recvmsg() fills in the address of the sender. One of the fields is the 32-bit bitfield nl_groups, which carries the multicast group on which the message was received. The least significant bit corresponds to group 1, and therefore the highest group that the field can represent is 32. Above that, the UB sanitizer flags the out-of-bounds shift attempts.
Which bits end up being set in such case is implementation defined, but it's either going to be a wrong non-zero value, or zero, which is at least not misleading. Make the latter choice deterministic by always setting to 0 for higher-numbered multicast groups.
To get information about membership in groups >= 32, userspace is expected to use nl_pktinfo control messages[0], which are enabled by NETLINK_PKTINFO socket option.
[0] https://lwn.net/Articles/147608/
The way to trigger this issue is e.g. through monitoring the BRVLAN group:
# bridge monitor vlan & # ip link add name br type bridge
Which produces the following citation:
UBSAN: shift-out-of-bounds in net/netlink/af_netlink.c:162:19 shift exponent 32 is too large for 32-bit type 'int'
--- net/netlink/af_netlink.c | 2 ++ 1 file changed, 2 insertions(+)
net/netlink/af_netlink.c +2 -0
@@ -157,6 +157,8 @@ EXPORT_SYMBOL(do_trace_netlink_extack);static inline u32 netlink_group_mask (u32 group) { +if (group >32 ) +return 0 ;return group ?1 << (group -1 ) :0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 561/913 i2c: meson: Fix wrong speed use from probe
In reply to Greg Kroah-HartmanFrom: Lucas Tanure <[email protected]>
[ Upstream commit cb13aa16f34f794a9cee2626862af8a95f0f0ee9 ]
Having meson_i2c_set_clk_div after i2c_add_adapter causes issues for client drivers that try to use the bus before the requested speed is applied.
The bus can be used just after i2c_add_adapter, so move i2c_add_adapter to the final step as meson_i2c_set_clk_div needs to be called before the bus is used.
--- drivers/i2c/busses/i2c-meson.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-meson.c +6 -6
@@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)*/ meson_i2c_set_mask (i2c,REG_CTRL ,REG_CTRL_START ,0 ); - ret =i2c_add_adapter (&i2c->adap); -if (ret <0 ) { -clk_disable_unprepare (i2c->clk); -return ret; - } -/* Disable filtering */ meson_i2c_set_mask (i2c,REG_SLAVE_ADDR ,REG_SLV_SDA_FILTER |REG_SLV_SCL_FILTER ,0 );meson_i2c_set_clk_div (i2c, timings.bus_freq_hz); + ret =i2c_add_adapter (&i2c->adap); +if (ret <0 ) { +clk_disable_unprepare (i2c->clk); +return ret; + } +return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 562/913 netfilter: conntrack: Add and use nf_ct_set_auto_assign_helper_warned()
In reply to Greg Kroah-HartmanFrom: Phil Sutter <[email protected]>
[ Upstream commit 31d0bb9763efad30377505f3467f958d1ebe1e3d ]
The function sets the pernet boolean to avoid the spurious warning from nf_ct_lookup_helper() when assigning conntrack helpers via nftables.
--- include/net/netfilter/nf_conntrack_helper.h | 1 + net/netfilter/nf_conntrack_helper.c | 6 ++++++ net/netfilter/nft_ct.c | 3 +++ 3 files changed, 10 insertions(+)
include/net/netfilter/nf_conntrack_helper.h +1 -0
@@ -177,4 +177,5 @@ void nf_nat_helper_unregister(struct nf_conntrack_nat_helper *nat);int nf_nat_helper_try_module_get (const char *name,u16 l3num,u8 protonum);void nf_nat_helper_put (struct nf_conntrack_helper *helper); +void nf_ct_set_auto_assign_helper_warned (struct net *net);#endif /*_NF_CONNTRACK_HELPER_H*/
net/netfilter/nf_conntrack_helper.c +6 -0
@@ -556,6 +556,12 @@ static const struct nf_ct_ext_type helper_extend = { .id = NF_CT_EXT_HELPER, }; +void nf_ct_set_auto_assign_helper_warned (struct net *net) +{ +nf_ct_pernet (net)->auto_assign_helper_warned = true; +} +EXPORT_SYMBOL_GPL (nf_ct_set_auto_assign_helper_warned); +void nf_conntrack_helper_pernet_init (struct net *net) {struct nf_conntrack_net *cnet =nf_ct_pernet (net);
net/netfilter/nft_ct.c +3 -0
@@ -1040,6 +1040,9 @@ static int nft_ct_helper_obj_init(const struct nft_ctx *ctx,if (err <0 ) goto err_put_helper; +/* Avoid the bogus warning, helper will be assigned after CT init */ +nf_ct_set_auto_assign_helper_warned (ctx->net); +return 0 ; err_put_helper:
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 563/913 i2c: mux: demux-pinctrl: do not deactivate a master that is not active
In reply to Greg Kroah-HartmanFrom: Peter Rosin <[email protected]>
[ Upstream commit 1a22aabf20adf89cb216f566913196128766f25b ]
Attempting to rollback the activation of the current master when the current master has not been activated is bad. priv->cur_chan and priv->cur_adap are both still zeroed out and the rollback may result in attempts to revert an of changeset that has not been applied and do result in calls to both del and put the zeroed out i2c_adapter. Maybe it crashes, or whatever, but it's bad in any case.
--- drivers/i2c/muxes/i2c-demux-pinctrl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/muxes/i2c-demux-pinctrl.c +3 -2
@@ -261,7 +261,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err =device_create_file (&pdev->dev, &dev_attr_available_masters);if (err) - goto err_rollback; + goto err_rollback_activation; err =device_create_file (&pdev->dev, &dev_attr_current_master);if (err)
@@ -271,8 +271,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err_rollback_available:device_remove_file (&pdev->dev, &dev_attr_available_masters); -err_rollback: +err_rollback_activation:i2c_demux_deactivate_master (priv); +err_rollback:for (j =0 ; j < i; j++) {of_node_put (priv->chan[j].parent_np);of_changeset_destroy (&priv->chan[j].chgset);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 564/913 powerpc/pseries: Fix use after free in remove_phb_dynamic()
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit fe2640bd7a62f1f7c3f55fbda31084085075bc30 ]
In remove_phb_dynamic() we use &phb->io_resource, after we've called device_unregister(&host_bridge->dev). But the unregister may have freed phb, because pcibios_free_controller_deferred() is the release function for the host_bridge.
If there are no outstanding references when we call device_unregister() then phb will be freed out from under us.
This has gone mainly unnoticed, but with slub_debug and page_poison enabled it can lead to a crash:
PID: 7574 TASK: c0000000d492cb80 CPU: 13 COMMAND: "drmgr"
#0 [c0000000e4f075a0] crash_kexec at c00000000027d7dc
#1 [c0000000e4f075d0] oops_end at c000000000029608
#2 [c0000000e4f07650] __bad_page_fault at c0000000000904b4 #3 [c0000000e4f076c0] do_bad_slb_fault at c00000000009a5a8 #4 [c0000000e4f076f0] data_access_slb_common_virt at c000000000008b30 Data SLB Access [380] exception frame:
R0: c000000000167250 R1: c0000000e4f07a00 R2: c000000002a46100 R3: c000000002b39ce8 R4: 00000000000000c0 R5: 00000000000000a9 R6: 3894674d000000c0 R7: 0000000000000000 R8: 00000000000000ff R9: 0000000000000100 R10: 6b6b6b6b6b6b6b6b R11: 0000000000008000 R12: c00000000023da80 R13: c0000009ffd38b00 R14: 0000000000000000 R15: 000000011c87f0f0 R16: 0000000000000006 R17: 0000000000000003 R18: 0000000000000002 R19: 0000000000000004 R20: 0000000000000005 R21: 000000011c87ede8 R22: 000000011c87c5a8 R23: 000000011c87d3a0 R24: 0000000000000000 R25: 0000000000000001 R26: c0000000e4f07cc8 R27: c00000004d1cc400 R28: c0080000031d00e8 R29: c00000004d23d800 R30: c00000004d1d2400 R31: c00000004d1d2540 NIP: c000000000167258 MSR: 8000000000009033 OR3: c000000000e9f474 CTR: 0000000000000000 LR: c000000000167250 XER: 0000000020040003 CCR: 0000000024088420 MQ: 0000000000000000 DAR: 6b6b6b6b6b6b6ba3
DSISR: c0000000e4f07920 Syscall Result: fffffffffffffff2
[NIP : release_resource+56]
[LR : release_resource+48]
#5 [c0000000e4f07a00] release_resource at c000000000167258 (unreliable) #6 [c0000000e4f07a30] remove_phb_dynamic at c000000000105648 #7 [c0000000e4f07ab0] dlpar_remove_slot at c0080000031a09e8 [rpadlpar_io] #8 [c0000000e4f07b50] remove_slot_store at c0080000031a0b9c [rpadlpar_io] #9 [c0000000e4f07be0] kobj_attr_store at c000000000817d8c
#10 [c0000000e4f07c00] sysfs_kf_write at c00000000063e504
#11 [c0000000e4f07c20] kernfs_fop_write_iter at c00000000063d868 #12 [c0000000e4f07c70] new_sync_write at c00000000054339c
#13 [c0000000e4f07d10] vfs_write at c000000000546624
#14 [c0000000e4f07d60] ksys_write at c0000000005469f4
#15 [c0000000e4f07db0] system_call_exception at c000000000030840 #16 [c0000000e4f07e10] system_call_vectored_common at c00000000000c168
To avoid it, we can take a reference to the host_bridge->dev until we're done using phb. Then when we drop the reference the phb will be freed.
--- arch/powerpc/platforms/pseries/pci_dlpar.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/pseries/pci_dlpar.c +4 -0
@@ -78,6 +78,9 @@ int remove_phb_dynamic(struct pci_controller *phb)pseries_msi_free_domains (phb); +/* Keep a reference so phb isn't freed yet */ +get_device (&host_bridge->dev); +/* Remove the PCI bus and unregister the bridge device from sysfs */ phb->bus =NULL ;pci_remove_bus (b);
@@ -101,6 +104,7 @@ int remove_phb_dynamic(struct pci_controller *phb)* the pcibios_free_controller_deferred() callback; * see pseries_root_bridge_prepare(). */ +put_device (&host_bridge->dev);return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 565/913 selftests/bpf/test_lirc_mode2.sh: Exit with proper code
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit ec80906b0fbd7be11e3e960813b977b1ffe5f8fe ]
When test_lirc_mode2_user exec failed, the test report failed but still exit with 0. Fix it by exiting with an error code.
Another issue is for the LIRCDEV checking. With bash -n, we need to quote the variable, or it will always be true. So if test_lirc_mode2_user was not run, just exit with skip code.
--- tools/testing/selftests/bpf/test_lirc_mode2.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/test_lirc_mode2.sh +4 -1
@@ -3,6 +3,7 @@ # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 +ret=$ksft_skip msg="skip all tests:" if [ $UID != 0 ]; then
@@ -25,7 +26,7 @@ do fi done -if [ -n $LIRCDEV ]; +if [ -n "$LIRCDEV" ]; then TYPE=lirc_mode2 ./test_lirc_mode2_user $LIRCDEV $INPUTDEV
@@ -36,3 +37,5 @@ then echo -e ${GREEN}"PASS: $TYPE"${NC} fi fi + +exit $ret
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 566/913 PCI: Avoid broken MSI on SB600 USB devices
In reply to Greg Kroah-HartmanFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit 63cd736f449445edcd7f0bcc7d84453e9beec0aa ]
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by setting PCI_COMMAND_INTX_DISABLE, MSI doesn't work either. The PCI/PCIe specs do not require software to set PCI_COMMAND_INTX_DISABLE when enabling MSI, but Linux has done that for many years.
Mick reported that 306c54d0edb6 ("usb: hcd: Try MSI interrupts on PCI devices") broke these devices. Prior to 306c54d0edb6, they used INTx. Starting with 306c54d0edb6, they use MSI, and and the fact that Linux sets PCI_COMMAND_INTX_DISABLE means both INTx and MSI are disabled on these devices.
Avoid this SB600 defect by disabling MSI so we use INTx as before.
--- drivers/pci/quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/pci/quirks.c +12 -0
@@ -1811,6 +1811,18 @@ static void quirk_alder_ioapic(struct pci_dev *pdev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_EESSC , quirk_alder_ioapic);#endif +static void quirk_no_msi (struct pci_dev *dev) +{ +pci_info (dev,"avoiding MSI to work around a hardware defect\n" ); + dev->no_msi =1 ; +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4386 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4387 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4388 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4389 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x438a , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x438b , quirk_no_msi); +static void quirk_pcie_mch (struct pci_dev *pdev) { pdev->no_msi =1 ;
Signature · 1 line
2.34.1