5.16.3-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 107/1039 libbpf: Fix section counting logic
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 0d6988e16a12ebd41d3e268992211b0ceba44ed7 ]
e_shnum does include section #0 and as such is exactly the number of ELF sections that we need to allocate memory for to use section indices as array indices. Fix the off-by-one error.
This is purely accounting fix, previously we were overallocating one too many array items. But no correctness errors otherwise.
--- tools/lib/bpf/libbpf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/lib/bpf/libbpf.c +4 -4
@@ -3191,11 +3191,11 @@ static int bpf_object__elf_collect(struct bpf_object *obj)Elf_Scn *scn;Elf64_Shdr *sh; -/* ELF section indices are 1-based, so allocate +1 element to keep -* indexing simple. Also include 0th invalid section into sec_cnt for -* simpler and more traditional iteration logic. +/* ELF section indices are 0-based, but sec #0 is special "invalid" +* section. e_shnum does include sec #0, so e_shnum is the necessary +* size of an array to keep all the sections. */ - obj->efile.sec_cnt =1 + obj->efile.ehdr->e_shnum; + obj->efile.sec_cnt = obj->efile.ehdr->e_shnum; obj->efile.secs =calloc (obj->efile.sec_cnt,sizeof (*obj->efile.secs));if (!obj->efile.secs)return -ENOMEM ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 108/1039 drm/vc4: hdmi: Enable the scrambler on reconnection
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit b7551457c5d0b3505b0be247d47919c1ee30506d ]
If we have a state already and disconnect/reconnect the display, the SCDC messages won't be sent again since we didn't go through a disable / enable cycle.
In order to fix this, let's call the vc4_hdmi_enable_scrambling function in the detect callback if there is a mode and it needs the scrambler to be enabled.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/vc4/vc4_hdmi.c +3 -0
@@ -162,6 +162,8 @@ static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi)static void vc4_hdmi_cec_update_clk_div (struct vc4_hdmi *vc4_hdmi) {}#endif +static void vc4_hdmi_enable_scrambling (struct drm_encoder *encoder); +static enum drm_connector_status vc4_hdmi_connector_detect (struct drm_connector *connector,bool force) {
@@ -190,6 +192,7 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) } } +vc4_hdmi_enable_scrambling (&vc4_hdmi->encoder.base.base);pm_runtime_put (&vc4_hdmi->pdev->dev);return connector_status_connected; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 109/1039 libbpf: Fix non-C89 loop variable declaration in gen_loader.c
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit b8b5cb55f5d3f03cc1479a3768d68173a10359ad ]
Fix the int i declaration inside the for statement. This is non-C89 compliant. See [0] for user report breaking BCC build.
[0] https://github.com/libbpf/libbpf/issues/403
--- tools/lib/bpf/gen_loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/lib/bpf/gen_loader.c +2 -1
@@ -597,8 +597,9 @@ void bpf_gen__record_extern(struct bpf_gen *gen, const char *name, bool is_weak,static struct ksym_desc *get_ksym_desc (struct bpf_gen *gen,struct ksym_relo_desc *relo) {struct ksym_desc *kdesc; +int i; -for (int i =0 ; i < gen->nr_ksyms; i++) { +for (i =0 ; i < gen->nr_ksyms; i++) {if (!strcmp (gen->ksyms[i].name, relo->name)) { gen->ksyms[i].ref++;return &gen->ksyms[i];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 110/1039 libbpf: Free up resources used by inner map definition
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 8f7b239ea8cfdc8e64c875ee417fed41431a1f37 ]
It's not enough to just free(map->inner_map), as inner_map itself can have extra memory allocated, like map name.
--- tools/lib/bpf/libbpf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +4 -1
@@ -9028,7 +9028,10 @@ int bpf_map__set_inner_map_fd(struct bpf_map *map, int fd)pr_warn ("error: inner_map_fd already specified\n" );return libbpf_err (-EINVAL ); } -zfree (&map->inner_map); +if (map->inner_map) { +bpf_map__destroy (map->inner_map); +zfree (&map->inner_map); + } map->inner_map_fd = fd;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 111/1039 wcn36xx: Fix DMA channel enable/disable cycle
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 89dcb1da611d9b3ff0728502d58372fdaae9ebff ]
Right now we have a broken sequence where we enable DMA channel interrupts which can be left enabled and never disabled if we hit an error path.
Worse still when we unload the driver, the DMA channel interrupt bits are left intact. About the only saving grace here is that we do remember to disable the wcnss interrupt when unload the driver.
--- drivers/net/wireless/ath/wcn36xx/dxe.c | 38 ++++++++++++++++++-------- 1 file changed, 27 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/wcn36xx/dxe.c +27 -11
@@ -272,6 +272,21 @@ static int wcn36xx_dxe_enable_ch_int(struct wcn36xx *wcn, u16 wcn_ch)return 0 ; } +static void wcn36xx_dxe_disable_ch_int (struct wcn36xx *wcn,u16 wcn_ch) +{ +int reg_data =0 ; + +wcn36xx_dxe_read_register (wcn, +WCN36XX_DXE_INT_MASK_REG , + ®_data); + + reg_data &= ~wcn_ch; + +wcn36xx_dxe_write_register (wcn, +WCN36XX_DXE_INT_MASK_REG , + (int )reg_data); +} +static int wcn36xx_dxe_fill_skb (struct device *dev,struct wcn36xx_dxe_ctl *ctl,gfp_t gfp)
@@ -869,7 +884,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) WCN36XX_DXE_WQ_TX_L);wcn36xx_dxe_read_register (wcn,WCN36XX_DXE_REG_CH_EN , ®_data); -wcn36xx_dxe_enable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_TX_L );/***************************************/ /* Init descriptors for TX HIGH channel */
@@ -893,9 +907,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn)wcn36xx_dxe_read_register (wcn,WCN36XX_DXE_REG_CH_EN , ®_data); -/* Enable channel interrupts */ -wcn36xx_dxe_enable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_TX_H ); -/***************************************/ /* Init descriptors for RX LOW channel */ /***************************************/
@@ -905,7 +916,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) goto out_err_rxl_ch; } -/* For RX we need to preallocated buffers */ wcn36xx_dxe_ch_alloc_skb (wcn, &wcn->dxe_rx_l_ch);
@@ -928,9 +938,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn)WCN36XX_DXE_REG_CTL_RX_L , WCN36XX_DXE_CH_DEFAULT_CTL_RX_L); -/* Enable channel interrupts */ -wcn36xx_dxe_enable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_RX_L ); -/***************************************/ /* Init descriptors for RX HIGH channel */ /***************************************/
@@ -962,15 +969,18 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn)WCN36XX_DXE_REG_CTL_RX_H , WCN36XX_DXE_CH_DEFAULT_CTL_RX_H); -/* Enable channel interrupts */ -wcn36xx_dxe_enable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_RX_H ); - ret =wcn36xx_dxe_request_irqs (wcn);if (ret <0 ) goto out_err_irq;timer_setup (&wcn->tx_ack_timer, wcn36xx_dxe_tx_timer,0 ); +/* Enable channel interrupts */ +wcn36xx_dxe_enable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_TX_L ); +wcn36xx_dxe_enable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_TX_H ); +wcn36xx_dxe_enable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_RX_L ); +wcn36xx_dxe_enable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_RX_H ); +return 0 ; out_err_irq:
@@ -987,6 +997,12 @@ out_err_txh_ch:void wcn36xx_dxe_deinit (struct wcn36xx *wcn) { +/* Disable channel interrupts */ +wcn36xx_dxe_disable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_RX_H ); +wcn36xx_dxe_disable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_RX_L ); +wcn36xx_dxe_disable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_TX_H ); +wcn36xx_dxe_disable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_TX_L ); +free_irq (wcn->tx_irq, wcn);free_irq (wcn->rx_irq, wcn);del_timer (&wcn->tx_ack_timer);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 112/1039 wcn36xx: Release DMA channel descriptor allocations
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 3652096e5263ad67604b0323f71d133485f410e5 ]
When unloading the driver we are not releasing the DMA descriptors which we previously allocated.
--- drivers/net/wireless/ath/wcn36xx/dxe.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/wcn36xx/dxe.c +5 -0
@@ -1014,4 +1014,9 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn)wcn36xx_dxe_ch_free_skbs (wcn, &wcn->dxe_rx_l_ch);wcn36xx_dxe_ch_free_skbs (wcn, &wcn->dxe_rx_h_ch); + +wcn36xx_dxe_deinit_descs (wcn->dev, &wcn->dxe_tx_l_ch); +wcn36xx_dxe_deinit_descs (wcn->dev, &wcn->dxe_tx_h_ch); +wcn36xx_dxe_deinit_descs (wcn->dev, &wcn->dxe_rx_l_ch); +wcn36xx_dxe_deinit_descs (wcn->dev, &wcn->dxe_rx_h_ch); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 113/1039 wcn36xx: Put DXE block into reset before freeing memory
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit ed04ea76e69e7194f7489cebe23a32a68f39218d ]
When deiniting the DXE hardware we should reset the block to ensure there is no spurious DMA write transaction from the downstream WCNSS to upstream MSM at a skbuff address we will have released.
--- drivers/net/wireless/ath/wcn36xx/dxe.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/ath/wcn36xx/dxe.c +6 -0
@@ -997,6 +997,8 @@ out_err_txh_ch:void wcn36xx_dxe_deinit (struct wcn36xx *wcn) { +int reg_data =0 ; +/* Disable channel interrupts */ wcn36xx_dxe_disable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_RX_H );wcn36xx_dxe_disable_ch_int (wcn,WCN36XX_INT_MASK_CHAN_RX_L );
@@ -1012,6 +1014,10 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn) wcn->tx_ack_skb =NULL ; } +/* Put the DXE block into reset before freeing memory */ + reg_data =WCN36XX_DXE_REG_RESET ; +wcn36xx_dxe_write_register (wcn,WCN36XX_DXE_REG_CSR_RESET , reg_data); +wcn36xx_dxe_ch_free_skbs (wcn, &wcn->dxe_rx_l_ch);wcn36xx_dxe_ch_free_skbs (wcn, &wcn->dxe_rx_h_ch);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 114/1039 wcn36xx: populate band before determining rate on RX
In reply to Greg Kroah-HartmanFrom: Benjamin Li <[email protected]>
[ Upstream commit c9c5608fafe4dae975c9644c7d14c51ad3b0ed73 ]
status.band is used in determination of status.rate -- for 5GHz on legacy rates there is a linear shift between the BD descriptor's rate field and the wcn36xx driver's rate table (wcn_5ghz_rates).
We have a special clause to populate status.band for hardware scan offload frames. However, this block occurs after status.rate is already populated. Correctly handle this dependency by moving the band block before the rate block.
This patch addresses kernel warnings & missing scan results for 5GHz APs that send their beacons/probe responses at the higher four legacy rates (24-54 Mbps), when using hardware scan offload:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at net/mac80211/rx.c:4532 ieee80211_rx_napi+0x744/0x8d8 Modules linked in: wcn36xx [...] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.19.107-g73909fa #1 Hardware name: Square, Inc. T2 (all variants) (DT) Call trace: dump_backtrace+0x0/0x148 show_stack+0x14/0x1c dump_stack+0xb8/0xf0 __warn+0x2ac/0x2d8 warn_slowpath_null+0x44/0x54 ieee80211_rx_napi+0x744/0x8d8 ieee80211_tasklet_handler+0xa4/0xe0 tasklet_action_common+0xe0/0x118 tasklet_action+0x20/0x28 __do_softirq+0x108/0x1ec irq_exit+0xd4/0xd8 __handle_domain_irq+0x84/0xbc gic_handle_irq+0x4c/0xb8 el1_irq+0xe8/0x190 lpm_cpuidle_enter+0x220/0x260 cpuidle_enter_state+0x114/0x1c0 cpuidle_enter+0x34/0x48 do_idle+0x150/0x268 cpu_startup_entry+0x20/0x24 rest_init+0xd4/0xe0 start_kernel+0x398/0x430 ---[ end trace ae28cb759352b403 ]---
--- drivers/net/wireless/ath/wcn36xx/txrx.c | 37 +++++++++++++------------ 1 file changed, 19 insertions(+), 18 deletions(-)
drivers/net/wireless/ath/wcn36xx/txrx.c +19 -18
@@ -314,8 +314,6 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) fc =__le16_to_cpu (hdr->frame_control); sn =IEEE80211_SEQ_TO_SN (__le16_to_cpu (hdr->seq_ctrl)); - status.freq =WCN36XX_CENTER_FREQ (wcn); - status.band =WCN36XX_BAND (wcn); status.mactime =10 ; status.signal = -get_rssi0 (bd); status.antenna =1 ;
@@ -327,6 +325,25 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)wcn36xx_dbg (WCN36XX_DBG_RX ,"status.flags=%x\n" , status.flag); +if (bd->scan_learn) { +/* If packet originate from hardware scanning, extract the +* band/channel from bd descriptor. +*/ +u8 hwch = (bd->reserved0 <<4 ) + bd->rx_ch; + +if (bd->rf_band !=1 && hwch <=sizeof (ab_rx_ch_map) && hwch >=1 ) { + status.band =NL80211_BAND_5GHZ ; + status.freq =ieee80211_channel_to_frequency (ab_rx_ch_map[hwch -1 ], + status.band); + }else { + status.band =NL80211_BAND_2GHZ ; + status.freq =ieee80211_channel_to_frequency (hwch, status.band); + } + }else { + status.band =WCN36XX_BAND (wcn); + status.freq =WCN36XX_CENTER_FREQ (wcn); + } +if (bd->rate_id <ARRAY_SIZE (wcn36xx_rate_table)) { rate = &wcn36xx_rate_table[bd->rate_id]; status.encoding = rate->encoding;
@@ -353,22 +370,6 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) ieee80211_is_probe_resp(hdr->frame_control)) status.boottime_ns = ktime_get_boottime_ns(); -if (bd->scan_learn) { -/* If packet originates from hardware scanning, extract the -* band/channel from bd descriptor. -*/ -u8 hwch = (bd->reserved0 <<4 ) + bd->rx_ch; - -if (bd->rf_band !=1 && hwch <=sizeof (ab_rx_ch_map) && hwch >=1 ) { - status.band =NL80211_BAND_5GHZ ; - status.freq =ieee80211_channel_to_frequency (ab_rx_ch_map[hwch -1 ], - status.band); - }else { - status.band =NL80211_BAND_2GHZ ; - status.freq =ieee80211_channel_to_frequency (hwch, status.band); - } - } -memcpy (IEEE80211_SKB_RXCB (skb), &status,sizeof (status));if (ieee80211_is_beacon (hdr->frame_control)) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 115/1039 wcn36xx: fix RX BD rate mapping for 5GHz legacy rates
In reply to Greg Kroah-HartmanFrom: Benjamin Li <[email protected]>
[ Upstream commit cfdf6b19e750f7de8ae71a26932f63b52e3bf74c ]
The linear mapping between the BD rate field and the driver's 5GHz legacy rates table (wcn_5ghz_rates) does not only apply for the latter four rates -- it applies to all eight rates.
--- drivers/net/wireless/ath/wcn36xx/txrx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/ath/wcn36xx/txrx.c +1 -3
@@ -272,7 +272,6 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)const struct wcn36xx_rate *rate;struct ieee80211_hdr *hdr;struct wcn36xx_rx_bd *bd; -struct ieee80211_supported_band *sband;u16 fc, sn;/*
@@ -350,12 +349,11 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) status.enc_flags = rate->encoding_flags; status.bw = rate->bw; status.rate_idx = rate->mcs_or_legacy_index; - sband = wcn->hw->wiphy->bands[status.band]; status.nss =1 ;if (status.band ==NL80211_BAND_5GHZ && status.encoding ==RX_ENC_LEGACY && - status.rate_idx >= sband->n_bitrates) { + status.rate_idx >=4 ) {/* no dsss rates in 5Ghz rates table */ status.rate_idx -=4 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 116/1039 ath11k: Send PPDU_STATS_CFG with proper pdev mask to firmware
In reply to Greg Kroah-HartmanFrom: Rameshkumar Sundaram <[email protected]>
[ Upstream commit 16a2c3d5406f95ef6139de52669c60a39443f5f7 ]
HTT_PPDU_STATS_CFG_PDEV_ID bit mask for target FW PPDU stats request message was set as bit 8 to 15. Bit 8 is reserved for soc stats and pdev id starts from bit 9. Hence change the bitmask as bit 9 to 15 and fill the proper pdev id in the request message.
In commit 701e48a43e15 ("ath11k: add packet log support for QCA6390"), both HTT_PPDU_STATS_CFG_PDEV_ID and pdev_mask were changed, but this pdev_mask calculation is not valid for platforms which has multiple pdevs with 1 rxdma per pdev, as this is writing same value(i.e. 2) for all pdevs. Hence fixed it to consider pdev_idx as well, to make it compatible for both single and multi pd cases.
Tested on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01092-QCAHKSWPL_SILICONZ-1 Tested on: IPQ6018 hw1.0 WLAN.HK.2.5.0.1-01067-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/dp.h | 3 ++- drivers/net/wireless/ath/ath11k/dp_tx.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/dp.h +2 -1
@@ -517,7 +517,8 @@ struct htt_ppdu_stats_cfg_cmd { } __packed;#define HTT_PPDU_STATS_CFG_MSG_TYPE GENMASK(7, 0) -#define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 8) +#define HTT_PPDU_STATS_CFG_SOC_STATS BIT(8) +#define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 9)#define HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK GENMASK(31, 16)enum htt_ppdu_stats_tag_type {
drivers/net/wireless/ath/ath11k/dp_tx.c +1 -1
@@ -903,7 +903,7 @@ int ath11k_dp_tx_htt_h2t_ppdu_stats_req(struct ath11k *ar, u32 mask) cmd->msg =FIELD_PREP (HTT_PPDU_STATS_CFG_MSG_TYPE ,HTT_H2T_MSG_TYPE_PPDU_STATS_CFG ); - pdev_mask =1 << (i +1 ); + pdev_mask =1 << (ar->pdev_idx + i); cmd->msg |=FIELD_PREP (HTT_PPDU_STATS_CFG_PDEV_ID , pdev_mask); cmd->msg |=FIELD_PREP (HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK , mask);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 117/1039 bpftool: Fix memory leak in prog_dump()
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit ebbd7f64a3fbe9e0f235e39fc244ee9735e2a52a ]
Following the extraction of prog_dump() from do_dump(), the struct btf allocated in prog_dump() is no longer freed on error; the struct bpf_prog_linfo is not freed at all. Make sure we release them before exiting the function.
--- tools/bpf/bpftool/prog.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
tools/bpf/bpftool/prog.c +9 -6
@@ -639,8 +639,8 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,char func_sig[1024 ];unsigned char *buf;__u32 member_len; +int fd, err =-1 ;ssize_t n; -int fd;if (mode ==DUMP_JITED ) {if (info->jited_prog_len ==0 || !info->jited_prog_insns) {
@@ -679,7 +679,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,if (fd <0 ) {p_err ("can't open file %s: %s" , filepath,strerror (errno)); -return -1 ; + goto exit_free; } n =write (fd, buf, member_len);
@@ -687,7 +687,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,if (n != (ssize_t )member_len) {p_err ("error writing output file: %s" , n <0 ?strerror (errno) :"short write" ); -return -1 ; + goto exit_free; }if (json_output)
@@ -701,7 +701,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode, info->netns_ino, &disasm_opt);if (!name) -return -1 ; + goto exit_free; }if (info->nr_jited_func_lens && info->jited_func_lens) {
@@ -796,9 +796,12 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,kernel_syms_destroy (&dd); } -btf__free (btf); + err =0 ; -return 0 ; +exit_free: +btf__free (btf); +bpf_prog_linfo__free (prog_linfo); +return err; }static int do_dump (int argc,char **argv)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 118/1039 mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init()
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit 981387ed06b96908223a607f5fba6efa42728fc2 ]
rpcif_sw_init() can fail so make sure we check the return value of it and on error exit rpcif_hb_probe() callback with error code.
--- drivers/mtd/hyperbus/rpc-if.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/hyperbus/rpc-if.c +3 -1
@@ -124,7 +124,9 @@ static int rpcif_hb_probe(struct platform_device *pdev)if (!hyperbus)return -ENOMEM ; -rpcif_sw_init (&hyperbus->rpc, pdev->dev.parent); + error =rpcif_sw_init (&hyperbus->rpc, pdev->dev.parent); +if (error) +return error;platform_set_drvdata (pdev, hyperbus);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 119/1039 media: videobuf2: Fix the size printk format
In reply to Greg Kroah-HartmanFrom: Dillon Min <[email protected]>
[ Upstream commit c9ee220d76775e42f35d634479c978d9350077d3 ]
Since the type of parameter size is unsigned long, it should printk by %lu, instead of %ld, fix it.
--- drivers/media/common/videobuf2/videobuf2-dma-contig.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/common/videobuf2/videobuf2-dma-contig.c +4 -4
@@ -257,7 +257,7 @@ static void *vb2_dc_alloc(struct vb2_buffer *vb, ret =vb2_dc_alloc_coherent (buf);if (ret) { -dev_err (dev,"dma alloc of size %ld failed\n" , size); +dev_err (dev,"dma alloc of size %lu failed\n" , size);kfree (buf);return ERR_PTR (-ENOMEM ); }
@@ -298,9 +298,9 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) vma->vm_ops->open (vma); -pr_debug ("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n" , - __func__, (unsigned long )buf->dma_addr, vma->vm_start, - buf->size); +pr_debug ("%s: mapped dma addr 0x%08lx at 0x%08lx, size %lu\n" , + __func__, (unsigned long )buf->dma_addr, vma->vm_start, + buf->size);return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 120/1039 media: ipu3-cio2: fix error code in cio2_bridge_connect_sensor()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 85db29d22cc521d9d06de2f5c7832981a55df157 ]
Return -ENODEV if acpi_get_physical_device_location() fails. Don't return success.
--- drivers/media/pci/intel/ipu3/cio2-bridge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/pci/intel/ipu3/cio2-bridge.c +3 -1
@@ -238,8 +238,10 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg, goto err_put_adev; status =acpi_get_physical_device_location (adev->handle, &sensor->pld); -if (ACPI_FAILURE (status)) +if (ACPI_FAILURE (status)) { + ret = -ENODEV ; goto err_put_adev; + }if (sensor->ssdb.lanes >CIO2_MAX_LANES ) { dev_err(&adev->dev,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 121/1039 media: atomisp: add missing media_device_cleanup() in atomisp_unregister_entities()
In reply to Greg Kroah-HartmanFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit ce3015b7212e96db426d0c36f80fd159c91155d1 ]
After the commit 9832e155f1ed ("[media] media-device: split media initialization and registration"), calling media_device_cleanup() is needed it seems. However, currently it is missing for the module unload path.
Note that for the probe failure path, it is already added in atomisp_register_entities().
This patch adds the missing call of media_device_cleanup() in atomisp_unregister_entities().
--- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +1 -0
@@ -1182,6 +1182,7 @@ static void atomisp_unregister_entities(struct atomisp_device *isp)v4l2_device_unregister (&isp->v4l2_dev);media_device_unregister (&isp->media_dev); +media_device_cleanup (&isp->media_dev); }static int atomisp_register_entities (struct atomisp_device *isp)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 122/1039 media: atomisp: fix punit_ddr_dvfs_enable() argument for mrfld_power up case
In reply to Greg Kroah-HartmanFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit 5bfbf65fcca7325e4d89d289b3c286e11220e386 ]
When comparing with intel-aero atomisp [1], it looks like punit_ddr_dvfs_enable() should take false as an argument on mrfld_power up case.
Code from the intel-aero kernel [1]:
int atomisp_mrfld_power_down(struct atomisp_device *isp)
{
[...]
/*WA:Enable DVFS*/
if (IS_CHT)
punit_ddr_dvfs_enable(true);
int atomisp_mrfld_power_up(struct atomisp_device *isp)
{
[...]
/*WA for PUNIT, if DVFS enabled, ISP timeout observed*/
if (IS_CHT)
punit_ddr_dvfs_enable(false);This patch fixes the inverted argument as per the intel-aero code, as well as its comment. While here, fix space issues for comments in atomisp_mrfld_power().
Note that it does not seem to be possible to unify the up/down cases for punit_ddr_dvfs_enable(), i.e., we can't do something like the following:
if (IS_CHT) punit_ddr_dvfs_enable(!enable);
because according to the intel-aero code [1], the DVFS is disabled before "writing 0x0 to ISPSSPM0 bit[1:0]" and the DVFS is enabled after "writing 0x3 to ISPSSPM0 bit[1:0]".
--- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +4 -4
@@ -711,15 +711,15 @@ static int atomisp_mrfld_power(struct atomisp_device *isp, bool enable)dev_dbg (isp->dev,"IUNIT power-%s.\n" , enable ?"on" :"off" ); -/*WA:Enable DVFS*/ +/* WA for P-Unit, if DVFS enabled, ISP timeout observed */ if (IS_CHT && enable) -punit_ddr_dvfs_enable (true); +punit_ddr_dvfs_enable (false);/* * FIXME:WA for ECS28A, with this sleep, CTS * android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceAbort * PASS, no impact on other platforms -*/ +*/ if (IS_BYT && enable)msleep (10 );
@@ -727,7 +727,7 @@ static int atomisp_mrfld_power(struct atomisp_device *isp, bool enable)iosf_mbi_modify (BT_MBI_UNIT_PMC ,MBI_REG_READ ,MRFLD_ISPSSPM0 , val,MRFLD_ISPSSPM0_ISPSSC_MASK ); -/*WA:Enable DVFS*/ +/* WA:Enable DVFS */ if (IS_CHT && !enable)punit_ddr_dvfs_enable (true);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 123/1039 media: atomisp: fix inverted logic in buffers_needed()
In reply to Greg Kroah-HartmanFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit e1921cd14640f0f4d1fad5eb8e448c58a536415d ]
When config.mode is IA_CSS_INPUT_MODE_BUFFERED_SENSOR, it rather needs buffers. Fix it by inverting the return value.
--- drivers/staging/media/atomisp/pci/sh_css_mipi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/pci/sh_css_mipi.c +4 -4
@@ -374,17 +374,17 @@ static bool buffers_needed(struct ia_css_pipe *pipe) {if (!IS_ISP2401 ) {if (pipe->stream->config.mode ==IA_CSS_INPUT_MODE_BUFFERED_SENSOR ) -return false; -else return true; +else +return false; }if (pipe->stream->config.mode ==IA_CSS_INPUT_MODE_BUFFERED_SENSOR || pipe->stream->config.mode ==IA_CSS_INPUT_MODE_TPG || pipe->stream->config.mode ==IA_CSS_INPUT_MODE_PRBS ) -return false; +return true; -return true; +return false; }int
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 124/1039 media: atomisp: do not use err var when checking port validity for ISP2400
In reply to Greg Kroah-HartmanFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit 9f6b4fa2d2dfbff4b8a57eeb39b1128a6094ee20 ]
Currently, the port >= N_CSI_PORTS || err checks for ISP2400 are always evaluated as true because the err variable is set to -EINVAL on declaration but the variable is never used until the evaluation.
Looking at the diff of commit 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version"), the port >= N_CSI_PORTS check is for ISP2400 and the err variable check is for ISP2401. Fix this issue by adding ISP version test there accordingly.
--- drivers/staging/media/atomisp/pci/sh_css_mipi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/media/atomisp/pci/sh_css_mipi.c +6 -3
@@ -430,7 +430,8 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,assert (port <N_CSI_PORTS ); -if (port >=N_CSI_PORTS || err) { +if ((!IS_ISP2401 && port >=N_CSI_PORTS ) || + (IS_ISP2401 && err)) {ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE ,"allocate_mipi_frames(%p) exit: error: port is not correct (port=%d).\n" , pipe, port);
@@ -559,7 +560,8 @@ free_mipi_frames(struct ia_css_pipe *pipe)assert (port <N_CSI_PORTS ); -if (port >=N_CSI_PORTS || err) { +if ((!IS_ISP2401 && port >=N_CSI_PORTS ) || + (IS_ISP2401 && err)) {ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE ,"free_mipi_frames(%p, %d) exit: error: pipe port is not correct.\n" , pipe, port);
@@ -670,7 +672,8 @@ send_mipi_frames(struct ia_css_pipe *pipe)assert (port <N_CSI_PORTS ); -if (port >=N_CSI_PORTS || err) { +if ((!IS_ISP2401 && port >=N_CSI_PORTS ) || + (IS_ISP2401 && err)) {IA_CSS_ERROR ("send_mipi_frames(%p) exit: invalid port specified (port=%d).\n" , pipe, port);return err;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 125/1039 media: atomisp: fix inverted error check for ia_css_mipi_is_source_port_valid()
In reply to Greg Kroah-HartmanFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit d21ce8c2f7bf6d737b60c09f86db141b9e8e47f0 ]
The function ia_css_mipi_is_source_port_valid() returns true if the port is valid. So, we can't use the existing err variable as is.
To fix this issue while reusing that variable, invert the return value when assigning it to the variable.
--- .../staging/media/atomisp/pci/sh_css_mipi.c | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/staging/media/atomisp/pci/sh_css_mipi.c +15 -9
@@ -423,10 +423,12 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,return 0 ;/* AM TODO: Check */ } -if (!IS_ISP2401 ) +if (!IS_ISP2401 ) { port = (unsigned int )pipe->stream->config.source.port.port; -else - err =ia_css_mipi_is_source_port_valid (pipe, &port); + }else { +/* Returns true if port is valid. So, invert it */ + err = !ia_css_mipi_is_source_port_valid (pipe, &port); + }assert (port <N_CSI_PORTS );
@@ -553,10 +555,12 @@ free_mipi_frames(struct ia_css_pipe *pipe)return err; } -if (!IS_ISP2401 ) +if (!IS_ISP2401 ) { port = (unsigned int )pipe->stream->config.source.port.port; -else - err =ia_css_mipi_is_source_port_valid (pipe, &port); + }else { +/* Returns true if port is valid. So, invert it */ + err = !ia_css_mipi_is_source_port_valid (pipe, &port); + }assert (port <N_CSI_PORTS );
@@ -665,10 +669,12 @@ send_mipi_frames(struct ia_css_pipe *pipe)/* TODO: AM: maybe this should be returning an error. */ } -if (!IS_ISP2401 ) +if (!IS_ISP2401 ) { port = (unsigned int )pipe->stream->config.source.port.port; -else - err =ia_css_mipi_is_source_port_valid (pipe, &port); + }else { +/* Returns true if port is valid. So, invert it */ + err = !ia_css_mipi_is_source_port_valid (pipe, &port); + }assert (port <N_CSI_PORTS );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 126/1039 media: atomisp: fix ifdefs in sh_css.c
In reply to Greg Kroah-HartmanFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit 5a1b2725558f8a3b4cbf0504f53cffae8e163034 ]
## if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG) { case
The intel-aero atomisp has #if defined(IS_ISP_2400_SYSTEM) [1]. It is to be defined in the following two places [2]:
- css/hive_isp_css_common/system_global.h
- css/css_2401_csi2p_system/system_global.h
and the former file is to be included on ISP2400 devices, too. So, it is to be defined for both ISP2400 and ISP2401 devices.
Because the upstreamed atomisp driver now supports only ISP2400 and ISP2401, just remove the ISP version test again. This matches the other upstream commits like 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version").
While here, moved the comment for define GP_ISEL_TPG_MODE to the appropriate place.
[1] https://github.com/intel-aero/linux-kernel/blob/a1b673258feb915268377275130c5c5df0eafc82/drivers/media/pci/atomisp/css/sh_css.c#L552-L558
[2] https://github.com/intel-aero/linux-kernel/search?q=IS_ISP_2400_SYSTEM
## isys_stream_descr->polling_mode case
This does not exist on the intel-aero atomisp. This is because it is based on css version irci_stable_candrpv_0415_20150521_0458.
On the other hand, the upstreamed atomisp is based on the following css version depending on the ISP version using ifdefs:
- ISP2400: irci_stable_candrpv_0415_20150521_0458
- ISP2401: irci_master_20150911_0724
The isys_stream_descr->polling_mode usage was added on updating css version to irci_master_20150701_0213 [3].
So, it is not a ISP version specific thing, but css version specific thing. Because the upstreamed atomisp driver uses irci_master_20150911_0724 for ISP2401, re-add the ISP version check for now.
I say "for now" because ISP2401 should eventually use the same css version with ISP2400 (i.e., irci_stable_candrpv_0415_20150521_0458)
[3] https://raw.githubusercontent.com/intel/ProductionKernelQuilts/cht-m1stable-2016_ww31/uefi/cht-m1stable/patches/cam-0439-atomisp2-css2401-and-2401_legacy-irci_master_2015070.patch
("atomisp2: css2401 and 2401_legacy-irci_master_20150701_0213")
Link to Intel's Android kernel patch.
## coord = &me->config.internal_frame_origin_bqs_on_sctbl; case
it was added on commit 4f744a573db3 ("media: atomisp: make sh_css_sp_init_pipeline() ISP version independent") for ISP2401. Because the upstreamed atomisp for the ISP2401 part is based on irci_master_20150911_0724, hence the difference.
Because the upstreamed atomisp driver uses irci_master_20150911_0724 for ISP2401, revert the test back to if (IS_ISP2401).
--- drivers/staging/media/atomisp/pci/sh_css.c | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +11 -16
@@ -522,6 +522,7 @@ ia_css_stream_input_format_bits_per_pixel(struct ia_css_stream *stream)return bpp; } +/* TODO: move define to proper file in tools */ #define GP_ISEL_TPG_MODE 0x90058#if !defined(ISP2401 )
@@ -573,12 +574,8 @@ sh_css_config_input_network(struct ia_css_stream *stream) vblank_cycles = vblank_lines * (width + hblank_cycles);sh_css_sp_configure_sync_gen (width, height, hblank_cycles, vblank_cycles); -if (!IS_ISP2401 ) { -if (pipe->stream->config.mode ==IA_CSS_INPUT_MODE_TPG ) { -/* TODO: move define to proper file in tools */ -ia_css_device_store_uint32 (GP_ISEL_TPG_MODE ,0 ); - } - } +if (pipe->stream->config.mode ==IA_CSS_INPUT_MODE_TPG ) +ia_css_device_store_uint32 (GP_ISEL_TPG_MODE ,0 ); }ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE ,"sh_css_config_input_network() leave:\n" );
@@ -1009,16 +1006,14 @@ static bool sh_css_translate_stream_cfg_to_isys_stream_descr(* ia_css_isys_stream_capture_indication() instead of * ia_css_pipeline_sp_wait_for_isys_stream_N() as isp processing of * capture takes longer than getting an ISYS frame -* -* Only 2401 relevant ?? */ -#if 0 // FIXME: NOT USED on Yocto Aero - isys_stream_descr->polling_mode - = early_polling ?INPUT_SYSTEM_POLL_ON_CAPTURE_REQUEST - :INPUT_SYSTEM_POLL_ON_WAIT_FOR_FRAME ; -ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE , -"sh_css_translate_stream_cfg_to_isys_stream_descr() leave:\n" ); -#endif +if (IS_ISP2401 ) { + isys_stream_descr->polling_mode + = early_polling ?INPUT_SYSTEM_POLL_ON_CAPTURE_REQUEST + :INPUT_SYSTEM_POLL_ON_WAIT_FOR_FRAME ; +ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE , +"sh_css_translate_stream_cfg_to_isys_stream_descr() leave:\n" ); + }return rc; }
@@ -1433,7 +1428,7 @@ static void start_pipe(assert (me);/* all callers are in this file and call with non null argument */ -if (!IS_ISP2401 ) { +if (IS_ISP2401 ) { coord = &me->config.internal_frame_origin_bqs_on_sctbl; params = me->stream->isp_params_configs; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 127/1039 media: atomisp: add NULL check for asd obtained from atomisp_video_pipe
In reply to Greg Kroah-HartmanFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit c10bcb13462e9cf43111d17f1e08b4bb4d4401b0 ]
This is almost a BUG report with RFC patch that just avoids kernel oopses. Thus, prefixed with [BUG][RFC].
Here is the kernel log after running v4l2-compliance -d /dev/video4 with this patch applied:
kern :err : [25507.580392] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.592343] isys dma store at addr(0xcd408) val(0) kern :err : [25507.592995] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.593685] atomisp-isp2 0000:00:03.0: atomisp_g_input(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.593719] atomisp-isp2 0000:00:03.0: atomisp_g_parm(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.593727] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC [omitting 42 same messages] kern :err : [25507.593976] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594191] atomisp-isp2 0000:00:03.0: atomisp_g_input(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594449] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC [omitting 43 same messages] kern :err : [25507.594756] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594779] atomisp-isp2 0000:00:03.0: atomisp_g_ctrl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594787] atomisp-isp2 0000:00:03.0: atomisp_s_ctrl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594803] atomisp-isp2 0000:00:03.0: atomisp_camera_g_ext_ctrls(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594880] atomisp-isp2 0000:00:03.0: atomisp_enum_fmt_cap(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594915] atomisp-isp2 0000:00:03.0: atomisp_g_parm(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595058] atomisp-isp2 0000:00:03.0: atomisp_try_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595089] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595124] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595221] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595241] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.601571] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.607496] isys dma store at addr(0xcd408) val(0) kern :err : [25507.608604] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.611988] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.617420] isys dma store at addr(0xcd408) val(0) kern :err : [25507.618429] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.618811] atomisp-isp2 0000:00:03.0: atomisp_g_parm(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.622193] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.627355] isys dma store at addr(0xcd408) val(0) kern :err : [25507.628391] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.631143] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.635813] isys dma store at addr(0xcd408) val(0) kern :err : [25507.636489] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.636504] atomisp-isp2 0000:00:03.0: atomisp_s_input(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.636516] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.639111] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.646152] isys dma store at addr(0xcd408) val(0) kern :err : [25507.646831] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.646847] atomisp-isp2 0000:00:03.0: atomisp_s_input(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.650079] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.657476] isys dma store at addr(0xcd408) val(0) kern :err : [25507.658741] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.658759] atomisp-isp2 0000:00:03.0: atomisp_s_input(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.658771] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.660959] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.666665] isys dma store at addr(0xcd408) val(0) kern :err : [25507.667397] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 73 +++++++++++++++ .../staging/media/atomisp/pci/atomisp_fops.c | 6 ++ .../staging/media/atomisp/pci/atomisp_ioctl.c | 90 +++++++++++++++++++ 3 files changed, 169 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +73 -0
@@ -1715,6 +1715,12 @@ void atomisp_wdt_refresh_pipe(struct atomisp_video_pipe *pipe, {unsigned long next; +if (!pipe->asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, pipe->vdev.name); +return ; + } +if (delay !=ATOMISP_WDT_KEEP_CURRENT_DELAY ) pipe->wdt_duration = delay;
@@ -1777,6 +1783,12 @@ void atomisp_wdt_refresh(struct atomisp_sub_device *asd, unsigned int delay)/* ISP2401 */ void atomisp_wdt_stop_pipe (struct atomisp_video_pipe *pipe,bool sync) { +if (!pipe->asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, pipe->vdev.name); +return ; + } +if (!atomisp_is_wdt_running (pipe))return ;
@@ -4109,6 +4121,12 @@ void atomisp_handle_parameter_and_buffer(struct atomisp_video_pipe *pipe)unsigned long irqflags;bool need_to_enqueue_buffer = false; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, pipe->vdev.name); +return ; + } +if (atomisp_is_vf_pipe (pipe))return ;
@@ -4196,6 +4214,12 @@ int atomisp_set_parameters(struct video_device *vdev,struct atomisp_css_params *css_param = &asd->params.css_param;int ret; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +if (!asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL ].stream) {dev_err (asd->isp->dev,"%s: internal error!\n" , __func__);return -EINVAL ;
@@ -4857,6 +4881,12 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,int source_pad =atomisp_subdev_source_pad (vdev);int ret; +if (!asd) { +dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +if (!isp->inputs[asd->input_curr].camera)return -EINVAL ;
@@ -5198,6 +5228,12 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev,const struct atomisp_in_fmt_conv *fc;int ret, i; +if (!asd) { +dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +v4l2_fh_init (&fh.vfh, vdev); isp_sink_crop = atomisp_subdev_get_rect(
@@ -5494,6 +5530,7 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev, unsigned int dvs_env_w, unsigned int dvs_env_h) { struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; +struct atomisp_video_pipe *pipe =atomisp_to_video_pipe (vdev);const struct atomisp_format_bridge *format;struct v4l2_subdev_pad_config pad_cfg; struct v4l2_subdev_state pad_state = {
@@ -5512,6 +5549,12 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev,struct v4l2_subdev_fh fh;int ret; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +v4l2_fh_init (&fh.vfh, vdev); stream_index =atomisp_source_pad_to_stream_id (asd, source_pad);
@@ -5602,6 +5645,12 @@ int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f)struct v4l2_subdev_fh fh;int ret; +if (!asd) { +dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +if (source_pad >=ATOMISP_SUBDEV_PADS_NUM )return -EINVAL ;
@@ -6034,6 +6083,12 @@ int atomisp_set_fmt_file(struct video_device *vdev, struct v4l2_format *f)struct v4l2_subdev_fh fh;int ret; +if (!asd) { +dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +v4l2_fh_init (&fh.vfh, vdev); dev_dbg(isp->dev, "setting fmt %ux%u 0x%x for file inject\n",
@@ -6359,6 +6414,12 @@ bool atomisp_is_vf_pipe(struct atomisp_video_pipe *pipe) {struct atomisp_sub_device *asd = pipe->asd; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, pipe->vdev.name); +return false; + } +if (pipe == &asd->video_out_vf)return true;
@@ -6572,6 +6633,12 @@ static int atomisp_get_pipe_id(struct atomisp_video_pipe *pipe) {struct atomisp_sub_device *asd = pipe->asd; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, pipe->vdev.name); +return -EINVAL ; + } +if (ATOMISP_USE_YUVPP (asd)) {return IA_CSS_PIPE_ID_YUVPP ; }else if (asd->vfpp->val ==ATOMISP_VFPP_DISABLE_SCALER ) {
@@ -6609,6 +6676,12 @@ int atomisp_get_invalid_frame_num(struct video_device *vdev,struct ia_css_pipe_info p_info;int ret; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +if (asd->isp->inputs[asd->input_curr].camera_caps-> sensor[asd->sensor_curr].stream_num >1 ) {/* External ISP */
drivers/staging/media/atomisp/pci/atomisp_fops.c +6 -0
@@ -1171,6 +1171,12 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma)u32 origin_size, new_size;int ret; +if (!asd) { +dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +if (!(vma->vm_flags & (VM_WRITE |VM_READ )))return -EACCES ;
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +90 -0
180 lines not on this page · raw message
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 128/1039 media: atomisp: fix enum formats logic
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit fae46cb0531b45c789e39128f676f2bafa3a7b47 ]
Changeset 374d62e7aa50 ("media: v4l2-subdev: Verify v4l2_subdev_call() pad config argument") added an extra verification for a pads parameter for enum mbus
format code.
Such change broke atomisp, because now the V4L2 core refuses to enum MBUS formats if the state is empty.
So, add .which field in order to select the active formats, in order to make it work again.
While here, improve error messages.
--- .../staging/media/atomisp/pci/atomisp_ioctl.c | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +17 -6
@@ -773,7 +773,10 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh,struct video_device *vdev =video_devdata (file);struct atomisp_device *isp =video_get_drvdata (vdev);struct atomisp_sub_device *asd =atomisp_to_video_pipe (vdev)->asd; -struct v4l2_subdev_mbus_code_enum code = {0 }; +struct v4l2_subdev_mbus_code_enum code = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + }; +struct v4l2_subdev *camera;unsigned int i, fi =0 ;int rval;
@@ -783,14 +786,20 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh,return -EINVAL ; } + camera = isp->inputs[asd->input_curr].camera; +if (!camera) { +dev_err (isp->dev,"%s(): camera is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +rt_mutex_lock (&isp->mutex); - rval =v4l2_subdev_call (isp->inputs[asd->input_curr].camera, pad, - enum_mbus_code,NULL , &code); + + rval =v4l2_subdev_call (camera, pad, enum_mbus_code,NULL , &code);if (rval == -ENOIOCTLCMD ) {dev_warn (isp->dev, -"enum_mbus_code pad op not supported. Please fix your sensor driver!\n" ); -// rval = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, -// video, enum_mbus_fmt, 0, &code.code); +"enum_mbus_code pad op not supported by %s. Please fix your sensor driver!\n" , + camera->name); }rt_mutex_unlock (&isp->mutex);
@@ -820,6 +829,8 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, f->pixelformat = format->pixelformat;return 0 ; } +dev_err (isp->dev,"%s(): format for code %x not found.\n" , + __func__, code.code);return -EINVAL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 129/1039 media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit cb4d67a998e97365afdf34965b069601da1dae60 ]
The "power" pointer is not initialized on the else path and that would lead to an Oops.
--- drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +1 -1
@@ -481,7 +481,7 @@ fail:static u8 gmin_get_pmic_id_and_addr (struct device *dev) { -struct i2c_client *power; +struct i2c_client *power =NULL ;static u8 pmic_i2c_addr;if (pmic_id)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 130/1039 media: aspeed: fix mode-detect always time out at 2nd run
In reply to Greg Kroah-HartmanFrom: Jammy Huang <[email protected]>
[ Upstream commit 62cea52ad4bead0ae4be2cfe1142eb0aae0e9fbd ]
aspeed_video_get_resolution() will try to do res-detect again if the timing got in last try is invalid. But it will always time out because VE_SEQ_CTRL_TRIG_MODE_DET is only cleared after 1st mode-detect.
To fix the problem, just clear VE_SEQ_CTRL_TRIG_MODE_DET before setting it in aspeed_video_enable_mode_detect().
--- drivers/media/platform/aspeed-video.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/aspeed-video.c +4 -4
@@ -539,6 +539,10 @@ static void aspeed_video_enable_mode_detect(struct aspeed_video *video)aspeed_video_update (video,VE_INTERRUPT_CTRL ,0 ,VE_INTERRUPT_MODE_DETECT ); +/* Disable mode detect in order to re-trigger */ +aspeed_video_update (video,VE_SEQ_CTRL , +VE_SEQ_CTRL_TRIG_MODE_DET ,0 ); +/* Trigger mode detect */ aspeed_video_update (video,VE_SEQ_CTRL ,0 ,VE_SEQ_CTRL_TRIG_MODE_DET ); }
@@ -824,10 +828,6 @@ static void aspeed_video_get_resolution(struct aspeed_video *video)return ; } -/* Disable mode detect in order to re-trigger */ -aspeed_video_update (video,VE_SEQ_CTRL , -VE_SEQ_CTRL_TRIG_MODE_DET ,0 ); -aspeed_video_check_and_set_polarity (video);aspeed_video_enable_mode_detect (video);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 131/1039 media: em28xx: fix memory leak in em28xx_init_dev
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit 22be5a10d0b24eec9e45decd15d7e6112b25f080 ]
In the em28xx_init_rev, if em28xx_audio_setup fails, this function fails to deallocate the media_dev allocated in the em28xx_media_device_init.
Fix this by adding em28xx_unregister_media_device to free media_dev.
BTW, this patch is tested in my local syzkaller instance, and it can prevent the memory leak from occurring again.
--- drivers/media/usb/em28xx/em28xx-cards.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/media/usb/em28xx/em28xx-cards.c +12 -6
@@ -3630,8 +3630,10 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,if (dev->is_audio_only) { retval =em28xx_audio_setup (dev); -if (retval) -return -ENODEV ; +if (retval) { + retval = -ENODEV ; + goto err_deinit_media; + }em28xx_init_extension (dev);return 0 ;
@@ -3650,7 +3652,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,dev_err (&dev->intf->dev,"%s: em28xx_i2c_register bus 0 - error [%d]!\n" , __func__, retval); -return retval; + goto err_deinit_media; }/* register i2c bus 1 */
@@ -3666,9 +3668,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,"%s: em28xx_i2c_register bus 1 - error [%d]!\n" , __func__, retval); -em28xx_i2c_unregister (dev,0 ); - -return retval; + goto err_unreg_i2c; } }
@@ -3676,6 +3676,12 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,em28xx_card_setup (dev);return 0 ; + +err_unreg_i2c: +em28xx_i2c_unregister (dev,0 ); +err_deinit_media: +em28xx_unregister_media_device (dev); +return retval; }static int em28xx_duplicate_dev (struct em28xx *dev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 132/1039 media: aspeed: Update signal status immediately to ensure sane hw state
In reply to Greg Kroah-HartmanFrom: Jammy Huang <[email protected]>
[ Upstream commit af6d1bde395cac174ee71adcd3fa43f6435c7206 ]
If res-chg, VE_INTERRUPT_MODE_DETECT_WD irq will be raised. But v4l2_input_status won't be updated to no-signal immediately until aspeed_video_get_resolution() in aspeed_video_resolution_work().
During the period of time, aspeed_video_start_frame() could be called because it doesn't know signal becomes unstable now. If it goes with aspeed_video_init_regs() of aspeed_video_irq_res_change() simultaneously, it will mess up hw state.
To fix this problem, v4l2_input_status is updated to no-signal immediately for VE_INTERRUPT_MODE_DETECT_WD irq.
--- drivers/media/platform/aspeed-video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/aspeed-video.c +3 -3
@@ -595,6 +595,8 @@ static void aspeed_video_irq_res_change(struct aspeed_video *video, ulong delay)set_bit (VIDEO_RES_CHANGE , &video->flags);clear_bit (VIDEO_FRAME_INPRG , &video->flags); + video->v4l2_input_status =V4L2_IN_ST_NO_SIGNAL ; +aspeed_video_off (video);aspeed_video_bufs_done (video,VB2_BUF_STATE_ERROR );
@@ -1375,7 +1377,6 @@ static void aspeed_video_resolution_work(struct work_struct *work)struct delayed_work *dwork =to_delayed_work (work); struct aspeed_video *video = container_of(dwork, struct aspeed_video, res_work); -u32 input_status = video->v4l2_input_status;aspeed_video_on (video);
@@ -1388,8 +1389,7 @@ static void aspeed_video_resolution_work(struct work_struct *work)aspeed_video_get_resolution (video);if (video->detected_timings.width != video->active_timings.width || - video->detected_timings.height != video->active_timings.height || - input_status != video->v4l2_input_status) { + video->detected_timings.height != video->active_timings.height) {static const struct v4l2_event ev = { .type =V4L2_EVENT_SOURCE_CHANGE , .u.src_change.changes =V4L2_EVENT_SRC_CH_RESOLUTION ,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 133/1039 arm64: dts: amlogic: meson-g12: Fix GPU operating point table node name
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit bb98a6fd0b0e227cefb2ba91cea2b55455f203b7 ]
Starting with commit 94274f20f6bf ("dt-bindings: opp: Convert to DT schema") the opp node name has a mandatory pattern. This change fixes the dtbs_check warning:
gpu-opp-table: $nodename:0: 'gpu-opp-table' does not match '^opp-table(-[a-z0-9]+)?$'
Put the 'gpu' part at the end to match the pattern.
--- arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +1 -1
@@ -58,7 +58,7 @@ secure-monitor = <&sm>; }; - gpu_opp_table: gpu-opp-table { + gpu_opp_table: opp-table-gpu { compatible = "operating-points-v2"; opp-124999998 {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 134/1039 arm64: dts: amlogic: Fix SPI NOR flash node name for ODROID N2/N2+
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 95d35256b564aca33fb661eac77dc94bfcffc8df ]
Fix the schema warning: "spi-flash@0: $nodename:0: 'spi-flash@0' does
not match '^flash(@.*)?$'" from jedec,spi-nor.yaml
--- arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +1 -1
@@ -609,7 +609,7 @@ pinctrl-0 = <&nor_pins>; pinctrl-names = "default"; - mx25u64: spi-flash@0 { + mx25u64: flash@0 { #address-cells = <1>; #size-cells = <1>; compatible = "mxicy,mx25u6435f", "jedec,spi-nor";
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 135/1039 arm64: dts: meson-gxbb-wetek: fix HDMI in early boot
In reply to Greg Kroah-HartmanFrom: Christian Hewitt <[email protected]>
[ Upstream commit 8182a35868db5f053111d5d9d4da8fcb3f99259d ]
Mark the VDDIO_AO18 regulator always-on and set hdmi-supply for the hdmi_tx node to ensure HDMI is powered in the early stages of boot.
--- arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +2 -0
@@ -64,6 +64,7 @@ regulator-name = "VDDIO_AO18"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; + regulator-always-on; }; vcc_3v3: regulator-vcc_3v3 {
@@ -161,6 +162,7 @@ status = "okay"; pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; pinctrl-names = "default"; + hdmi-supply = <&vddio_ao18>; }; &hdmi_tx_tmds_port {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 136/1039 arm64: dts: meson-gxbb-wetek: fix missing GPIO binding
In reply to Greg Kroah-HartmanFrom: Christian Hewitt <[email protected]>
[ Upstream commit c019abb2feba3cbbd7cf7178f8e6499c4fa6fced ]
The absence of this binding appears to be harmless in Linux but it breaks Ethernet support in mainline u-boot. So add the binding (which is present in all other u-boot supported GXBB device-trees).
--- arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +1 -0
@@ -6,6 +6,7 @@ */ #include "meson-gxbb.dtsi" +#include <dt-bindings/gpio/gpio.h> / { aliases {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 137/1039 fs: dlm: dont call kernel_getpeername() in error_report()
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 4c3d90570bcc2b338f70f61f01110268e281ca3c ]
In some cases kernel_getpeername() will held the socket lock which is already held when the socket layer calls error_report() callback. Since commit 9dfc685e0262 ("inet: remove races in inet{6}_getname()") this problem becomes more likely because the socket lock will be held always. You will see something like:
bob9-u5 login: [ 562.316860] BUG: spinlock recursion on CPU#7, swapper/7/0
[ 562.318562] lock: 0xffff8f2284720088, .magic: dead4ead, .owner: swapper/7/0, .owner_cpu: 7 [ 562.319522] CPU: 7 PID: 0 Comm: swapper/7 Not tainted 5.15.0+ #135 [ 562.320346] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.13.0-2.module+el8.3.0+7353+9de0a3cc 04/01/2014 [ 562.321277] Call Trace: [ 562.321529] <IRQ> [ 562.321734] dump_stack_lvl+0x33/0x42 [ 562.322282] do_raw_spin_lock+0x8b/0xc0 [ 562.322674] lock_sock_nested+0x1e/0x50 [ 562.323057] inet_getname+0x39/0x110 [ 562.323425] ? sock_def_readable+0x80/0x80 [ 562.323838] lowcomms_error_report+0x63/0x260 [dlm] [ 562.324338] ? wait_for_completion_interruptible_timeout+0xd2/0x120 [ 562.324949] ? lock_timer_base+0x67/0x80 [ 562.325330] ? do_raw_spin_unlock+0x49/0xc0 [ 562.325735] ? _raw_spin_unlock_irqrestore+0x1e/0x40 [ 562.326218] ? del_timer+0x54/0x80 [ 562.326549] sk_error_report+0x12/0x70 [ 562.326919] tcp_validate_incoming+0x3c8/0x530 [ 562.327347] ? kvm_clock_read+0x14/0x30 [ 562.327718] ? ktime_get+0x3b/0xa0 [ 562.328055] tcp_rcv_established+0x121/0x660 [ 562.328466] tcp_v4_do_rcv+0x132/0x260 [ 562.328835] tcp_v4_rcv+0xcea/0xe20 [ 562.329173] ip_protocol_deliver_rcu+0x35/0x1f0 [ 562.329615] ip_local_deliver_finish+0x54/0x60 [ 562.330050] ip_local_deliver+0xf7/0x110 [ 562.330431] ? inet_rtm_getroute+0x211/0x840 [ 562.330848] ? ip_protocol_deliver_rcu+0x1f0/0x1f0 [ 562.331310] ip_rcv+0xe1/0xf0 [ 562.331603] ? ip_local_deliver+0x110/0x110 [ 562.332011] __netif_receive_skb_core+0x46a/0x1040 [ 562.332476] ? inet_gro_receive+0x263/0x2e0 [ 562.332885] __netif_receive_skb_list_core+0x13b/0x2c0 [ 562.333383] netif_receive_skb_list_internal+0x1c8/0x2f0 [ 562.333896] ? update_load_avg+0x7e/0x5e0 [ 562.334285] gro_normal_list.part.149+0x19/0x40 [ 562.334722] napi_complete_done+0x67/0x160 [ 562.335134] virtnet_poll+0x2ad/0x408 [virtio_net] [ 562.335644] __napi_poll+0x28/0x140 [ 562.336012] net_rx_action+0x23d/0x300 [ 562.336414] __do_softirq+0xf2/0x2ea [ 562.336803] irq_exit_rcu+0xc1/0xf0 [ 562.337173] common_interrupt+0xb9/0xd0
It is and was always forbidden to call kernel_getpeername() in context of error_report(). To get rid of the problem we access the destination address for the peer over the socket structure. While on it we fix to print out the destination port of the inet socket.
--- fs/dlm/lowcomms.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-)
fs/dlm/lowcomms.c +20 -22
@@ -592,8 +592,8 @@ int dlm_lowcomms_nodes_set_mark(int nodeid, unsigned int mark)static void lowcomms_error_report (struct sock *sk) {struct connection *con; -struct sockaddr_storage saddr;void (*orig_report)(struct sock *) =NULL ; +struct inet_sock *inet;read_lock_bh (&sk->sk_callback_lock); con =sock2con (sk);
@@ -601,33 +601,31 @@ static void lowcomms_error_report(struct sock *sk) goto out; orig_report = listen_sock.sk_error_report; -if (kernel_getpeername (sk->sk_socket, (struct sockaddr *)&saddr) <0 ) { -printk_ratelimited (KERN_ERR "dlm: node %d: socket error " -"sending to node %d, port %d, " -"sk_err=%d/%d\n" ,dlm_our_nodeid (), - con->nodeid, dlm_config.ci_tcp_port, - sk->sk_err, sk->sk_err_soft); - }else if (saddr.ss_family ==AF_INET ) { -struct sockaddr_in *sin4 = (struct sockaddr_in *)&saddr; + inet =inet_sk (sk); +switch (sk->sk_family) { +case AF_INET :printk_ratelimited (KERN_ERR "dlm: node %d: socket error " -"sending to node %d at %pI4, port %d, " +"sending to node %d at %pI4, dport %d, " "sk_err=%d/%d\n" ,dlm_our_nodeid (), - con->nodeid, &sin4->sin_addr.s_addr, - dlm_config.ci_tcp_port, sk->sk_err, + con->nodeid, &inet->inet_daddr, +ntohs (inet->inet_dport), sk->sk_err, sk->sk_err_soft); - }else { -struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&saddr; - +break ; +case AF_INET6 :printk_ratelimited (KERN_ERR "dlm: node %d: socket error " -"sending to node %d at %u.%u.%u.%u, " -"port %d, sk_err=%d/%d\n" ,dlm_our_nodeid (), - con->nodeid, sin6->sin6_addr.s6_addr32[0 ], - sin6->sin6_addr.s6_addr32[1 ], - sin6->sin6_addr.s6_addr32[2 ], - sin6->sin6_addr.s6_addr32[3 ], - dlm_config.ci_tcp_port, sk->sk_err, +"sending to node %d at %pI6c, " +"dport %d, sk_err=%d/%d\n" ,dlm_our_nodeid (), + con->nodeid, &sk->sk_v6_daddr, +ntohs (inet->inet_dport), sk->sk_err, sk->sk_err_soft); +break ; +default : +printk_ratelimited (KERN_ERR "dlm: node %d: socket error " +"invalid socket family %d set, " +"sk_err=%d/%d\n" ,dlm_our_nodeid (), + sk->sk_family, sk->sk_err, sk->sk_err_soft); + goto out; }/* below sendcon only handling */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 138/1039 memory: renesas-rpc-if: Return error in case devm_ioremap_resource() fails
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit 818fdfa89baac77a8df5a2c30f4fb798cc937aa0 ]
Make sure we return error in case devm_ioremap_resource() fails for dirmap resource.
--- drivers/memory/renesas-rpc-if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memory/renesas-rpc-if.c +1 -1
@@ -243,7 +243,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev) res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"dirmap" ); rpc->dirmap =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (rpc->dirmap)) - rpc->dirmap =NULL ; +return PTR_ERR (rpc->dirmap); rpc->size =resource_size (res); rpc->rstc =devm_reset_control_get_exclusive (&pdev->dev,NULL );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 139/1039 Bluetooth: stop proccessing malicious adv data
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 3a56ef719f0b9682afb8a86d64b2399e36faa4e6 ]
Syzbot reported slab-out-of-bounds read in hci_le_adv_report_evt(). The problem was in missing validaion check.
We should check if data is not malicious and we can read next data block. If we won't check ptr validness, code can read a way beyond skb->end and it can cause problems, of course.
--- net/bluetooth/hci_event.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/bluetooth/hci_event.c +7 -1
@@ -5825,7 +5825,8 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)struct hci_ev_le_advertising_info *ev = ptr;s8 rssi; -if (ev->length <=HCI_MAX_AD_LENGTH ) { +if (ev->length <=HCI_MAX_AD_LENGTH && + ev->data + ev->length <=skb_tail_pointer (skb)) { rssi = ev->data[ev->length]; process_adv_report(hdev, ev->evt_type, &ev->bdaddr, ev->bdaddr_type, NULL, 0, rssi,
@@ -5835,6 +5836,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) } ptr +=sizeof (*ev) + ev->length +1 ; + +if (ptr > (void *)skb_tail_pointer (skb) -sizeof (*ev)) { +bt_dev_err (hdev,"Malicious advertising data. Stopping processing" ); +break ; + } }hci_dev_unlock (hdev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 140/1039 Bluetooth: fix uninitialized variables notify_evt
In reply to Greg Kroah-HartmanFrom: Jackie Liu <[email protected]>
[ Upstream commit a27c519a816437ec92f0ffa3adbc168c2c08725b ]
Coverity Scan report:
[...]
*** CID 1493985: Uninitialized variables (UNINIT) /net/bluetooth/hci_event.c: 4535 in hci_sync_conn_complete_evt() 4529
4530 /* Notify only in case of SCO over HCI transport data path which
4531 * is zero and non-zero value shall be non-HCI transport data path
4532 */
4533 if (conn->codec.data_path == 0) {
4534 if (hdev->notify)Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
CID 1493985: Uninitialized variables (UNINIT)
Using uninitialized value "notify_evt" when calling "*hdev->notify".
4535 hdev->notify(hdev, notify_evt);
4536 }
4537
4538 hci_connect_cfm(conn, ev->status); 4539 if (ev->status) 4540 hci_conn_del(conn);
[...]
Although only btusb uses air_mode, and he only handles HCI_NOTIFY_ENABLE_SCO_CVSD and HCI_NOTIFY_ENABLE_SCO_TRANSP, there is still a very small chance that ev->air_mode is not equal to 0x2 and 0x3, but notify_evt is initialized to HCI_NOTIFY_ENABLE_SCO_CVSD or HCI_NOTIFY_ENABLE_SCO_TRANSP. the context is maybe not correct.
Let us directly use the required function instead of re-initializing it, so as to restore the original logic and make the code more correct.
Addresses-Coverity: ("Uninitialized variables")
--- net/bluetooth/hci_event.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
net/bluetooth/hci_event.c +9 -14
@@ -4445,7 +4445,6 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, {struct hci_ev_sync_conn_complete *ev = (void *) skb->data;struct hci_conn *conn; -unsigned int notify_evt;BT_DBG ("%s status 0x%2.2x" , hdev->name, ev->status);
@@ -4517,22 +4516,18 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, }bt_dev_dbg (hdev,"SCO connected with air mode: %02x" , ev->air_mode); - -switch (ev->air_mode) { -case 0x02 : - notify_evt =HCI_NOTIFY_ENABLE_SCO_CVSD ; -break ; -case 0x03 : - notify_evt =HCI_NOTIFY_ENABLE_SCO_TRANSP ; -break ; - } -/* Notify only in case of SCO over HCI transport data path which * is zero and non-zero value shall be non-HCI transport data path */ -if (conn->codec.data_path ==0 ) { -if (hdev->notify) - hdev->notify (hdev, notify_evt); +if (conn->codec.data_path ==0 && hdev->notify) { +switch (ev->air_mode) { +case 0x02 : + hdev->notify (hdev,HCI_NOTIFY_ENABLE_SCO_CVSD ); +break ; +case 0x03 : + hdev->notify (hdev,HCI_NOTIFY_ENABLE_SCO_TRANSP ); +break ; + } }hci_connect_cfm (conn, ev->status);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 141/1039 ath11k: Fix ETSI regd with weather radar overlap
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
[ Upstream commit 086c921a354089f209318501038d43c98d3f409f ]
Some ETSI countries have a small overlap in the wireless-regdb with an ETSI channel (5590-5650). A good example is Australia:
country AU: DFS-ETSI
(2400 - 2483.5 @ 40), (36)
(5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW (5250 - 5350 @ 80), (20), NO-OUTDOOR, AUTO-BW, DFS (5470 - 5600 @ 80), (27), DFS
(5650 - 5730 @ 80), (27), DFS
(5730 - 5850 @ 80), (36)
(57000 - 66000 @ 2160), (43), NO-OUTDOOR
If the firmware (or the BDF) is shipped with these rules then there is only a 10 MHz overlap with the weather radar:
* below: 5470 - 5590
* weather radar: 5590 - 5600
* above: (none for the rule "5470 - 5600 @ 80")
There are several wrong assumption in the ath11k code:
* there is always a valid range below the weather radar (actually: there could be no range below the weather radar range OR range could be smaller than 20 MHz)
* intersected range in the weather radar range is valid (actually: the range could be smaller than 20 MHz)
* range above weather radar is either empty or valid
(actually: the range could be smaller than 20 MHz)
These wrong assumption will lead in this example to a rule
(5590 - 5600 @ 20), (N/A, 27), (600000 ms), DFS, AUTO-BW
which is invalid according to is_valid_reg_rule() because the freq_diff is only 10 MHz but the max_bandwidth is set to 20 MHz. Which results in a rejection like:
WARNING: at backports-20210222_001-4.4.60-b157d2276/net/wireless/reg.c:3984 [...] Call trace: [<ffffffbffc3d2e50>] reg_get_max_bandwidth+0x300/0x3a8 [cfg80211] [<ffffffbffc3d3d0c>] regulatory_set_wiphy_regd_sync+0x3c/0x98 [cfg80211] [<ffffffbffc651598>] ath11k_regd_update+0x1a8/0x210 [ath11k] [<ffffffbffc652108>] ath11k_regd_update_work+0x18/0x20 [ath11k] [<ffffffc0000a93e0>] process_one_work+0x1f8/0x340 [<ffffffc0000a9784>] worker_thread+0x25c/0x448 [<ffffffc0000aedc8>] kthread+0xd0/0xd8 [<ffffffc000085550>] ret_from_fork+0x10/0x40 ath11k c000000.wifi: failed to perform regd update : -22 Invalid regulatory domain detected
To avoid this, the algorithm has to be changed slightly. Instead of splitting a rule which overlaps with the weather radar range into 3 pieces and accepting the first two parts blindly, it must actually be checked for each piece whether it is a valid range. And only if it is valid, add it to the output array.
When these checks are in place, the processed rules for AU would end up as
country AU: DFS-ETSI
(2400 - 2483 @ 40), (N/A, 36), (N/A)
(5150 - 5250 @ 80), (6, 23), (N/A), NO-OUTDOOR, AUTO-BW
(5250 - 5350 @ 80), (6, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
(5470 - 5590 @ 80), (6, 27), (0 ms), DFS, AUTO-BW
(5650 - 5730 @ 80), (6, 27), (0 ms), DFS, AUTO-BW
(5730 - 5850 @ 80), (6, 36), (N/A), AUTO-BWand will be accepted by the wireless regulatory code.
--- drivers/net/wireless/ath/ath11k/reg.c | 103 ++++++++++++++------------ 1 file changed, 56 insertions(+), 47 deletions(-)
drivers/net/wireless/ath/ath11k/reg.c +56 -47
@@ -456,6 +456,9 @@ ath11k_reg_adjust_bw(u16 start_freq, u16 end_freq, u16 max_bw) {u16 bw; +if (end_freq <= start_freq) +return 0 ; + bw = end_freq - start_freq; bw =min_t (u16, bw, max_bw);
@@ -463,8 +466,10 @@ ath11k_reg_adjust_bw(u16 start_freq, u16 end_freq, u16 max_bw) bw =80 ; else if (bw >= 40 && bw < 80) bw =40 ; - else if (bw < 40) + else if (bw >= 20 && bw < 40) bw =20 ; + else + bw =0 ;return bw; }
@@ -488,73 +493,77 @@ ath11k_reg_update_weather_radar_band(struct ath11k_base *ab,struct cur_reg_rule *reg_rule, u8 *rule_idx, u32 flags, u16 max_bw) { + u32 start_freq;u32 end_freq;u16 bw;u8 i; i = *rule_idx; +/* there might be situations when even the input rule must be dropped */ + i--; + +/* frequencies below weather radar */ bw =ath11k_reg_adjust_bw (reg_rule->start_freq,ETSI_WEATHER_RADAR_BAND_LOW , max_bw); +if (bw >0 ) { + i++; -ath11k_reg_update_rule (regd->reg_rules + i, reg_rule->start_freq, -ETSI_WEATHER_RADAR_BAND_LOW , bw, - reg_rule->ant_gain, reg_rule->reg_power, - flags); +ath11k_reg_update_rule (regd->reg_rules + i, + reg_rule->start_freq, +ETSI_WEATHER_RADAR_BAND_LOW , bw, + reg_rule->ant_gain, reg_rule->reg_power, + flags); -ath11k_dbg (ab,ATH11K_DBG_REG , -"\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n" , - i +1 , reg_rule->start_freq,ETSI_WEATHER_RADAR_BAND_LOW , - bw, reg_rule->ant_gain, reg_rule->reg_power, - regd->reg_rules[i].dfs_cac_ms, - flags); - -if (reg_rule->end_freq >ETSI_WEATHER_RADAR_BAND_HIGH ) - end_freq =ETSI_WEATHER_RADAR_BAND_HIGH ; -else - end_freq = reg_rule->end_freq; +ath11k_dbg (ab,ATH11K_DBG_REG , +"\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n" , + i +1 , reg_rule->start_freq, +ETSI_WEATHER_RADAR_BAND_LOW , bw, reg_rule->ant_gain, + reg_rule->reg_power, regd->reg_rules[i].dfs_cac_ms, + flags); + } - bw =ath11k_reg_adjust_bw (ETSI_WEATHER_RADAR_BAND_LOW , end_freq, - max_bw); +/* weather radar frequencies */ + start_freq =max_t (u32, reg_rule->start_freq, +ETSI_WEATHER_RADAR_BAND_LOW ); + end_freq =min_t (u32, reg_rule->end_freq,ETSI_WEATHER_RADAR_BAND_HIGH ); - i++; + bw =ath11k_reg_adjust_bw (start_freq, end_freq, max_bw); +if (bw >0 ) { + i++; -ath11k_reg_update_rule (regd->reg_rules + i, -ETSI_WEATHER_RADAR_BAND_LOW , end_freq, bw, - reg_rule->ant_gain, reg_rule->reg_power, - flags); +ath11k_reg_update_rule (regd->reg_rules + i, start_freq, + end_freq, bw, reg_rule->ant_gain, + reg_rule->reg_power, flags); - regd->reg_rules[i].dfs_cac_ms =ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT ; + regd->reg_rules[i].dfs_cac_ms =ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT ; -ath11k_dbg (ab,ATH11K_DBG_REG , -"\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n" , - i +1 ,ETSI_WEATHER_RADAR_BAND_LOW , end_freq, - bw, reg_rule->ant_gain, reg_rule->reg_power, - regd->reg_rules[i].dfs_cac_ms, - flags); - -if (end_freq == reg_rule->end_freq) { - regd->n_reg_rules--; - *rule_idx = i; -return ; +ath11k_dbg (ab,ATH11K_DBG_REG , +"\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n" , + i +1 , start_freq, end_freq, bw, + reg_rule->ant_gain, reg_rule->reg_power, + regd->reg_rules[i].dfs_cac_ms, flags); } +/* frequencies above weather radar */ bw =ath11k_reg_adjust_bw (ETSI_WEATHER_RADAR_BAND_HIGH , reg_rule->end_freq, max_bw); +if (bw >0 ) { + i++; - i++; - -ath11k_reg_update_rule (regd->reg_rules + i,ETSI_WEATHER_RADAR_BAND_HIGH , - reg_rule->end_freq, bw, - reg_rule->ant_gain, reg_rule->reg_power, - flags); +ath11k_reg_update_rule (regd->reg_rules + i, +ETSI_WEATHER_RADAR_BAND_HIGH , + reg_rule->end_freq, bw, + reg_rule->ant_gain, reg_rule->reg_power, + flags); -ath11k_dbg (ab,ATH11K_DBG_REG , -"\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n" , - i +1 ,ETSI_WEATHER_RADAR_BAND_HIGH , reg_rule->end_freq, - bw, reg_rule->ant_gain, reg_rule->reg_power, - regd->reg_rules[i].dfs_cac_ms, - flags); +ath11k_dbg (ab,ATH11K_DBG_REG , +"\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n" , + i +1 ,ETSI_WEATHER_RADAR_BAND_HIGH , + reg_rule->end_freq, bw, reg_rule->ant_gain, + reg_rule->reg_power, regd->reg_rules[i].dfs_cac_ms, + flags); + } *rule_idx = i; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 142/1039 ath11k: clear the keys properly via DISABLE_KEY
In reply to Greg Kroah-HartmanFrom: Karthikeyan Kathirvel <[email protected]>
[ Upstream commit 436a4e88659842a7cf634d7cc088c8f2cc94ebf5 ]
DISABLE_KEY sets the key_len to 0, firmware will not delete the keys if key_len is 0. Changing from security mode to open mode will cause mcast to be still encrypted without vdev restart.
Set the proper key_len for DISABLE_KEY cmd to clear the keys in firmware.
Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/mac.c | 4 +--- drivers/net/wireless/ath/ath11k/wmi.c | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +1 -3
@@ -3316,9 +3316,7 @@ static int ath11k_install_key(struct ath11k_vif *arvif,return 0 ;if (cmd ==DISABLE_KEY ) { -/* TODO: Check if FW expects value other than NONE for del */ -/* arg.key_cipher = WMI_CIPHER_NONE; */ - arg.key_len =0 ; + arg.key_cipher =WMI_CIPHER_NONE ; arg.key_data =NULL ; goto install; }
drivers/net/wireless/ath/ath11k/wmi.c +2 -1
@@ -1689,7 +1689,8 @@ int ath11k_wmi_vdev_install_key(struct ath11k *ar, tlv = (struct wmi_tlv *)(skb->data +sizeof (*cmd)); tlv->header =FIELD_PREP (WMI_TLV_TAG ,WMI_TAG_ARRAY_BYTE ) |FIELD_PREP (WMI_TLV_LEN , key_len_aligned); -memcpy (tlv->value, (u8 *)arg->key_data, key_len_aligned); +if (arg->key_data) +memcpy (tlv->value, (u8 *)arg->key_data, key_len_aligned); ret =ath11k_wmi_cmd_send (wmi, skb,WMI_VDEV_INSTALL_KEY_CMDID );if (ret) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 143/1039 ath11k: reset RSN/WPA present state for open BSS
In reply to Greg Kroah-HartmanFrom: Karthikeyan Kathirvel <[email protected]>
[ Upstream commit 64bc3aa02ae78b1fcb1b850e0eb1f0622002bfaa ]
The ath11k driver is caching the information about RSN/WPA IE in the configured beacon template. The cached information is used during associations to figure out whether 4-way PKT/2-way GTK peer flags need to be set or not.
But the code never cleared the state when no such IE was found. This can for example happen when moving from an WPA/RSN to an open setup. The (seemingly connected) peer was then not able to communicate over the link because the firmware assumed a different (encryption enabled) state for the peer.
Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/mac.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath11k/mac.c +4 -0
@@ -1137,11 +1137,15 @@ static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)if (cfg80211_find_ie (WLAN_EID_RSN , ies, (skb_tail_pointer (bcn) - ies))) arvif->rsnie_present = true; +else + arvif->rsnie_present = false;if (cfg80211_find_vendor_ie (WLAN_OUI_MICROSOFT ,WLAN_OUI_TYPE_MICROSOFT_WPA , ies, (skb_tail_pointer (bcn) - ies))) arvif->wpaie_present = true; +else + arvif->wpaie_present = false; ret =ath11k_wmi_bcn_tmpl (ar, arvif->vdev_id, &offs, bcn);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 144/1039 spi: hisi-kunpeng: Fix the debugfs directory name incorrect
In reply to Greg Kroah-HartmanFrom: oujiefeng <[email protected]>
[ Upstream commit 40fafc8eca3f0d41b9dade5c10afb2dad723aad7 ]
Change the debugfs directory name from hisi_spi65535 to hisi_spi0.
--- drivers/spi/spi-hisi-kunpeng.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/spi/spi-hisi-kunpeng.c +8 -7
@@ -127,7 +127,6 @@ struct hisi_spi {void __iomem *regs;int irq;u32 fifo_len;/* depth of the FIFO buffer */ -u16 bus_num;/* Current message transfer state info */ const void *tx;
@@ -165,7 +164,10 @@ static int hisi_spi_debugfs_init(struct hisi_spi *hs) {char name[32 ]; -snprintf (name,32 ,"hisi_spi%d" , hs->bus_num); +struct spi_controller *master; + + master = container_of(hs->dev, struct spi_controller, dev); +snprintf (name,32 ,"hisi_spi%d" , master->bus_num); hs->debugfs =debugfs_create_dir (name,NULL );if (!hs->debugfs)return -ENOMEM ;
@@ -467,7 +469,6 @@ static int hisi_spi_probe(struct platform_device *pdev) hs =spi_controller_get_devdata (master); hs->dev = dev; hs->irq = irq; - hs->bus_num = pdev->id; hs->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (hs->regs))
@@ -490,7 +491,7 @@ static int hisi_spi_probe(struct platform_device *pdev) master->use_gpio_descriptors = true; master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LOOP ; master->bits_per_word_mask =SPI_BPW_RANGE_MASK (4 ,32 ); - master->bus_num = hs->bus_num; + master->bus_num = pdev->id; master->setup = hisi_spi_setup; master->cleanup = hisi_spi_cleanup; master->transfer_one = hisi_spi_transfer_one;
@@ -506,15 +507,15 @@ static int hisi_spi_probe(struct platform_device *pdev)return ret; } -if (hisi_spi_debugfs_init (hs)) -dev_info (dev,"failed to create debugfs dir\n" ); - ret =spi_register_controller (master);if (ret) {dev_err (dev,"failed to register spi master, ret=%d\n" , ret);return ret; } +if (hisi_spi_debugfs_init (hs)) +dev_info (dev,"failed to create debugfs dir\n" ); +dev_info (dev,"hw version:0x%x max-freq:%u kHz\n" ,readl (hs->regs +HISI_SPI_VERSION ), master->max_speed_hz /1000 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 145/1039 tee: fix put order in teedev_close_context()
In reply to Greg Kroah-HartmanFrom: Jens Wiklander <[email protected]>
[ Upstream commit f18397ab3ae23e8e43bba9986e66af6d4497f2ad ]
Prior to this patch was teedev_close_context() calling tee_device_put() before teedev_ctx_put() leading to teedev_ctx_release() accessing ctx->teedev just after the reference counter was decreased on the teedev. Fix this by calling teedev_ctx_put() before tee_device_put().
--- drivers/tee/tee_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tee/tee_core.c +3 -1
@@ -98,8 +98,10 @@ void teedev_ctx_put(struct tee_context *ctx)static void teedev_close_context (struct tee_context *ctx) { -tee_device_put (ctx->teedev); +struct tee_device *teedev = ctx->teedev; +teedev_ctx_put (ctx); +tee_device_put (teedev); }static int tee_open (struct inode *inode,struct file *filp)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 146/1039 kernel/locking: Use a pointer in ww_mutex_trylock().
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 2202e15b2b1a946ce760d96748cd7477589701ab ]
mutex_acquire_nest() expects a pointer, pass the pointer.
--- kernel/locking/ww_rt_mutex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/locking/ww_rt_mutex.c +1 -1
@@ -26,7 +26,7 @@ int ww_mutex_trylock(struct ww_mutex *lock, struct ww_acquire_ctx *ww_ctx)if (__rt_mutex_trylock (&rtm->rtmutex)) {ww_mutex_set_context_fastpath (lock, ww_ctx); -mutex_acquire_nest (&rtm->dep_map,0 ,1 , ww_ctx->dep_map, _RET_IP_); +mutex_acquire_nest (&rtm->dep_map,0 ,1 , &ww_ctx->dep_map, _RET_IP_);return 1 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 147/1039 fs: dlm: fix build with CONFIG_IPV6 disabled
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 1b9beda83e27a0c2cd75d1cb743c297c7b36c844 ]
This patch will surround the AF_INET6 case in sk_error_report() of dlm with a #if IS_ENABLED(CONFIG_IPV6). The field sk->sk_v6_daddr is not defined when CONFIG_IPV6 is disabled. If CONFIG_IPV6 is disabled, the socket creation with AF_INET6 should already fail because a runtime check if AF_INET6 is registered. However if there is the possibility that AF_INET6 is set as sk_family the sk_error_report() callback will print then an invalid family type error.
--- fs/dlm/lowcomms.c | 2 ++ 1 file changed, 2 insertions(+)
fs/dlm/lowcomms.c +2 -0
@@ -612,6 +612,7 @@ static void lowcomms_error_report(struct sock *sk)ntohs (inet->inet_dport), sk->sk_err, sk->sk_err_soft);break ; +#if IS_ENABLED (CONFIG_IPV6 )case AF_INET6 :printk_ratelimited (KERN_ERR "dlm: node %d: socket error " "sending to node %d at %pI6c, "
@@ -620,6 +621,7 @@ static void lowcomms_error_report(struct sock *sk)ntohs (inet->inet_dport), sk->sk_err, sk->sk_err_soft);break ; +#endif default :printk_ratelimited (KERN_ERR "dlm: node %d: socket error " "invalid socket family %d set, "
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 148/1039 drm/dp: Dont read back backlight mode in drm_edp_backlight_enable()
In reply to Greg Kroah-HartmanFrom: Lyude Paul <[email protected]>
[ Upstream commit 646596485e1ed2182adf293dfd5aec4a96c46330 ]
As it turns out, apparently some machines will actually leave additional backlight functionality like dynamic backlight control on before the OS loads. Currently we don't take care to disable unsupported features when writing back the backlight mode, which can lead to some rather strange looking behavior when adjusting the backlight.
So, let's fix this by just not reading back the current backlight mode on initial enable. I don't think there should really be any downsides to this, and this will ensure we don't leave any unsupported functionality enabled.
This should fix at least one (but not all) of the issues seen with DPCD backlight support on fi-bdw-samus
v5:
* Just avoid reading back DPCD register - Doug Anderson
--- drivers/gpu/drm/drm_dp_helper.c | 40 ++++++++++----------------------- 1 file changed, 12 insertions(+), 28 deletions(-)
drivers/gpu/drm/drm_dp_helper.c +12 -28
@@ -3246,27 +3246,13 @@ int drm_edp_backlight_enable(struct drm_dp_aux *aux, const struct drm_edp_backli const u16 level) {int ret; -u8 dpcd_buf, new_dpcd_buf; +u8 dpcd_buf =DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; - ret =drm_dp_dpcd_readb (aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , &dpcd_buf); -if (ret !=1 ) { -drm_dbg_kms (aux->drm_dev, -"%s: Failed to read backlight mode: %d\n" , aux->name, ret); -return ret <0 ? ret : -EIO ; - } - - new_dpcd_buf = dpcd_buf; - -if ((dpcd_buf &DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ) !=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ) { - new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK ; - new_dpcd_buf |=DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD ; - -if (bl->pwmgen_bit_count) { - ret =drm_dp_dpcd_writeb (aux,DP_EDP_PWMGEN_BIT_COUNT , bl->pwmgen_bit_count); -if (ret !=1 ) -drm_dbg_kms (aux->drm_dev,"%s: Failed to write aux pwmgen bit count: %d\n" , - aux->name, ret); - } +if (bl->pwmgen_bit_count) { + ret =drm_dp_dpcd_writeb (aux,DP_EDP_PWMGEN_BIT_COUNT , bl->pwmgen_bit_count); +if (ret !=1 ) +drm_dbg_kms (aux->drm_dev,"%s: Failed to write aux pwmgen bit count: %d\n" , + aux->name, ret); }if (bl->pwm_freq_pre_divider) {
@@ -3276,16 +3262,14 @@ int drm_edp_backlight_enable(struct drm_dp_aux *aux, const struct drm_edp_backli"%s: Failed to write aux backlight frequency: %d\n" , aux->name, ret); else - new_dpcd_buf |= DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE; + dpcd_buf |= DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE; } -if (new_dpcd_buf != dpcd_buf) { - ret =drm_dp_dpcd_writeb (aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , new_dpcd_buf); -if (ret !=1 ) { -drm_dbg_kms (aux->drm_dev,"%s: Failed to write aux backlight mode: %d\n" , - aux->name, ret); -return ret <0 ? ret : -EIO ; - } + ret =drm_dp_dpcd_writeb (aux,DP_EDP_BACKLIGHT_MODE_SET_REGISTER , dpcd_buf); +if (ret !=1 ) { +drm_dbg_kms (aux->drm_dev,"%s: Failed to write aux backlight mode: %d\n" , + aux->name, ret); +return ret <0 ? ret : -EIO ; } ret =drm_edp_backlight_set_level (aux, bl, level);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 149/1039 selftests/bpf: Fix xdpxceiver failures for no hugepages
In reply to Greg Kroah-HartmanFrom: Tirthendu Sarkar <[email protected]>
[ Upstream commit dd7f091fd22b1dce6c20e8f7769aa068ed88ac6d ]
xsk_configure_umem() needs hugepages to work in unaligned mode. So when hugepages are not configured, 'unaligned' tests should be skipped which is determined by the helper function hugepages_present(). This function erroneously returns true with MAP_NORESERVE flag even when no hugepages are configured. The removal of this flag fixes the issue.
The test TEST_TYPE_UNALIGNED_INV_DESC also needs to be skipped when there are no hugepages. However, this was not skipped as there was no check for presence of hugepages and hence was failing. The check to skip the test has now been added.
--- tools/testing/selftests/bpf/xdpxceiver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/xdpxceiver.c +5 -1
@@ -1219,7 +1219,7 @@ static bool hugepages_present(struct ifobject *ifobject)void *bufs; bufs =mmap (NULL , mmap_sz,PROT_READ |PROT_WRITE , -MAP_PRIVATE |MAP_ANONYMOUS |MAP_NORESERVE |MAP_HUGETLB ,-1 ,0 ); +MAP_PRIVATE |MAP_ANONYMOUS |MAP_HUGETLB ,-1 ,0 );if (bufs ==MAP_FAILED )return false;
@@ -1366,6 +1366,10 @@ static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_testapp_invalid_desc (test);break ;case TEST_TYPE_UNALIGNED_INV_DESC : +if (!hugepages_present (test->ifobj_tx)) { +ksft_test_result_skip ("No 2M huge pages present.\n" ); +return ; + }test_spec_set_name (test,"UNALIGNED_INV_DESC" ); test->ifobj_tx->umem->unaligned_mode = true; test->ifobj_rx->umem->unaligned_mode = true;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 150/1039 mctp/test: Update refcount checking in route fragment tests
In reply to Greg Kroah-HartmanFrom: Jeremy Kerr <[email protected]>
[ Upstream commit f6ef47e5bdc6f652176e433b02317fc83049f8d7 ]
In 99ce45d5e, we moved a route refcount decrement from mctp_do_fragment_route into the caller. This invalidates the assumption that the route test makes about refcount behaviour, so the route tests fail.
This change fixes the test case to suit the new refcount behaviour.
--- net/mctp/test/route-test.c | 5 ----- 1 file changed, 5 deletions(-)
net/mctp/test/route-test.c +0 -5
@@ -150,11 +150,6 @@ static void mctp_test_fragment(struct kunit *test) rt =mctp_test_create_route (&init_net,NULL ,10 , mtu);KUNIT_ASSERT_TRUE (test, rt); -/* The refcount would usually be incremented as part of a route lookup, -* but we're setting the route directly here. -*/ -refcount_inc (&rt->rt.refs); - rc =mctp_do_fragment_route (&rt->rt, skb, mtu,MCTP_TAG_OWNER );KUNIT_EXPECT_FALSE (test, rc);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 151/1039 drm/vboxvideo: fix a NULL vs IS_ERR() check
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit cebbb5c46d0cb0615fd0c62dea9b44273d0a9780 ]
The devm_gen_pool_create() function never returns NULL, it returns error pointers.
--- drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vboxvideo/vbox_main.c +2 -2
@@ -127,8 +127,8 @@ int vbox_hw_init(struct vbox_private *vbox)/* Create guest-heap mem-pool use 2^4 = 16 byte chunks */ vbox->guest_pool =devm_gen_pool_create (vbox->ddev.dev,4 ,-1 ,"vboxvideo-accel" ); -if (!vbox->guest_pool) -return -ENOMEM ; +if (IS_ERR (vbox->guest_pool)) +return PTR_ERR (vbox->guest_pool); ret = gen_pool_add_virt(vbox->guest_pool, (unsigned long)vbox->guest_heap,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 152/1039 ath11k: set correct NL80211_FEATURE_DYNAMIC_SMPS for WCN6855
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit 82c434c103408842a87404e873992b7698b6df2b ]
Commit 6f4d70308e5e ("ath11k: support SMPS configuration for 6 GHz") changed "if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS)" to "if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS || ar->supports_6ghz)" which means NL80211_FEATURE_DYNAMIC_SMPS is enabled for all chips which support 6 GHz. However, WCN6855 supports 6 GHz but it does not support feature NL80211_FEATURE_DYNAMIC_SMPS, and this can lead to MU-MIMO test failures for WCN6855.
Disable NL80211_FEATURE_DYNAMIC_SMPS for WCN6855 since its ht_cap does not support WMI_HT_CAP_DYNAMIC_SMPS. Enable the feature only on QCN9074 as that's the only other device supporting 6 GHz band.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/core.c | 5 +++++ drivers/net/wireless/ath/ath11k/hw.h | 1 + drivers/net/wireless/ath/ath11k/mac.c | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/core.c +5 -0
@@ -82,6 +82,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fix_l1ss = true, .max_tx_ring = DP_TCL_NUM_RING_MAX, .hal_params = &ath11k_hw_hal_params_ipq8074, + .supports_dynamic_smps_6ghz = false, }, { .hw_rev = ATH11K_HW_IPQ6018_HW10,
@@ -131,6 +132,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fix_l1ss = true, .max_tx_ring = DP_TCL_NUM_RING_MAX, .hal_params = &ath11k_hw_hal_params_ipq8074, + .supports_dynamic_smps_6ghz = false, }, { .name = "qca6390 hw2.0",
@@ -179,6 +181,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fix_l1ss = true, .max_tx_ring = DP_TCL_NUM_RING_MAX_QCA6390, .hal_params = &ath11k_hw_hal_params_qca6390, + .supports_dynamic_smps_6ghz = false, }, { .name = "qcn9074 hw1.0",
@@ -227,6 +230,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fix_l1ss = true, .max_tx_ring = DP_TCL_NUM_RING_MAX, .hal_params = &ath11k_hw_hal_params_ipq8074, + .supports_dynamic_smps_6ghz = true, }, { .name = "wcn6855 hw2.0",
@@ -275,6 +279,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fix_l1ss = false, .max_tx_ring = DP_TCL_NUM_RING_MAX_QCA6390, .hal_params = &ath11k_hw_hal_params_qca6390, + .supports_dynamic_smps_6ghz = false, }, };
drivers/net/wireless/ath/ath11k/hw.h +1 -0
@@ -176,6 +176,7 @@ struct ath11k_hw_params {bool fix_l1ss;u8 max_tx_ring;const struct ath11k_hw_hal_params *hal_params; +bool supports_dynamic_smps_6ghz; };struct ath11k_hw_ops {
drivers/net/wireless/ath/ath11k/mac.c +2 -1
@@ -7674,7 +7674,8 @@ static int __ath11k_mac_register(struct ath11k *ar)* for each band for a dual band capable radio. It will be tricky to * handle it when the ht capability different for each band. */ -if (ht_cap &WMI_HT_CAP_DYNAMIC_SMPS || ar->supports_6ghz) +if (ht_cap &WMI_HT_CAP_DYNAMIC_SMPS || + (ar->supports_6ghz && ab->hw_params.supports_dynamic_smps_6ghz)) ar->hw->wiphy->features |=NL80211_FEATURE_DYNAMIC_SMPS ; ar->hw->wiphy->max_scan_ssids =WLAN_SCAN_PARAMS_MAX_SSID ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 153/1039 ath11k: allocate dst ring descriptors from cacheable memory
In reply to Greg Kroah-HartmanFrom: P Praneesh <[email protected]>
[ Upstream commit 6452f0a3d5651bb7edfd9c709e78973aaa4d3bfc ]
tcl_data and reo_dst rings are currently being allocated using dma_allocate_coherent() which is non cacheable.
Allocating ring memory from cacheable memory area allows cached descriptor access and prefetch next descriptors to optimize CPU usage during descriptor processing on NAPI. Based on the hardware param we can enable or disable this feature for the corresponding platform.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1.r2-00012-QCAHKSWPL_SILICONZ-1
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01695-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/core.c | 5 ++++ drivers/net/wireless/ath/ath11k/dp.c | 38 ++++++++++++++++++++++---- drivers/net/wireless/ath/ath11k/dp.h | 1 + drivers/net/wireless/ath/ath11k/hal.c | 28 +++++++++++++++++-- drivers/net/wireless/ath/ath11k/hal.h | 1 + drivers/net/wireless/ath/ath11k/hw.h | 1 + 6 files changed, 67 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +5 -0
@@ -83,6 +83,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .max_tx_ring = DP_TCL_NUM_RING_MAX, .hal_params = &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz = false, + .alloc_cacheable_memory = true, }, { .hw_rev = ATH11K_HW_IPQ6018_HW10,
@@ -133,6 +134,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .max_tx_ring = DP_TCL_NUM_RING_MAX, .hal_params = &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz = false, + .alloc_cacheable_memory = true, }, { .name = "qca6390 hw2.0",
@@ -182,6 +184,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .max_tx_ring = DP_TCL_NUM_RING_MAX_QCA6390, .hal_params = &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz = false, + .alloc_cacheable_memory = false, }, { .name = "qcn9074 hw1.0",
@@ -231,6 +234,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .max_tx_ring = DP_TCL_NUM_RING_MAX, .hal_params = &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz = true, + .alloc_cacheable_memory = true, }, { .name = "wcn6855 hw2.0",
@@ -280,6 +284,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .max_tx_ring = DP_TCL_NUM_RING_MAX_QCA6390, .hal_params = &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz = false, + .alloc_cacheable_memory = false, }, };
drivers/net/wireless/ath/ath11k/dp.c +33 -5
@@ -101,8 +101,11 @@ void ath11k_dp_srng_cleanup(struct ath11k_base *ab, struct dp_srng *ring)if (!ring->vaddr_unaligned)return ; -dma_free_coherent (ab->dev, ring->size, ring->vaddr_unaligned, - ring->paddr_unaligned); +if (ring->cached) +kfree (ring->vaddr_unaligned); +else +dma_free_coherent (ab->dev, ring->size, ring->vaddr_unaligned, + ring->paddr_unaligned); ring->vaddr_unaligned =NULL ; }
@@ -222,6 +225,7 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,int entry_sz =ath11k_hal_srng_get_entrysize (ab, type);int max_entries =ath11k_hal_srng_get_max_entries (ab, type);int ret; +bool cached = false;if (max_entries <0 || entry_sz <0 )return -EINVAL ;
@@ -230,9 +234,28 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring, num_entries = max_entries; ring->size = (num_entries * entry_sz) +HAL_RING_BASE_ALIGN -1 ; - ring->vaddr_unaligned =dma_alloc_coherent (ab->dev, ring->size, - &ring->paddr_unaligned, -GFP_KERNEL ); + +if (ab->hw_params.alloc_cacheable_memory) { +/* Allocate the reo dst and tx completion rings from cacheable memory */ +switch (type) { +case HAL_REO_DST : + cached = true; +break ; +default : + cached = false; + } + +if (cached) { + ring->vaddr_unaligned =kzalloc (ring->size,GFP_KERNEL ); + ring->paddr_unaligned =virt_to_phys (ring->vaddr_unaligned); + } + } + +if (!cached) + ring->vaddr_unaligned =dma_alloc_coherent (ab->dev, ring->size, + &ring->paddr_unaligned, +GFP_KERNEL ); +if (!ring->vaddr_unaligned)return -ENOMEM ;
@@ -292,6 +315,11 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,return -EINVAL ; } +if (cached) { + params.flags |=HAL_SRNG_FLAGS_CACHED ; + ring->cached =1 ; + } + ret =ath11k_hal_srng_setup (ab, type, ring_num, mac_id, ¶ms);if (ret <0 ) { ath11k_warn(ab, "failed to setup srng: %d ring_id %d\n",
drivers/net/wireless/ath/ath11k/dp.h +1 -0
@@ -64,6 +64,7 @@ struct dp_srng {dma_addr_t paddr;int size;u32 ring_id; +u8 cached; };struct dp_rxdma_ring {
drivers/net/wireless/ath/ath11k/hal.c +26 -2
@@ -627,6 +627,21 @@ u32 *ath11k_hal_srng_dst_peek(struct ath11k_base *ab, struct hal_srng *srng)return NULL ; } +static void ath11k_hal_srng_prefetch_desc (struct ath11k_base *ab, +struct hal_srng *srng) +{ +u32 *desc; + +/* prefetch only if desc is available */ + desc =ath11k_hal_srng_dst_peek (ab, srng); +if (likely (desc)) { +dma_sync_single_for_cpu (ab->dev,virt_to_phys (desc), + (srng->entry_size *sizeof (u32)), +DMA_FROM_DEVICE ); +prefetch (desc); + } +} +u32 *ath11k_hal_srng_dst_get_next_entry (struct ath11k_base *ab,struct hal_srng *srng) {
@@ -642,6 +657,10 @@ u32 *ath11k_hal_srng_dst_get_next_entry(struct ath11k_base *ab, srng->u.dst_ring.tp = (srng->u.dst_ring.tp + srng->entry_size) % srng->ring_size; +/* Try to prefetch the next descriptor in the ring */ +if (srng->flags &HAL_SRNG_FLAGS_CACHED ) +ath11k_hal_srng_prefetch_desc (ab, srng); +return desc; }
@@ -775,11 +794,16 @@ void ath11k_hal_srng_access_begin(struct ath11k_base *ab, struct hal_srng *srng) {lockdep_assert_held (&srng->lock); -if (srng->ring_dir ==HAL_SRNG_DIR_SRC ) +if (srng->ring_dir ==HAL_SRNG_DIR_SRC ) { srng->u.src_ring.cached_tp = *(volatile u32 *)srng->u.src_ring.tp_addr; -else + }else { srng->u.dst_ring.cached_hp = *srng->u.dst_ring.hp_addr; + +/* Try to prefetch the next descriptor in the ring */ +if (srng->flags &HAL_SRNG_FLAGS_CACHED ) +ath11k_hal_srng_prefetch_desc (ab, srng); + } }/* Update cached ring head/tail pointers to HW. ath11k_hal_srng_access_begin()
drivers/net/wireless/ath/ath11k/hal.h +1 -0
@@ -513,6 +513,7 @@ enum hal_srng_dir {#define HAL_SRNG_FLAGS_DATA_TLV_SWAP 0x00000020#define HAL_SRNG_FLAGS_LOW_THRESH_INTR_EN 0x00010000#define HAL_SRNG_FLAGS_MSI_INTR 0x00020000 +#define HAL_SRNG_FLAGS_CACHED 0x20000000#define HAL_SRNG_FLAGS_LMAC_RING 0x80000000#define HAL_SRNG_TLV_HDR_TAG GENMASK(9, 1)
drivers/net/wireless/ath/ath11k/hw.h +1 -0
@@ -177,6 +177,7 @@ struct ath11k_hw_params {u8 max_tx_ring;const struct ath11k_hw_hal_params *hal_params;bool supports_dynamic_smps_6ghz; +bool alloc_cacheable_memory; };struct ath11k_hw_ops {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 154/1039 ath11k: add hw_param for wakeup_mhi
In reply to Greg Kroah-HartmanFrom: Seevalamuthu Mariappan <[email protected]>
[ Upstream commit 081e2d6476e30399433b509684d5da4d1844e430 ]
Wakeup mhi is needed before pci_read/write only for QCA6390 and WCN6855. Since wakeup & release mhi is enabled for all hardwares, below mhi assert is seen in QCN9074 when doing 'rmmod ath11k_pci':
Kernel panic - not syncing: dev_wake != 0 CPU: 2 PID: 13535 Comm: procd Not tainted 4.4.60 #1 Hardware name: Generic DT based system [<80316dac>] (unwind_backtrace) from [<80313700>] (show_stack+0x10/0x14) [<80313700>] (show_stack) from [<805135dc>] (dump_stack+0x7c/0x9c) [<805135dc>] (dump_stack) from [<8032136c>] (panic+0x84/0x1f8) [<8032136c>] (panic) from [<80549b24>] (mhi_pm_disable_transition+0x3b8/0x5b8) [<80549b24>] (mhi_pm_disable_transition) from [<80549ddc>] (mhi_power_down+0xb8/0x100) [<80549ddc>] (mhi_power_down) from [<7f5242b0>] (ath11k_mhi_op_status_cb+0x284/0x3ac [ath11k_pci]) [E][__mhi_device_get_sync] Did not enter M0 state, cur_state:RESET pm_state:SHUTDOWN Process [E][__mhi_device_get_sync] Did not enter M0 state, cur_state:RESET pm_state:SHUTDOWN Process [E][__mhi_device_get_sync] Did not enter M0 state, cur_state:RESET pm_state:SHUTDOWN Process [<7f5242b0>] (ath11k_mhi_op_status_cb [ath11k_pci]) from [<7f524878>] (ath11k_mhi_stop+0x10/0x20 [ath11k_pci]) [<7f524878>] (ath11k_mhi_stop [ath11k_pci]) from [<7f525b94>] (ath11k_pci_power_down+0x54/0x90 [ath11k_pci]) [<7f525b94>] (ath11k_pci_power_down [ath11k_pci]) from [<8056b2a8>] (pci_device_shutdown+0x30/0x44) [<8056b2a8>] (pci_device_shutdown) from [<805cfa0c>] (device_shutdown+0x124/0x174) [<805cfa0c>] (device_shutdown) from [<8033aaa4>] (kernel_restart+0xc/0x50) [<8033aaa4>] (kernel_restart) from [<8033ada8>] (SyS_reboot+0x178/0x1ec) [<8033ada8>] (SyS_reboot) from [<80301b80>] (ret_fast_syscall+0x0/0x34)
Hence, disable wakeup/release mhi using hw_param for other hardwares.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01060-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/core.c | 5 +++++ drivers/net/wireless/ath/ath11k/hw.h | 1 + drivers/net/wireless/ath/ath11k/pci.c | 12 ++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +5 -0
@@ -84,6 +84,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .hal_params = &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz = false, .alloc_cacheable_memory = true, + .wakeup_mhi = false, }, { .hw_rev = ATH11K_HW_IPQ6018_HW10,
@@ -135,6 +136,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .hal_params = &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz = false, .alloc_cacheable_memory = true, + .wakeup_mhi = false, }, { .name = "qca6390 hw2.0",
@@ -185,6 +187,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .hal_params = &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz = false, .alloc_cacheable_memory = false, + .wakeup_mhi = true, }, { .name = "qcn9074 hw1.0",
@@ -235,6 +238,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .hal_params = &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz = true, .alloc_cacheable_memory = true, + .wakeup_mhi = false, }, { .name = "wcn6855 hw2.0",
@@ -285,6 +289,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .hal_params = &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz = false, .alloc_cacheable_memory = false, + .wakeup_mhi = true, }, };
drivers/net/wireless/ath/ath11k/hw.h +1 -0
@@ -178,6 +178,7 @@ struct ath11k_hw_params {const struct ath11k_hw_hal_params *hal_params;bool supports_dynamic_smps_6ghz;bool alloc_cacheable_memory; +bool wakeup_mhi; };struct ath11k_hw_ops {
drivers/net/wireless/ath/ath11k/pci.c +8 -4
@@ -182,7 +182,8 @@ void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value)/* for offset beyond BAR + 4K - 32, may * need to wakeup MHI to access. */ -if (test_bit (ATH11K_PCI_FLAG_INIT_DONE , &ab_pci->flags) && +if (ab->hw_params.wakeup_mhi && +test_bit (ATH11K_PCI_FLAG_INIT_DONE , &ab_pci->flags) && offset >=ACCESS_ALWAYS_OFF )mhi_device_get_sync (ab_pci->mhi_ctrl->mhi_dev);
@@ -206,7 +207,8 @@ void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value) } } -if (test_bit (ATH11K_PCI_FLAG_INIT_DONE , &ab_pci->flags) && +if (ab->hw_params.wakeup_mhi && +test_bit (ATH11K_PCI_FLAG_INIT_DONE , &ab_pci->flags) && offset >=ACCESS_ALWAYS_OFF )mhi_device_put (ab_pci->mhi_ctrl->mhi_dev); }
@@ -219,7 +221,8 @@ u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset)/* for offset beyond BAR + 4K - 32, may * need to wakeup MHI to access. */ -if (test_bit (ATH11K_PCI_FLAG_INIT_DONE , &ab_pci->flags) && +if (ab->hw_params.wakeup_mhi && +test_bit (ATH11K_PCI_FLAG_INIT_DONE , &ab_pci->flags) && offset >=ACCESS_ALWAYS_OFF )mhi_device_get_sync (ab_pci->mhi_ctrl->mhi_dev);
@@ -243,7 +246,8 @@ u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset) } } -if (test_bit (ATH11K_PCI_FLAG_INIT_DONE , &ab_pci->flags) && +if (ab->hw_params.wakeup_mhi && +test_bit (ATH11K_PCI_FLAG_INIT_DONE , &ab_pci->flags) && offset >=ACCESS_ALWAYS_OFF )mhi_device_put (ab_pci->mhi_ctrl->mhi_dev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 155/1039 arm64: dts: renesas: cat875: Add rx/tx delays
In reply to Greg Kroah-HartmanFrom: Biju Das <[email protected]>
[ Upstream commit e1a9faddffe7e555304dc2e3284c84fbee0679ee ]
The CAT875 sub board from Silicon Linux uses a Realtek PHY.
The phy driver commit bbc4d71d63549bcd003 ("net: phy: realtek: fix rtl8211e rx/tx delay config") introduced NFS mount failures. Now it needs both rx/tx delays for the NFS mount to work.
This patch fixes the NFS mount failure issue by adding "rgmii-id" mode to the avb device node.
--- arch/arm64/boot/dts/renesas/cat875.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/renesas/cat875.dtsi +1 -0
@@ -18,6 +18,7 @@ pinctrl-names = "default"; renesas,no-ether-link; phy-handle = <&phy0>; + phy-mode = "rgmii-id"; status = "okay"; phy0: ethernet-phy@0 {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 156/1039 media: dmxdev: fix UAF when dvb_register_device() fails
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit ab599eb11882f834951c436cc080c3455ba32b9b ]
I got a use-after-free report:
dvbdev: dvb_register_device: failed to create device dvb1.dvr0 (-12)
...
==================================================================
BUG: KASAN: use-after-free in dvb_dmxdev_release+0xce/0x2f0 ... Call Trace: dump_stack_lvl+0x6c/0x8b print_address_description.constprop.0+0x48/0x70 kasan_report.cold+0x82/0xdb __asan_load4+0x6b/0x90 dvb_dmxdev_release+0xce/0x2f0 ... Allocated by task 7666: kasan_save_stack+0x23/0x50 __kasan_kmalloc+0x83/0xa0 kmem_cache_alloc_trace+0x22e/0x470 dvb_register_device+0x12f/0x980 dvb_dmxdev_init+0x1f3/0x230 ... Freed by task 7666: kasan_save_stack+0x23/0x50 kasan_set_track+0x20/0x30 kasan_set_free_info+0x24/0x40 __kasan_slab_free+0xf2/0x130 kfree+0xd1/0x5c0 dvb_register_device.cold+0x1ac/0x1fa dvb_dmxdev_init+0x1f3/0x230
...
When dvb_register_device() in dvb_dmxdev_init() fails, dvb_dmxdev_init() does not return a failure, and the memory pointed to by dvbdev or dvr_dvbdev is invalid at this point. If they are used subsequently, it will result in UFA or null-ptr-deref.
If dvb_register_device() in dvb_dmxdev_init() fails, fix the bug by making dvb_dmxdev_init() return an error as well.
--- drivers/media/dvb-core/dmxdev.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/media/dvb-core/dmxdev.c +15 -3
@@ -1413,7 +1413,7 @@ static const struct dvb_device dvbdev_dvr = { };int dvb_dmxdev_init (struct dmxdev *dmxdev,struct dvb_adapter *dvb_adapter) { -int i; +int i, ret;if (dmxdev->demux->open (dmxdev->demux) <0 )return -EUSERS ;
@@ -1432,14 +1432,26 @@ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) DMXDEV_STATE_FREE); } -dvb_register_device (dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, + ret =dvb_register_device (dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev,DVB_DEVICE_DEMUX , dmxdev->filternum); -dvb_register_device (dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, +if (ret <0 ) + goto err_register_dvbdev; + + ret =dvb_register_device (dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, dmxdev,DVB_DEVICE_DVR , dmxdev->filternum); +if (ret <0 ) + goto err_register_dvr_dvbdev;dvb_ringbuffer_init (&dmxdev->dvr_buffer,NULL ,8192 );return 0 ; + +err_register_dvr_dvbdev: +dvb_unregister_device (dmxdev->dvbdev); +err_register_dvbdev: +vfree (dmxdev->filter); + dmxdev->filter =NULL ; +return ret; }EXPORT_SYMBOL (dvb_dmxdev_init);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 157/1039 crypto: atmel-aes - Reestablish the correct tfm context at dequeue
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
[ Upstream commit 6d48de655917a9d782953eba65de4e3db593ddf0 ]
In case there were more requests from different tfms in the crypto queue, only the context of the last initialized tfm was considered.
--- drivers/crypto/atmel-aes.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/crypto/atmel-aes.c +1 -5
@@ -960,6 +960,7 @@ static int atmel_aes_handle_queue(struct atmel_aes_dev *dd, ctx =crypto_tfm_ctx (areq->tfm); dd->areq = areq; + dd->ctx = ctx; start_async = (areq != new_areq); dd->is_async = start_async;
@@ -1274,7 +1275,6 @@ static int atmel_aes_init_tfm(struct crypto_skcipher *tfm)crypto_skcipher_set_reqsize (tfm,sizeof (struct atmel_aes_reqctx )); ctx->base.dd = dd; - ctx->base.dd->ctx = &ctx->base; ctx->base.start = atmel_aes_start;return 0 ;
@@ -1291,7 +1291,6 @@ static int atmel_aes_ctr_init_tfm(struct crypto_skcipher *tfm)crypto_skcipher_set_reqsize (tfm,sizeof (struct atmel_aes_reqctx )); ctx->base.dd = dd; - ctx->base.dd->ctx = &ctx->base; ctx->base.start = atmel_aes_ctr_start;return 0 ;
@@ -1783,7 +1782,6 @@ static int atmel_aes_gcm_init(struct crypto_aead *tfm)crypto_aead_set_reqsize (tfm,sizeof (struct atmel_aes_reqctx )); ctx->base.dd = dd; - ctx->base.dd->ctx = &ctx->base; ctx->base.start = atmel_aes_gcm_start;return 0 ;
@@ -1927,7 +1925,6 @@ static int atmel_aes_xts_init_tfm(struct crypto_skcipher *tfm)crypto_skcipher_set_reqsize (tfm,sizeof (struct atmel_aes_reqctx ) +crypto_skcipher_reqsize (ctx->fallback_tfm)); ctx->base.dd = dd; - ctx->base.dd->ctx = &ctx->base; ctx->base.start = atmel_aes_xts_start;return 0 ;
@@ -2154,7 +2151,6 @@ static int atmel_aes_authenc_init_tfm(struct crypto_aead *tfm,crypto_aead_set_reqsize (tfm, (sizeof (struct atmel_aes_authenc_reqctx ) + auth_reqsize)); ctx->base.dd = dd; - ctx->base.dd->ctx = &ctx->base; ctx->base.start = atmel_aes_authenc_start;return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 158/1039 crypto: keembay-ocs-ecc - Fix error return code in kmb_ocs_ecc_probe()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 94ad2d19a97efdb603a21fcad0625f466f1cdd0f ]
Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/crypto/keembay/keembay-ocs-ecc.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/keembay/keembay-ocs-ecc.c +1 -0
@@ -930,6 +930,7 @@ static int kmb_ocs_ecc_probe(struct platform_device *pdev) ecc_dev->engine =crypto_engine_alloc_init (dev,1 );if (!ecc_dev->engine) {dev_err (dev,"Could not allocate crypto engine\n" ); + rc = -ENOMEM ; goto list_del; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 159/1039 crypto: qce - fix uaf on qce_aead_register_one
In reply to Greg Kroah-HartmanFrom: Chengfeng Ye <[email protected]>
[ Upstream commit 4a9dbd021970ffe1b92521328377b699acba7c52 ]
Pointer alg points to sub field of tmpl, it
is dereferenced after tmpl is freed. Fix
this by accessing alg before free tmpl.
--- drivers/crypto/qce/aead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qce/aead.c +1 -1
@@ -802,8 +802,8 @@ static int qce_aead_register_one(const struct qce_aead_def *def, struct qce_devi ret =crypto_register_aead (alg);if (ret) { -kfree (tmpl);dev_err (qce->dev,"%s registration failed\n" , alg->base.cra_name); +kfree (tmpl);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 160/1039 crypto: qce - fix uaf on qce_ahash_register_one
In reply to Greg Kroah-HartmanFrom: Chengfeng Ye <[email protected]>
[ Upstream commit b4cb4d31631912842eb7dce02b4350cbb7562d5e ]
Pointer base points to sub field of tmpl, it
is dereferenced after tmpl is freed. Fix
this by accessing base before free tmpl.
--- drivers/crypto/qce/sha.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qce/sha.c +1 -1
@@ -498,8 +498,8 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def, ret =crypto_register_ahash (alg);if (ret) { -kfree (tmpl);dev_err (qce->dev,"%s registration failed\n" , base->cra_name); +kfree (tmpl);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 161/1039 crypto: qce - fix uaf on qce_skcipher_register_one
In reply to Greg Kroah-HartmanFrom: Chengfeng Ye <[email protected]>
[ Upstream commit e9c195aaeed1b45c9012adbe29dedb6031e85aa8 ]
Pointer alg points to sub field of tmpl, it
is dereferenced after tmpl is freed. Fix
this by accessing alg before free tmpl.
--- drivers/crypto/qce/skcipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qce/skcipher.c +1 -1
@@ -484,8 +484,8 @@ static int qce_skcipher_register_one(const struct qce_skcipher_def *def, ret =crypto_register_skcipher (alg);if (ret) { -kfree (tmpl);dev_err (qce->dev,"%s registration failed\n" , alg->base.cra_name); +kfree (tmpl);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 162/1039 arm64: dts: qcom: sc7280: Fix incorrect clock name
In reply to Greg Kroah-HartmanFrom: Prasad Malisetty <[email protected]>
[ Upstream commit fa09b2248714c64644576d8064e9bd292a504a0e ]
Replace pcie_1_pipe-clk clock name with pcie_1_pipe_clk To match with dt binding.
--- arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc7280.dtsi +1 -1
@@ -576,7 +576,7 @@ <&rpmhcc RPMH_CXO_CLK_A>, <&sleep_clk>, <0>, <0>, <0>, <0>, <0>, <0>; clock-names = "bi_tcxo", "bi_tcxo_ao", "sleep_clk", - "pcie_0_pipe_clk", "pcie_1_pipe-clk", + "pcie_0_pipe_clk", "pcie_1_pipe_clk", "ufs_phy_rx_symbol_0_clk", "ufs_phy_rx_symbol_1_clk", "ufs_phy_tx_symbol_0_clk", "usb3_phy_wrapper_gcc_usb30_pipe_clk";
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 163/1039 arm64: dts: qcom: sc7280: Fix interrupt-map parent address cells
In reply to Greg Kroah-HartmanFrom: Prasad Malisetty <[email protected]>
[ Upstream commit 66b788133030f0c69a0ecc7f72f7939b119c9a69 ]
Update interrupt-map parent address cells for sc7280 Similar to existing Qcom SoCs.
--- arch/arm64/boot/dts/qcom/sc7280.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sc7280.dtsi +4 -4
@@ -1592,10 +1592,10 @@ interrupt-names = "msi"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0x7>; - interrupt-map = <0 0 0 1 &intc 0 434 IRQ_TYPE_LEVEL_HIGH>, - <0 0 0 2 &intc 0 435 IRQ_TYPE_LEVEL_HIGH>, - <0 0 0 3 &intc 0 438 IRQ_TYPE_LEVEL_HIGH>, - <0 0 0 4 &intc 0 439 IRQ_TYPE_LEVEL_HIGH>; + interrupt-map = <0 0 0 1 &intc 0 0 0 434 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 2 &intc 0 0 0 435 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 3 &intc 0 0 0 438 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 4 &intc 0 0 0 439 IRQ_TYPE_LEVEL_HIGH>; clocks = <&gcc GCC_PCIE_1_PIPE_CLK>, <&gcc GCC_PCIE_1_PIPE_CLK_SRC>,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 164/1039 mtd: hyperbus: rpc-if: fix bug in rpcif_hb_remove
In reply to Greg Kroah-HartmanFrom: George G. Davis <[email protected]>
[ Upstream commit baaf965f94308301d2dc554d72a87d7432cd5ce6 ]
The following KASAN BUG is observed when testing the rpc-if driver on rcar-gen3:
root@rcar-gen3:~# modprobe -r rpc-if [ 101.930146] ================================================================== [ 101.937408] BUG: KASAN: slab-out-of-bounds in __lock_acquire+0x518/0x25d0 [ 101.944240] Read of size 8 at addr ffff0004c5be2750 by task modprobe/664 [ 101.950959] [ 101.952466] CPU: 2 PID: 664 Comm: modprobe Not tainted 5.14.0-rc1-00342-g1a1464d7aa31 #1 [ 101.960578] Hardware name: Renesas H3ULCB board based on r8a77951 (DT) [ 101.967120] Call trace: [ 101.969580] dump_backtrace+0x0/0x2c0 [ 101.973275] show_stack+0x1c/0x30 [ 101.976616] dump_stack_lvl+0x9c/0xd8 [ 101.980301] print_address_description.constprop.0+0x74/0x2b8 [ 101.986071] kasan_report+0x1f4/0x26c [ 101.989757] __asan_load8+0x98/0xd4 [ 101.993266] __lock_acquire+0x518/0x25d0 [ 101.997215] lock_acquire.part.0+0x18c/0x360 [ 102.001506] lock_acquire+0x74/0x90 [ 102.005013] _raw_spin_lock_irq+0x98/0x130 [ 102.009131] __pm_runtime_disable+0x30/0x210 [ 102.013427] rpcif_hb_remove+0x5c/0x70 [rpc_if] [ 102.018001] platform_remove+0x40/0x80 [ 102.021771] __device_release_driver+0x234/0x350 [ 102.026412] driver_detach+0x158/0x20c [ 102.030179] bus_remove_driver+0xa0/0x140 [ 102.034212] driver_unregister+0x48/0x80 [ 102.038153] platform_driver_unregister+0x18/0x24 [ 102.042879] rpcif_platform_driver_exit+0x1c/0x34 [rpc_if] [ 102.048400] __arm64_sys_delete_module+0x210/0x310 [ 102.053212] invoke_syscall+0x60/0x190 [ 102.056986] el0_svc_common+0x12c/0x144 [ 102.060844] do_el0_svc+0x88/0xac [ 102.064181] el0_svc+0x24/0x3c [ 102.067257] el0t_64_sync_handler+0x1a8/0x1b0 [ 102.071634] el0t_64_sync+0x198/0x19c [ 102.075315] [ 102.076815] Allocated by task 628: [ 102.080781] [ 102.082280] Last potentially related work creation: [ 102.087524] [ 102.089022] The buggy address belongs to the object at ffff0004c5be2000 [ 102.089022] which belongs to the cache kmalloc-2k of size 2048 [ 102.101555] The buggy address is located 1872 bytes inside of [ 102.101555] 2048-byte region [ffff0004c5be2000, ffff0004c5be2800) [ 102.113486] The buggy address belongs to the page: [ 102.118409] [ 102.119908] Memory state around the buggy address: [ 102.124711] ffff0004c5be2600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 102.131947] ffff0004c5be2680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 102.139181] >ffff0004c5be2700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 102.146412] ^ [ 102.152257] ffff0004c5be2780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 102.159491] ffff0004c5be2800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 102.166723] ==================================================================
The above bug is caused by use of the wrong pointer in the rpcif_disable_rpm() call. Fix the bug by using the correct pointer.
--- drivers/mtd/hyperbus/rpc-if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/hyperbus/rpc-if.c +2 -2
@@ -152,9 +152,9 @@ static int rpcif_hb_remove(struct platform_device *pdev) {struct rpcif_hyperbus *hyperbus =platform_get_drvdata (pdev);int error =hyperbus_unregister_device (&hyperbus->hbdev); -struct rpcif *rpc =dev_get_drvdata (pdev->dev.parent); -rpcif_disable_rpm (rpc); +rpcif_disable_rpm (&hyperbus->rpc); +return error; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 165/1039 cpufreq: qcom-cpufreq-hw: Update offline CPUs per-cpu thermal pressure
In reply to Greg Kroah-HartmanFrom: Lukasz Luba <[email protected]>
[ Upstream commit 93d9e6f93e1586fcc97498c764be2e8c8401f4bd ]
The thermal pressure signal gives information to the scheduler about reduced CPU capacity due to thermal. It is based on a value stored in a per-cpu 'thermal_pressure' variable. The online CPUs will get the new value there, while the offline won't. Unfortunately, when the CPU is back online, the value read from per-cpu variable might be wrong (stale data). This might affect the scheduler decisions, since it sees the CPU capacity differently than what is actually available.
Fix it by making sure that all online+offline CPUs would get the proper value in their per-cpu variable when there is throttling or throttling is removed.
--- drivers/cpufreq/qcom-cpufreq-hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpufreq/qcom-cpufreq-hw.c +2 -1
@@ -304,7 +304,8 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)if (capacity > max_capacity) capacity = max_capacity; -arch_set_thermal_pressure (policy->cpus, max_capacity - capacity); +arch_set_thermal_pressure (policy->related_cpus, + max_capacity - capacity);/* * In the unlikely case policy is unregistered do not enable
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 166/1039 soc: imx: gpcv2: keep i.MX8MM VPU-H1 bus clock active
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
[ Upstream commit 8361b8b29f9389084b679db854cf733375c64763 ]
Enable the vpu-h1 clock when the domain is active because reading or writing to the VPU-H1 IP block cause the system to hang.
--- drivers/soc/imx/gpcv2.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/imx/gpcv2.c +1 -0
@@ -734,6 +734,7 @@ static const struct imx_pgc_domain imx8mm_pgc_domains[] = { .map = IMX8MM_VPUH1_A53_DOMAIN, }, .pgc = BIT(IMX8MM_PGC_VPUH1), + .keep_clocks = true, }, [IMX8MM_POWER_DOMAIN_DISPMIX] = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 167/1039 cpufreq: qcom-hw: Fix probable nested interrupt handling
In reply to Greg Kroah-HartmanFrom: Vladimir Zapolskiy <[email protected]>
[ Upstream commit e0e27c3d4e20dab861566f1c348ae44e4b498630 ]
Re-enabling an interrupt from its own interrupt handler may cause an interrupt storm, if there is a pending interrupt and because its handling is disabled due to already done entrance into the handler above in the stack.
Also, apparently it is improper to lock a mutex in an interrupt contex.
--- drivers/cpufreq/qcom-cpufreq-hw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/qcom-cpufreq-hw.c +2 -2
@@ -343,9 +343,9 @@ static irqreturn_t qcom_lmh_dcvs_handle_irq(int irq, void *data)/* Disable interrupt and enable polling */ disable_irq_nosync (c_data->throttle_irq); -qcom_lmh_dcvs_notify (c_data); +schedule_delayed_work (&c_data->throttle_work,0 ); -return 0 ; +return IRQ_HANDLED ; }static const struct qcom_cpufreq_soc_data qcom_soc_data = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 168/1039 ARM: dts: stm32: fix dtbs_check warning on ili9341 dts binding on stm32f429 disco
In reply to Greg Kroah-HartmanFrom: Dillon Min <[email protected]>
[ Upstream commit b046049e59dca5e5830dc75ed16acf7657a95161 ]
Since the compatible string defined from ilitek,ili9341.yaml is "st,sf-tc240t-9370-t", "ilitek,ili9341"
so, append "ilitek,ili9341" to avoid the below dtbs_check warning.
arch/arm/boot/dts/stm32f429-disco.dt.yaml: display@1: compatible:
['st,sf-tc240t-9370-t'] is too short
--- arch/arm/boot/dts/stm32f429-disco.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/stm32f429-disco.dts +1 -1
@@ -192,7 +192,7 @@ display: display@1{ /* Connect panel-ilitek-9341 to ltdc */ - compatible = "st,sf-tc240t-9370-t"; + compatible = "st,sf-tc240t-9370-t", "ilitek,ili9341"; reg = <1>; spi-3wire; spi-max-frequency = <10000000>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 169/1039 libbpf: Load global data maps lazily on legacy kernels
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 16e0c35c6f7a2e90d52f3035ecf942af21417b7b ]
Load global data maps lazily, if kernel is too old to support global data. Make sure that programs are still correct by detecting if any of the to-be-loaded programs have relocation against any of such maps.
This allows to solve the issue ([0]) with bpf_printk() and Clang generating unnecessary and unreferenced .rodata.strX.Y sections, but it also goes further along the CO-RE lines, allowing to have a BPF object in which some code can work on very old kernels and relies only on BPF maps explicitly, while other BPF programs might enjoy global variable support. If such programs are correctly set to not load at runtime on old kernels, bpf_object will load and function correctly now.
[0] https://lore.kernel.org/bpf/CAK-59YFPU3qO+_pXWOH+c1LSA=8WA1yabJZfREjOEXNHAqgXNg@mail.gmail.com/
--- tools/lib/bpf/libbpf.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
tools/lib/bpf/libbpf.c +30 -4
@@ -4988,6 +4988,24 @@ bpf_object__create_maps(struct bpf_object *obj)for (i =0 ; i < obj->nr_maps; i++) { map = &obj->maps[i]; +/* To support old kernels, we skip creating global data maps +* (.rodata, .data, .kconfig, etc); later on, during program +* loading, if we detect that at least one of the to-be-loaded +* programs is referencing any global data map, we'll error +* out with program name and relocation index logged. +* This approach allows to accommodate Clang emitting +* unnecessary .rodata.str1.1 sections for string literals, +* but also it allows to have CO-RE applications that use +* global variables in some of BPF programs, but not others. +* If those global variable-using programs are not loaded at +* runtime due to bpf_program__set_autoload(prog, false), +* bpf_object loading will succeed just fine even on old +* kernels. +*/ +if (bpf_map__is_internal (map) && + !kernel_supports (obj,FEAT_GLOBAL_DATA )) +continue ; + retried = false; retry:if (map->pin_path) {
@@ -5587,6 +5605,14 @@ bpf_object__relocate_data(struct bpf_object *obj, struct bpf_program *prog) insn[0 ].src_reg =BPF_PSEUDO_MAP_IDX_VALUE ; insn[0 ].imm = relo->map_idx; }else { +const struct bpf_map *map = &obj->maps[relo->map_idx]; + +if (bpf_map__is_internal (map) && + !kernel_supports (obj,FEAT_GLOBAL_DATA )) { +pr_warn ("prog '%s': relo #%d: kernel doesn't support global data\n" , + prog->name, i); +return -ENOTSUP ; + } insn[0 ].src_reg =BPF_PSEUDO_MAP_VALUE ; insn[0 ].imm = obj->maps[relo->map_idx].fd; }
@@ -6121,6 +6147,8 @@ bpf_object__relocate(struct bpf_object *obj, const char *targ_btf_path)*/ if (prog_is_subprog (obj, prog))continue ; +if (!prog->load) +continue ; err =bpf_object__relocate_calls (obj, prog);if (err) {
@@ -6134,6 +6162,8 @@ bpf_object__relocate(struct bpf_object *obj, const char *targ_btf_path) prog = &obj->programs[i];if (prog_is_subprog (obj, prog))continue ; +if (!prog->load) +continue ; err =bpf_object__relocate_data (obj, prog);if (err) { pr_warn("prog '%s': failed to relocate data references: %d\n",
@@ -6915,10 +6945,6 @@ static int bpf_object__sanitize_maps(struct bpf_object *obj)bpf_object__for_each_map (m, obj) {if (!bpf_map__is_internal (m))continue ; -if (!kernel_supports (obj,FEAT_GLOBAL_DATA )) { -pr_warn ("kernel doesn't support global data\n" ); -return -ENOTSUP ; - }if (!kernel_supports (obj,FEAT_ARRAY_MMAP )) m->def.map_flags ^=BPF_F_MMAPABLE ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 170/1039 tools/resolve_btf_ids: Close ELF file on error
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 1144ab9bdf3430e1b5b3f22741e5283841951add ]
Fix one case where we don't do explicit clean up.
--- tools/bpf/resolve_btfids/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/bpf/resolve_btfids/main.c +3 -2
@@ -168,7 +168,7 @@ static struct btf_id *btf_id__find(struct rb_root *root, const char *name)return NULL ; } -static struct btf_id * +static struct btf_id *btf_id__add (struct rb_root *root,char *name,bool unique) {struct rb_node **p = &root->rb_node;
@@ -732,7 +732,8 @@ int main(int argc, const char **argv)if (obj.efile.idlist_shndx ==-1 || obj.efile.symbols_shndx ==-1 ) {pr_debug ("Cannot find .BTF_ids or symbols sections, nothing to do\n" ); -return 0 ; + err =0 ; + goto out; }if (symbols_collect (&obj))
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 171/1039 libbpf: Fix potential misaligned memory access in btf_ext__new()
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 401891a9debaf0a684502f2aaecf53448cee9414 ]
Perform a memory copy before we do the sanity checks of btf_ext_hdr. This prevents misaligned memory access if raw btf_ext data is not 4-byte aligned ([0]).
While at it, also add missing const qualifier.
[0] Closes: https://github.com/libbpf/libbpf/issues/391
--- tools/lib/bpf/btf.c | 10 +++++----- tools/lib/bpf/btf.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
tools/lib/bpf/btf.c +5 -5
@@ -2711,15 +2711,11 @@ void btf_ext__free(struct btf_ext *btf_ext)free (btf_ext); } -struct btf_ext *btf_ext__new (__u8 *data,__u32 size) +struct btf_ext *btf_ext__new (const __u8 *data,__u32 size) {struct btf_ext *btf_ext;int err; - err =btf_ext_parse_hdr (data, size); -if (err) -return libbpf_err_ptr (err); - btf_ext =calloc (1 ,sizeof (struct btf_ext ));if (!btf_ext)return libbpf_err_ptr (-ENOMEM );
@@ -2732,6 +2728,10 @@ struct btf_ext *btf_ext__new(__u8 *data, __u32 size) }memcpy (btf_ext->data, data, size); + err =btf_ext_parse_hdr (btf_ext->data, size); +if (err) + goto done; + if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, line_info_len)) { err = -EINVAL ; goto done;
tools/lib/bpf/btf.h +1 -1
@@ -157,7 +157,7 @@ LIBBPF_API int btf__get_map_kv_tids(const struct btf *btf, const char *map_name,__u32 expected_value_size, __u32 *key_type_id, __u32 *value_type_id); -LIBBPF_API struct btf_ext *btf_ext__new(__u8 *data, __u32 size); +LIBBPF_API struct btf_ext *btf_ext__new(const __u8 *data, __u32 size); LIBBPF_API void btf_ext__free(struct btf_ext *btf_ext); LIBBPF_API const void *btf_ext__get_raw_data(const struct btf_ext *btf_ext,__u32 *size);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 172/1039 libbpf: Fix glob_syms memory leak in bpf_linker
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 8cb125566c40b7141d8842c534f0ea5820ee3d5c ]
glob_syms array wasn't freed on bpf_link__free(). Fix that.
--- tools/lib/bpf/linker.c | 1 + 1 file changed, 1 insertion(+)
tools/lib/bpf/linker.c +1 -0
@@ -210,6 +210,7 @@ void bpf_linker__free(struct bpf_linker *linker) }free (linker->secs); +free (linker->glob_syms);free (linker); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 173/1039 libbpf: Fix using invalidated memory in bpf_linker
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 593835377f24ca1bb98008ec1dc3baefe491ad6e ]
add_dst_sec() can invalidate bpf_linker's section index making dst_symtab pointer pointing into unallocated memory. Reinitialize dst_symtab pointer on each iteration to make sure it's always valid.
--- tools/lib/bpf/linker.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/lib/bpf/linker.c +4 -1
@@ -2000,7 +2000,7 @@ add_sym:static int linker_append_elf_relos (struct bpf_linker *linker,struct src_obj *obj) {struct src_sec *src_symtab = &obj->secs[obj->symtab_sec_idx]; -struct dst_sec *dst_symtab = &linker->secs[linker->symtab_sec_idx]; +struct dst_sec *dst_symtab;int i, err;for (i =1 ; i < obj->sec_cnt; i++) {
@@ -2033,6 +2033,9 @@ static int linker_append_elf_relos(struct bpf_linker *linker, struct src_obj *obreturn -1 ; } +/* add_dst_sec() above could have invalidated linker->secs */ + dst_symtab = &linker->secs[linker->symtab_sec_idx]; +/* shdr->sh_link points to SYMTAB */ dst_sec->shdr->sh_link = linker->symtab_sec_idx;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 174/1039 crypto: qat - fix undetected PFVF timeout in ACK loop
In reply to Greg Kroah-HartmanFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit 5002200b4fedd7e90e4fbc2e5c42a4b3351df814 ]
If the remote function did not ACK the reception of a message, the function __adf_iov_putmsg() could detect it as a collision.
This was due to the fact that the collision and the timeout checks after the ACK loop were in the wrong order. The timeout must be checked at the end of the loop, so fix by swapping the order of the two checks.
--- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +6 -6
@@ -107,6 +107,12 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr) val =ADF_CSR_RD (pmisc_bar_addr, pf2vf_offset); }while ((val & int_bit) && (count++ <ADF_PFVF_MSG_ACK_MAX_RETRY )); +if (val & int_bit) { +dev_dbg (&GET_DEV (accel_dev),"ACK not received from remote\n" ); + val &= ~int_bit; + ret = -EIO ; + } +if (val != msg) {dev_dbg (&GET_DEV (accel_dev),"Collision - PFVF CSR overwritten by remote function\n" );
@@ -114,12 +120,6 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr) goto out; } -if (val & int_bit) { -dev_dbg (&GET_DEV (accel_dev),"ACK not received from remote\n" ); - val &= ~int_bit; - ret = -EIO ; - } -/* Finished with the PFVF CSR; relinquish it and leave msg in CSR */ ADF_CSR_WR (pmisc_bar_addr, pf2vf_offset, val & ~local_in_use_mask); out:
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 175/1039 ath11k: Use host CE parameters for CE interrupts configuration
In reply to Greg Kroah-HartmanFrom: Anilkumar Kolli <[email protected]>
[ Upstream commit b689f091aafd1a874b2f88137934276ab0fca480 ]
CE interrupt configuration uses host ce parameters to assign/free interrupts. Use host ce parameters to enable/disable interrupts. This patch fixes below BUG,
BUG: KASAN: global-out-of-bounds in 0xffffffbffdfb035c at addr ffffffbffde6eeac Read of size 4 by task kworker/u8:2/132 Address belongs to variable ath11k_core_qmi_firmware_ready+0x1b0/0x5bc [ath11k]
OOB is due to ath11k_ahb_ce_irqs_enable() iterates ce_count(which is 12) times and accessing 12th element in target_ce_config
(which has only 11 elements) from ath11k_ahb_ce_irq_enable().
With this change host ce configs are used to enable/disable interrupts.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00471-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/ahb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath11k/ahb.c +8 -8
@@ -206,13 +206,13 @@ static void ath11k_ahb_clearbit32(struct ath11k_base *ab, u8 bit, u32 offset)static void ath11k_ahb_ce_irq_enable (struct ath11k_base *ab,u16 ce_id) { -const struct ce_pipe_config *ce_config; +const struct ce_attr *ce_attr; - ce_config = &ab->hw_params.target_ce_config[ce_id]; -if (__le32_to_cpu (ce_config->pipedir) &PIPEDIR_OUT ) + ce_attr = &ab->hw_params.host_ce_config[ce_id]; +if (ce_attr->src_nentries)ath11k_ahb_setbit32 (ab, ce_id,CE_HOST_IE_ADDRESS ); -if (__le32_to_cpu (ce_config->pipedir) &PIPEDIR_IN ) { +if (ce_attr->dest_nentries) {ath11k_ahb_setbit32 (ab, ce_id,CE_HOST_IE_2_ADDRESS );ath11k_ahb_setbit32 (ab, ce_id +CE_HOST_IE_3_SHIFT ,CE_HOST_IE_3_ADDRESS );
@@ -221,13 +221,13 @@ static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id)static void ath11k_ahb_ce_irq_disable (struct ath11k_base *ab,u16 ce_id) { -const struct ce_pipe_config *ce_config; +const struct ce_attr *ce_attr; - ce_config = &ab->hw_params.target_ce_config[ce_id]; -if (__le32_to_cpu (ce_config->pipedir) &PIPEDIR_OUT ) + ce_attr = &ab->hw_params.host_ce_config[ce_id]; +if (ce_attr->src_nentries)ath11k_ahb_clearbit32 (ab, ce_id,CE_HOST_IE_ADDRESS ); -if (__le32_to_cpu (ce_config->pipedir) &PIPEDIR_IN ) { +if (ce_attr->dest_nentries) {ath11k_ahb_clearbit32 (ab, ce_id,CE_HOST_IE_2_ADDRESS );ath11k_ahb_clearbit32 (ab, ce_id +CE_HOST_IE_3_SHIFT ,CE_HOST_IE_3_ADDRESS );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 176/1039 arm64: dts: ti: k3-j721e: correct cache-sets info
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit 7a0df1f969c14939f60a7f9a6af72adcc314675f ]
A72 Cluster has 48KB Icache, 32KB Dcache and 1MB L2 Cache
- ICache is 3-way set-associative
- Dcache is 2-way set-associative
- Line size are 64bytes
So correct the cache-sets info.
--- arch/arm64/boot/dts/ti/k3-j721e.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/ti/k3-j721e.dtsi +2 -2
@@ -64,7 +64,7 @@ i-cache-sets = <256>; d-cache-size = <0x8000>; d-cache-line-size = <64>; - d-cache-sets = <128>; + d-cache-sets = <256>; next-level-cache = <&L2_0>; };
@@ -78,7 +78,7 @@ i-cache-sets = <256>; d-cache-size = <0x8000>; d-cache-line-size = <64>; - d-cache-sets = <128>; + d-cache-sets = <256>; next-level-cache = <&L2_0>; }; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 177/1039 tty: serial: atmel: Check return code of dmaengine_submit()
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
[ Upstream commit 1e67bd2b8cb90b66e89562598e9c2046246832d3 ]
The tx_submit() method of struct dma_async_tx_descriptor is entitled to do sanity checks and return errors if encountered. It's not the case for the DMA controller drivers that this client is using (at_h/xdmac), because they currently don't do sanity checks and always return a positive cookie at tx_submit() method. In case the controller drivers will implement sanity checks and return errors, print a message so that the client will be informed that something went wrong at tx_submit() level.
--- drivers/tty/serial/atmel_serial.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/tty/serial/atmel_serial.c +10 -0
@@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port) desc->callback = atmel_complete_tx_dma; desc->callback_param = atmel_port; atmel_port->cookie_tx =dmaengine_submit (desc); +if (dma_submit_error (atmel_port->cookie_tx)) { +dev_err (port->dev,"dma_submit_error %d\n" , + atmel_port->cookie_tx); +return ; + } }if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS )
@@ -1258,6 +1263,11 @@ static int atmel_prepare_rx_dma(struct uart_port *port) desc->callback_param = port; atmel_port->desc_rx = desc; atmel_port->cookie_rx =dmaengine_submit (desc); +if (dma_submit_error (atmel_port->cookie_rx)) { +dev_err (port->dev,"dma_submit_error %d\n" , + atmel_port->cookie_rx); + goto chan_err; + }return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 178/1039 tty: serial: atmel: Call dma_async_issue_pending()
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
[ Upstream commit 4f4b9b5895614eb2e2b5f4cab7858f44bd113e1b ]
The driver wrongly assummed that tx_submit() will start the transfer, which is not the case, now that the at_xdmac driver is fixed. tx_submit is supposed to push the current transaction descriptor to a pending queue, waiting for issue_pending to be called. issue_pending must start the transfer, not tx_submit.
--- drivers/tty/serial/atmel_serial.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/atmel_serial.c +4 -0
@@ -1009,6 +1009,8 @@ static void atmel_tx_dma(struct uart_port *port) atmel_port->cookie_tx);return ; } + +dma_async_issue_pending (chan); }if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS )
@@ -1269,6 +1271,8 @@ static int atmel_prepare_rx_dma(struct uart_port *port) goto chan_err; } +dma_async_issue_pending (atmel_port->chan_rx); +return 0 ; chan_err:
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 179/1039 pinctrl: apple: return an error if pinmux is missing in the DT
In reply to Greg Kroah-HartmanFrom: Joey Gouly <[email protected]>
[ Upstream commit 839930ca1bd0c79cdf370d11462ef4a81b664e44 ]
If of_property_count_u32_elems returned 0, return -EINVAL to indicate a failure. Previously this would return 0.
--- drivers/pinctrl/pinctrl-apple-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-apple-gpio.c +1 -1
@@ -114,7 +114,7 @@ static int apple_gpio_dt_node_to_map(struct pinctrl_dev *pctldev,dev_err (pctl->dev,"missing or empty pinmux property in node %pOFn.\n" , node); -return ret; +return ret ? ret : -EINVAL ; } num_pins = ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 180/1039 net: dsa: rtl8365mb: set RGMII RX delay in steps of 0.3 ns
In reply to Greg Kroah-HartmanFrom: Alvin Šipraga <[email protected]>
[ Upstream commit ef136837aaf6f37f2dec78551671a6883f868d69 ]
A contact at Realtek has clarified what exactly the units of RGMII RX delay are. The answer is that the unit of RX delay is "about 0.3 ns". Take this into account when parsing rx-internal-delay-ps by approximating the closest step value. Delays of more than 2.1 ns are rejected.
This obviously contradicts the previous assumption in the driver that a step value of 4 was "about 2 ns", but Realtek also points out that it is easy to find more than one RX delay step value which makes RGMII work.
--- drivers/net/dsa/rtl8365mb.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/net/dsa/rtl8365mb.c +6 -9
@@ -767,7 +767,8 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_smi *smi, int port,* 0 = no delay, 1 = 2 ns delay * RX delay: * 0 = no delay, 7 = maximum delay -* No units are specified, but there are a total of 8 steps. +* Each step is approximately 0.3 ns, so the maximum delay is about +* 2.1 ns. * * The vendor driver also states that this must be configured *before* * forcing the external interface into a particular mode, which is done
@@ -778,10 +779,6 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_smi *smi, int port,* specified. We ignore the detail of the RGMII interface mode * (RGMII_{RXID, TXID, etc.}), as this is considered to be a PHY-only * property. -* -* For the RX delay, we assume that a register value of 4 corresponds to -* 2 ns. But this is just an educated guess, so ignore all other values -* to avoid too much confusion. */ if (!of_property_read_u32 (dn,"tx-internal-delay-ps" , &val)) { val = val /1000 ;/* convert to ns */
@@ -794,13 +791,13 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_smi *smi, int port, }if (!of_property_read_u32 (dn,"rx-internal-delay-ps" , &val)) { - val = val /1000 ;/* convert to ns */ + val =DIV_ROUND_CLOSEST (val,300 );/* convert to 0.3 ns step */ -if (val ==0 || val ==2 ) - rx_delay = val *2 ; +if (val <=7 ) + rx_delay = val;else dev_warn (smi->dev, -"EXT port RX delay must be 0 to 2 ns\n" ); +"EXT port RX delay must be 0 to 2.1 ns\n" ); } ret = regmap_update_bits(
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 181/1039 mfd: atmel-flexcom: Remove #ifdef CONFIG_PM_SLEEP
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 8c0fad75dcaa650e3f3145a2c35847bc6a65cb7f ]
Remove compilation flag and use __maybe_unused and pm_ptr instead.
--- drivers/mfd/atmel-flexcom.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mfd/atmel-flexcom.c +2 -4
@@ -87,8 +87,7 @@ static const struct of_device_id atmel_flexcom_of_match[] = { };MODULE_DEVICE_TABLE (of, atmel_flexcom_of_match); -#ifdef CONFIG_PM_SLEEP -static int atmel_flexcom_resume (struct device *dev) +static int __maybe_unused atmel_flexcom_resume (struct device *dev) {struct atmel_flexcom *ddata =dev_get_drvdata (dev);int err;
@@ -105,7 +104,6 @@ static int atmel_flexcom_resume(struct device *dev)return 0 ; } -#endif static SIMPLE_DEV_PM_OPS(atmel_flexcom_pm_ops, NULL, atmel_flexcom_resume);
@@ -114,7 +112,7 @@ static struct platform_driver atmel_flexcom_driver = { .probe = atmel_flexcom_probe, .driver = { .name = "atmel_flexcom", - .pm = &atmel_flexcom_pm_ops, + .pm = pm_ptr(&atmel_flexcom_pm_ops), .of_match_table = atmel_flexcom_of_match, }, };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 182/1039 mfd: atmel-flexcom: Use .resume_noirq
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 5d051cf94fd5834a1513aa77e542c49fd973988a ]
Flexcom IP embeds 3 other IPs: usart, i2c, spi and selects the operation mode (usart, i2c, spi) via mode register (FLEX_MR). On i2c bus there might be connected critical devices (like PMIC) which on suspend/resume should be suspended/resumed at the end/beginning. i2c uses .suspend_noirq/.resume_noirq for this kind of purposes. Align flexcom to use .resume_noirq as it should be resumed before the embedded IPs. Otherwise the embedded devices might behave badly.
--- drivers/mfd/atmel-flexcom.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mfd/atmel-flexcom.c +4 -3
@@ -87,7 +87,7 @@ static const struct of_device_id atmel_flexcom_of_match[] = { };MODULE_DEVICE_TABLE (of, atmel_flexcom_of_match); -static int __maybe_unused atmel_flexcom_resume (struct device *dev) +static int __maybe_unused atmel_flexcom_resume_noirq (struct device *dev) {struct atmel_flexcom *ddata =dev_get_drvdata (dev);int err;
@@ -105,8 +105,9 @@ static int __maybe_unused atmel_flexcom_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(atmel_flexcom_pm_ops, NULL, - atmel_flexcom_resume); +static const struct dev_pm_ops atmel_flexcom_pm_ops = { + .resume_noirq = atmel_flexcom_resume_noirq, +};static struct platform_driver atmel_flexcom_driver = { .probe = atmel_flexcom_probe,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 183/1039 bfq: Do not let waker requests skip proper accounting
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit c65e6fd460b4df796ecd6ea22e132076ed1f2820 ]
Commit 7cc4ffc55564 ("block, bfq: put reqs of waker and woken in dispatch list") added a condition to bfq_insert_request() which added waker's requests directly to dispatch list. The rationale was that completing waker's IO is needed to get more IO for the current queue. Although this rationale is valid, there is a hole in it. The waker does not necessarily serve the IO only for the current queue and maybe it's current IO is not needed for current queue to make progress. Furthermore injecting IO like this completely bypasses any service accounting within bfq and thus we do not properly track how much service is waker's queue getting or that the waker is actually doing any IO. Depending on the conditions this can result in the waker getting too much or too few service.
Consider for example the following job file:
[global]
directory=/mnt/repro/
rw=write
size=8gtime_based
runtime=30
ramp_time=10
blocksize=1m
direct=0
ioengine=sync
[slowwriter]
numjobs=1
prioclass=2
prio=7
fsync=200
[fastwriter]
numjobs=1
prioclass=2
prio=0
fsync=200
Despite processes have very different IO priorities, they get the same about of service. The reason is that bfq identifies these processes as having waker-wakee relationship and once that happens, IO from fastwriter gets injected during slowwriter's time slice. As a result bfq is not aware that fastwriter has any IO to do and constantly schedules only slowwriter's queue. Thus fastwriter is forced to compete with slowwriter's IO all the time instead of getting its share of time based on IO priority.
Drop the special injection condition from bfq_insert_request(). As a result, requests will be tracked and queued in a normal way and on next dispatch bfq_select_queue() can decide whether the waker's inserted requests should be injected during the current queue's timeslice or not.
--- block/bfq-iosched.c | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-)
block/bfq-iosched.c +1 -43
@@ -5991,48 +5991,7 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,spin_lock_irq (&bfqd->lock); bfqq =bfq_init_rq (rq); - -/* -* Reqs with at_head or passthrough flags set are to be put -* directly into dispatch list. Additional case for putting rq -* directly into the dispatch queue: the only active -* bfq_queues are bfqq and either its waker bfq_queue or one -* of its woken bfq_queues. The rationale behind this -* additional condition is as follows: -* - consider a bfq_queue, say Q1, detected as a waker of -* another bfq_queue, say Q2 -* - by definition of a waker, Q1 blocks the I/O of Q2, i.e., -* some I/O of Q1 needs to be completed for new I/O of Q2 -* to arrive. A notable example of waker is journald -* - so, Q1 and Q2 are in any respect the queues of two -* cooperating processes (or of two cooperating sets of -* processes): the goal of Q1's I/O is doing what needs to -* be done so that new Q2's I/O can finally be -* issued. Therefore, if the service of Q1's I/O is delayed, -* then Q2's I/O is delayed too. Conversely, if Q2's I/O is -* delayed, the goal of Q1's I/O is hindered. -* - as a consequence, if some I/O of Q1/Q2 arrives while -* Q2/Q1 is the only queue in service, there is absolutely -* no point in delaying the service of such an I/O. The -* only possible result is a throughput loss -* - so, when the above condition holds, the best option is to -* have the new I/O dispatched as soon as possible -* - the most effective and efficient way to attain the above -* goal is to put the new I/O directly in the dispatch -* list -* - as an additional restriction, Q1 and Q2 must be the only -* busy queues for this commit to put the I/O of Q2/Q1 in -* the dispatch list. This is necessary, because, if also -* other queues are waiting for service, then putting new -* I/O directly in the dispatch list may evidently cause a -* violation of service guarantees for the other queues -*/ -if (!bfqq || - (bfqq != bfqd->in_service_queue && - bfqd->in_service_queue !=NULL && -bfq_tot_busy_queues (bfqd) ==1 +bfq_bfqq_busy (bfqq) && - (bfqq->waker_bfqq == bfqd->in_service_queue || - bfqd->in_service_queue->waker_bfqq == bfqq)) || at_head) { +if (!bfqq || at_head) {if (at_head)list_add (&rq->queuelist, &bfqd->dispatch);else
@@ -6059,7 +6018,6 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,* merge). */ cmd_flags = rq->cmd_flags; -spin_unlock_irq (&bfqd->lock); bfq_update_insert_stats(q, bfqq, idle_timer_disabled,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 184/1039 libbpf: Silence uninitialized warning/error in btf_dump_dump_type_data
In reply to Greg Kroah-HartmanFrom: Alan Maguire <[email protected]>
[ Upstream commit 43174f0d4597325cb91f1f1f55263eb6e6101036 ]
When compiling libbpf with gcc 4.8.5, we see:
CC staticobjs/btf_dump.obtf_dump.c: In function ‘btf_dump_dump_type_data.isra.24’:
btf_dump.c:2296:5: error: ‘err’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (err < 0)
^
cc1: all warnings being treated as errors
make: *** [staticobjs/btf_dump.o] Error 1
While gcc 4.8.5 is too old to build the upstream kernel, it's possible it could be used to build standalone libbpf which suffers from the same problem. Silence the error by initializing 'err' to 0. The warning/error seems to be a false positive since err is set early in the function. Regardless we shouldn't prevent libbpf from building for this.
--- tools/lib/bpf/btf_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/btf_dump.c +1 -1
@@ -2194,7 +2194,7 @@ static int btf_dump_dump_type_data(struct btf_dump *d,__u8 bits_offset, __u8 bit_sz) { - int size, err; + int size, err = 0; size =btf_dump_type_data_check_overflow (d, t, id, data, bits_offset);if (size <0 )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 185/1039 media: i2c: imx274: fix s_frame_interval runtime resume not requested
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
[ Upstream commit da653498c20ba5b185214d8ae43b4e8e9594f520 ]
pm_runtime_resume_and_get should be called when the s_frame_interval is called.
The driver will try to access device registers to configure VMAX, coarse time and exposure.
Currently if the runtime is not resumed, this fails:
# media-ctl -d /dev/media0 --set-v4l2 '"IMX274 1-001a":0[fmt:SRGGB10_1X10/3840x2 160@1/10]'
IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 3840x2160, goodness 0 IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1920x1080, goodness -3000 IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1280x720, goodness -4000 IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1280x540, goodness -4180 IMX274 1-001a: __imx274_change_compose: selected 1x1 binning
IMX274 1-001a: imx274_set_frame_interval: input frame interval = 1 / 10 IMX274 1-001a: imx274_read_mbreg : addr 0x300e, val=0x1 (2 bytes) IMX274 1-001a: imx274_set_frame_interval : register SVR = 1
IMX274 1-001a: imx274_read_mbreg : addr 0x30f6, val=0x6a8 (2 bytes) IMX274 1-001a: imx274_set_frame_interval : register HMAX = 1704
IMX274 1-001a: imx274_set_frame_length : input length = 2112
IMX274 1-001a: imx274_write_mbreg : i2c bulk write failed, 30f8 = 884 (3 bytes) IMX274 1-001a: imx274_set_frame_length error = -121
IMX274 1-001a: imx274_set_frame_interval error = -121
Unable to setup formats: Remote I/O error (121)
The device is not resumed thus the remote I/O error.
Setting the frame interval works at streaming time, because pm_runtime_resume_and_get is called at s_stream time before sensor setup. The failure happens when only the s_frame_interval is called separately independently on streaming time.
--- drivers/media/i2c/imx274.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/media/i2c/imx274.c +5 -0
@@ -1367,6 +1367,10 @@ static int imx274_s_frame_interval(struct v4l2_subdev *sd,int min, max, def;int ret; + ret =pm_runtime_resume_and_get (&imx274->client->dev); +if (ret <0 ) +return ret; +mutex_lock (&imx274->lock); ret =imx274_set_frame_interval (imx274, fi->interval);
@@ -1398,6 +1402,7 @@ static int imx274_s_frame_interval(struct v4l2_subdev *sd, unlock:mutex_unlock (&imx274->lock); +pm_runtime_put (&imx274->client->dev);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 186/1039 media: i2c: Re-order runtime pm initialisation
In reply to Greg Kroah-HartmanFrom: Daniel Scally <[email protected]>
[ Upstream commit d2484fbf780762f6f9cc3abb7a07ee42dca2eaa3 ]
The kerneldoc for pm_runtime_set_suspended() says:
"It is not valid to call this function for devices with runtime PM enabled"
To satisfy that requirement, re-order the calls so that pm_runtime_enable() is the last one.
--- drivers/media/i2c/ov8865.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov8865.c +1 -1
@@ -2899,8 +2899,8 @@ static int ov8865_probe(struct i2c_clien/* Runtime PM */ -pm_runtime_enable (sensor->dev);pm_runtime_set_suspended (sensor->dev); +pm_runtime_enable (sensor->dev);/* V4L2 subdev register */
Greg Kroah-Hartman
maintainerPATCH 187/1039 media: i2c: ov8865: Fix lockdep error
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 6e1c9bc9ae96e57bcd8807174f2c0f44f9ef7938 ]
ov8865_state_init() calls ov8865_state_mipi_configure() which uses __v4l2_ctrl_s_ctrl[_int64](). This means that sensor->mutex (which is also sensor->ctrls.handler.lock) must be locked before calling ov8865_state_init().
Note ov8865_state_mipi_configure() is also used in other places where the lock is already held so it cannot be changed itself.
This fixes the following lockdep kernel WARN:
[ 13.233421] WARNING: CPU: 0 PID: 8 at drivers/media/v4l2-core/v4l2-ctrls-api.c:833 __v4l2_ctrl_s_ctrl+0x4d/0x60 [videodev] ... [ 13.234063] Call Trace: [ 13.234074] ov8865_state_configure+0x98b/0xc00 [ov8865] [ 13.234095] ov8865_probe+0x4b1/0x54c [ov8865] [ 13.234117] i2c_device_probe+0x13c/0x2d0
--- drivers/media/i2c/ov8865.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/ov8865.c +2 -0
@@ -2893,7 +2893,9 @@ static int ov8865_probe(struct i2c_clienif (ret) goto error_mutex; +mutex_lock (&sensor->mutex); ret =ov8865_state_init (sensor); +mutex_unlock (&sensor->mutex);if (ret) goto error_ctrls;
Greg Kroah-Hartman
maintainerPATCH 188/1039 media: rcar-csi2: Correct the selection of hsfreqrange
In reply to Greg Kroah-HartmanFrom: Suresh Udipi <[email protected]>
[ Upstream commit cee44d4fbacbbdfe62697ec94e76c6e4f726c5df ]
hsfreqrange should be chosen based on the calculated mbps which is closer to the default bit rate and within the range as per table[1]. But current calculation always selects first value which is greater than or equal to the calculated mbps which may lead to chosing a wrong range in some cases.
For example for 360 mbps for H3/M3N
Existing logic selects
Calculated value 360Mbps : Default 400Mbps Range [368.125 -433.125 mbps]
This hsfreqrange is out of range.
The logic is changed to get the default value which is closest to the calculated value [1]
Calculated value 360Mbps : Default 350Mbps Range [320.625 -380.625 mpbs]
[1] specs r19uh0105ej0200-r-car-3rd-generation.pdf [Table 25.9]
Please note that According to Renesas in Table 25.9 the range for 220 default value is corrected as below
|Range (Mbps) | Default Bit rate (Mbps) |
-----------------------------------------------
| 197.125-244.125 | 220 |
-----------------------------------------------
--- drivers/media/platform/rcar-vin/rcar-csi2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/media/platform/rcar-vin/rcar-csi2.c +8 -1
@@ -542,16 +542,23 @@ static int rcsi2_wait_phy_start(struct rcar_csi2 *priv,static int rcsi2_set_phypll (struct rcar_csi2 *priv,unsigned int mbps) {const struct rcsi2_mbps_reg *hsfreq; +const struct rcsi2_mbps_reg *hsfreq_prev =NULL ; -for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps !=0 ; hsfreq++) +for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps !=0 ; hsfreq++) {if (hsfreq->mbps >= mbps)break ; + hsfreq_prev = hsfreq; + }if (!hsfreq->mbps) {dev_err (priv->dev,"Unsupported PHY speed (%u Mbps)" , mbps);return -ERANGE ; } +if (hsfreq_prev && + ((mbps - hsfreq_prev->mbps) <= (hsfreq->mbps - mbps))) + hsfreq = hsfreq_prev; +rcsi2_write (priv,PHYPLL_REG ,PHYPLL_HSFREQRANGE (hsfreq->reg));return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 189/1039 media: imx-pxp: Initialize the spinlock prior to using it
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit ed2f97ad4b21072f849cf4ae6645d1f2b1d3f550 ]
After devm_request_threaded_irq() is called there is a chance that an interrupt may occur before the spinlock is initialized, which will trigger a kernel oops.
To prevent that, move the initialization of the spinlock prior to requesting the interrupts.
--- drivers/media/platform/imx-pxp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/imx-pxp.c +2 -2
@@ -1659,6 +1659,8 @@ static int pxp_probe(struct platform_device *pdev)if (irq <0 )return irq; +spin_lock_init (&dev->irqlock); + ret =devm_request_threaded_irq (&pdev->dev, irq,NULL , pxp_irq_handler,IRQF_ONESHOT ,dev_name (&pdev->dev), dev);if (ret <0 ) {
@@ -1676,8 +1678,6 @@ static int pxp_probe(struct platform_device *pdev) goto err_clk; } -spin_lock_init (&dev->irqlock); - ret =v4l2_device_register (&pdev->dev, &dev->v4l2_dev);if (ret) goto err_clk;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 190/1039 media: si470x-i2c: fix possible memory leak in si470x_i2c_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit ef054e345ed8c79ce1121a3599b5a2dfd78e57a0 ]
n the 'radio->hdl.error' error handling, ctrl handler allocated by v4l2_ctrl_new_std() does not released, and caused memory leak as follows:
unreferenced object 0xffff888033d54200 (size 256):
comm "i2c-si470x-19", pid 909, jiffies 4294914203 (age 8.072s) hex dump (first 32 bytes):
e8 69 11 03 80 88 ff ff 00 46 d5 33 80 88 ff ff .i.......F.3....
10 42 d5 33 80 88 ff ff 10 42 d5 33 80 88 ff ff .B.3.....B.3....
backtrace:
[<00000000086bd4ed>] __kmalloc_node+0x1eb/0x360
[<00000000bdb68871>] kvmalloc_node+0x66/0x120
[<00000000fac74e4c>] v4l2_ctrl_new+0x7b9/0x1c60 [videodev]
[<00000000693bf940>] v4l2_ctrl_new_std+0x19b/0x270 [videodev]
[<00000000c0cb91bc>] si470x_i2c_probe+0x2d3/0x9a0 [radio_si470x_i2c]
[<0000000056a6f01f>] i2c_device_probe+0x4d8/0xbe0Fix the error handling path to avoid memory leak.
--- drivers/media/radio/si470x/radio-si470x-i2c.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/radio/si470x/radio-si470x-i2c.c +1 -2
@@ -368,7 +368,7 @@ static int si470x_i2c_probe(struct i2c_client *client)if (radio->hdl.error) { retval = radio->hdl.error;dev_err (&client->dev,"couldn't register control\n" ); - goto err_dev; + goto err_all; }/* video device initialization */
@@ -463,7 +463,6 @@ static int si470x_i2c_probe(struct i2c_client *client)return 0 ; err_all:v4l2_ctrl_handler_free (&radio->hdl); -err_dev:v4l2_device_unregister (&radio->v4l2_dev); err_initial:return retval;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 191/1039 media: mtk-vcodec: Fix an error handling path in mtk_vcodec_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 615c6f28b9ad7efc9bfbef2cafc6a0c5bc0c21e0 ]
In case of error the 'media_device_init()' call is not balanced by a corresponding 'media_device_cleanup()' call.
Add it, when needed, as already done in the remove function.
--- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c +2 -0
@@ -358,6 +358,8 @@ err_media_reg:if (dev->vdec_pdata->uses_stateless_api)v4l2_m2m_unregister_media_controller (dev->m2m_dev_dec); err_reg_cont: +if (dev->vdec_pdata->uses_stateless_api) +media_device_cleanup (&dev->mdev_dec);destroy_workqueue (dev->decode_workqueue); err_event_workq:v4l2_m2m_release (dev->m2m_dev_dec);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 192/1039 media: mtk-vcodec: call v4l2_m2m_ctx_release first when file is released
In reply to Greg Kroah-HartmanFrom: Dafna Hirschfeld <[email protected]>
[ Upstream commit 9f89c881bffbdffe4060ffaef3489a2830a6dd9c ]
The func v4l2_m2m_ctx_release waits for currently running jobs to finish and then stop streaming both queues and frees the buffers. All this should be done before the call to mtk_vcodec_enc_release which frees the encoder handler. This fixes null-pointer dereference bug:
[ 638.028076] Mem abort info: [ 638.030932] ESR = 0x96000004 [ 638.033978] EC = 0x25: DABT (current EL), IL = 32 bits [ 638.039293] SET = 0, FnV = 0 [ 638.042338] EA = 0, S1PTW = 0 [ 638.045474] FSC = 0x04: level 0 translation fault [ 638.050349] Data abort info: [ 638.053224] ISV = 0, ISS = 0x00000004 [ 638.057055] CM = 0, WnR = 0 [ 638.060018] user pgtable: 4k pages, 48-bit VAs, pgdp=000000012b6db000 [ 638.066485] [00000000000001a0] pgd=0000000000000000, p4d=0000000000000000 [ 638.073277] Internal error: Oops: 96000004 [#1] SMP [ 638.078145] Modules linked in: rfkill mtk_vcodec_dec mtk_vcodec_enc uvcvideo mtk_mdp mtk_vcodec_common videobuf2_dma_contig v4l2_h264 cdc_ether v4l2_mem2mem videobuf2_vmalloc usbnet videobuf2_memops videobuf2_v4l2 r8152 videobuf2_common videodev cros_ec_sensors cros_ec_sensors_core industrialio_triggered_buffer kfifo_buf elan_i2c elants_i2c sbs_battery mc cros_usbpd_charger cros_ec_chardev cros_usbpd_logger crct10dif_ce mtk_vpu fuse ip_tables x_tables ipv6 [ 638.118583] CPU: 0 PID: 212 Comm: kworker/u8:5 Not tainted 5.15.0-06427-g58a1d4dcfc74-dirty #109 [ 638.127357] Hardware name: Google Elm (DT) [ 638.131444] Workqueue: mtk-vcodec-enc mtk_venc_worker [mtk_vcodec_enc] [ 638.137974] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 638.144925] pc : vp8_enc_encode+0x34/0x2b0 [mtk_vcodec_enc] [ 638.150493] lr : venc_if_encode+0xac/0x1b0 [mtk_vcodec_enc] [ 638.156060] sp : ffff8000124d3c40 [ 638.159364] x29: ffff8000124d3c40 x28: 0000000000000000 x27: 0000000000000000 [ 638.166493] x26: 0000000000000000 x25: ffff0000e7f252d0 x24: ffff8000124d3d58 [ 638.173621] x23: ffff8000124d3d58 x22: ffff8000124d3d60 x21: 0000000000000001 [ 638.180750] x20: ffff80001137e000 x19: 0000000000000000 x18: 0000000000000001 [ 638.187878] x17: 000000040044ffff x16: 00400032b5503510 x15: 0000000000000000 [ 638.195006] x14: ffff8000118536c0 x13: ffff8000ee1da000 x12: 0000000030d4d91d [ 638.202134] x11: 0000000000000000 x10: 0000000000000980 x9 : ffff8000124d3b20 [ 638.209262] x8 : ffff0000c18d4ea0 x7 : ffff0000c18d44c0 x6 : ffff0000c18d44c0 [ 638.216391] x5 : ffff80000904a3b0 x4 : ffff8000124d3d58 x3 : ffff8000124d3d60 [ 638.223519] x2 : ffff8000124d3d78 x1 : 0000000000000001 x0 : ffff80001137efb8 [ 638.230648] Call trace: [ 638.233084] vp8_enc_encode+0x34/0x2b0 [mtk_vcodec_enc] [ 638.238304] venc_if_encode+0xac/0x1b0 [mtk_vcodec_enc] [ 638.243525] mtk_venc_worker+0x110/0x250 [mtk_vcodec_enc] [ 638.248918] process_one_work+0x1f8/0x498 [ 638.252923] worker_thread+0x140/0x538 [ 638.256664] kthread+0x148/0x158 [ 638.259884] ret_from_fork+0x10/0x20 [ 638.263455] Code: f90023f9 2a0103f5 aa0303f6 aa0403f8 (f940d277) [ 638.269538] ---[ end trace e374fc10f8e181f5 ]---
[gst-master] root@debian:~/gst-build# [ 638.019193] Unable to handle kernel NULL pointer dereference at virtual address 00000000000001a0
--- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +1 -1
@@ -214,11 +214,11 @@ static int fops_vcodec_release(struct file *file)mtk_v4l2_debug (1 ,"[%d] encoder" , ctx->id);mutex_lock (&dev->dev_mutex); +v4l2_m2m_ctx_release (ctx->m2m_ctx);mtk_vcodec_enc_release (ctx);v4l2_fh_del (&ctx->fh);v4l2_fh_exit (&ctx->fh);v4l2_ctrl_handler_free (&ctx->ctrl_hdl); -v4l2_m2m_ctx_release (ctx->m2m_ctx);list_del_init (&ctx->list);kfree (ctx);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 193/1039 media: hantro: Hook up RK3399 JPEG encoder output
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 230d683ae04894933720425c8dead9508a09ebc3 ]
The JPEG encoder found in the Hantro H1 encoder block only produces a raw entropy-encoded scan. The driver is responsible for building a JPEG compliant bitstream and placing the entropy-encoded scan in it. Right now the driver uses a bounce buffer for the hardware to output the raw scan to.
In commit e765dba11ec2 ("hantro: Move hantro_enc_buf_finish to JPEG codec_ops.done"), the code that copies the raw scan from the bounce buffer to the capture buffer was moved, but was only hooked up for the Hantro H1 (then RK3288) variant. The RK3399 variant was broken, producing a JPEG bitstream without the scan, and the capture buffer's .bytesused field unset.
Fix this by duplicating the code that is executed when the JPEG encoder finishes encoding a frame. As the encoded length is read back from hardware, and the variants having different register layouts, the code is duplicated rather than shared.
--- .../staging/media/hantro/hantro_h1_jpeg_enc.c | 2 +- drivers/staging/media/hantro/hantro_hw.h | 3 ++- .../media/hantro/rockchip_vpu2_hw_jpeg_enc.c | 17 +++++++++++++++++ drivers/staging/media/hantro/rockchip_vpu_hw.c | 5 +++-- 4 files changed, 23 insertions(+), 4 deletions(-)
drivers/staging/media/hantro/hantro_h1_jpeg_enc.c +1 -1
@@ -140,7 +140,7 @@ int hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx)return 0 ; } -void hantro_jpeg_enc_done (struct hantro_ctx *ctx) +void hantro_h1_jpeg_enc_done (struct hantro_ctx *ctx) {struct hantro_dev *vpu = ctx->dev;u32 bytesused =vepu_read (vpu,H1_REG_STR_BUF_LIMIT ) /8 ;
drivers/staging/media/hantro/hantro_hw.h +2 -1
@@ -239,7 +239,8 @@ int hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx);int rockchip_vpu2_jpeg_enc_run (struct hantro_ctx *ctx);int hantro_jpeg_enc_init (struct hantro_ctx *ctx);void hantro_jpeg_enc_exit (struct hantro_ctx *ctx); -void hantro_jpeg_enc_done (struct hantro_ctx *ctx); +void hantro_h1_jpeg_enc_done (struct hantro_ctx *ctx); +void rockchip_vpu2_jpeg_enc_done (struct hantro_ctx *ctx);dma_addr_t hantro_h264_get_ref_buf (struct hantro_ctx *ctx,unsigned int dpb_idx);
drivers/staging/media/hantro/rockchip_vpu2_hw_jpeg_enc.c +17 -0
@@ -171,3 +171,20 @@ int rockchip_vpu2_jpeg_enc_run(struct hantro_ctx *ctx)return 0 ; } + +void rockchip_vpu2_jpeg_enc_done (struct hantro_ctx *ctx) +{ +struct hantro_dev *vpu = ctx->dev; +u32 bytesused =vepu_read (vpu,VEPU_REG_STR_BUF_LIMIT ) /8 ; +struct vb2_v4l2_buffer *dst_buf =hantro_get_dst_buf (ctx); + +/* +* TODO: Rework the JPEG encoder to eliminate the need +* for a bounce buffer. +*/ +memcpy (vb2_plane_vaddr (&dst_buf->vb2_buf,0 ) + + ctx->vpu_dst_fmt->header_size, + ctx->jpeg_enc.bounce_buffer.cpu, bytesused); +vb2_set_plane_payload (&dst_buf->vb2_buf,0 , + ctx->vpu_dst_fmt->header_size + bytesused); +}
drivers/staging/media/hantro/rockchip_vpu_hw.c +3 -2
@@ -343,7 +343,7 @@ static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = { .run = hantro_h1_jpeg_enc_run, .reset = rockchip_vpu1_enc_reset, .init = hantro_jpeg_enc_init, - .done = hantro_jpeg_enc_done, + .done = hantro_h1_jpeg_enc_done, .exit = hantro_jpeg_enc_exit, }, [HANTRO_MODE_H264_DEC] = {
@@ -371,7 +371,7 @@ static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = { .run = hantro_h1_jpeg_enc_run, .reset = rockchip_vpu1_enc_reset, .init = hantro_jpeg_enc_init, - .done = hantro_jpeg_enc_done, + .done = hantro_h1_jpeg_enc_done, .exit = hantro_jpeg_enc_exit, }, [HANTRO_MODE_H264_DEC] = {
@@ -399,6 +399,7 @@ static const struct hantro_codec_ops rk3399_vpu_codec_ops[] = { .run = rockchip_vpu2_jpeg_enc_run, .reset = rockchip_vpu2_enc_reset, .init = hantro_jpeg_enc_init, + .done = rockchip_vpu2_jpeg_enc_done, .exit = hantro_jpeg_enc_exit, }, [HANTRO_MODE_H264_DEC] = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 194/1039 media: coda: fix CODA960 JPEG encoder buffer overflow
In reply to Greg Kroah-HartmanFrom: Philipp Zabel <[email protected]>
[ Upstream commit 1a59cd88f55068710f6549bee548846661673780 ]
Stop the CODA960 JPEG encoder from overflowing capture buffers. The bitstream buffer overflow interrupt doesn't seem to be connected, so this has to be handled via timeout instead.
--- drivers/media/platform/coda/coda-common.c | 8 +++++--- drivers/media/platform/coda/coda-jpeg.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-)
drivers/media/platform/coda/coda-common.c +5 -3
@@ -1537,11 +1537,13 @@ static void coda_pic_run_work(struct work_struct *work)if (!wait_for_completion_timeout (&ctx->completion,msecs_to_jiffies (1000 ))) { -dev_err (dev->dev,"CODA PIC_RUN timeout\n" ); +if (ctx->use_bit) { +dev_err (dev->dev,"CODA PIC_RUN timeout\n" ); - ctx->hold = true; + ctx->hold = true; -coda_hw_reset (ctx); +coda_hw_reset (ctx); + }if (ctx->ops->run_timeout) ctx->ops->run_timeout (ctx);
drivers/media/platform/coda/coda-jpeg.c +20 -1
@@ -1127,7 +1127,8 @@ static int coda9_jpeg_prepare_encode(struct coda_ctx *ctx)coda_write (dev,0 ,CODA9_REG_JPEG_GBU_BT_PTR );coda_write (dev,0 ,CODA9_REG_JPEG_GBU_WD_PTR );coda_write (dev,0 ,CODA9_REG_JPEG_GBU_BBSR ); -coda_write (dev,0 ,CODA9_REG_JPEG_BBC_STRM_CTRL ); +coda_write (dev,BIT (31 ) | ((end_addr - start_addr - header_len) /256 ), +CODA9_REG_JPEG_BBC_STRM_CTRL );coda_write (dev,0 ,CODA9_REG_JPEG_GBU_CTRL );coda_write (dev,0 ,CODA9_REG_JPEG_GBU_FF_RPTR );coda_write (dev,127 ,CODA9_REG_JPEG_GBU_BBER );
@@ -1257,6 +1258,23 @@ static void coda9_jpeg_finish_encode(struct coda_ctx *ctx)coda_hw_reset (ctx); } +static void coda9_jpeg_encode_timeout (struct coda_ctx *ctx) +{ +struct coda_dev *dev = ctx->dev; +u32 end_addr, wr_ptr; + +/* Handle missing BBC overflow interrupt via timeout */ + end_addr =coda_read (dev,CODA9_REG_JPEG_BBC_END_ADDR ); + wr_ptr =coda_read (dev,CODA9_REG_JPEG_BBC_WR_PTR ); +if (wr_ptr >= end_addr -256 ) { +v4l2_err (&dev->v4l2_dev,"JPEG too large for capture buffer\n" ); +coda9_jpeg_finish_encode (ctx); +return ; + } + +coda_hw_reset (ctx); +} +static void coda9_jpeg_release (struct coda_ctx *ctx) {int i;
@@ -1276,6 +1294,7 @@ const struct coda_context_ops coda9_jpeg_encode_ops = { .start_streaming = coda9_jpeg_start_encoding, .prepare_run = coda9_jpeg_prepare_encode, .finish_run = coda9_jpeg_finish_encode, + .run_timeout = coda9_jpeg_encode_timeout, .release = coda9_jpeg_release, };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 195/1039 media: venus: correct low power frequency calculation for encoder
In reply to Greg Kroah-HartmanFrom: Mansur Alisha Shaik <[email protected]>
[ Upstream commit b1f9bb8020783a48151e3a2864fbdc70548566dd ]
In exististing implimentation, in min_loaded_core() for low_power vpp frequency value is considering as vpp_freq instead of low_power_freq. Fixed this by correcting vpp frequency calculation for encoder.
--- drivers/media/platform/qcom/venus/pm_helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/pm_helpers.c +2 -2
@@ -587,8 +587,8 @@ min_loaded_core(struct venus_inst *inst, u32 *min_coreid, u32 *min_load, bool loif (inst->session_type ==VIDC_SESSION_TYPE_DEC ) vpp_freq = inst_pos->clk_data.vpp_freq;else if (inst->session_type ==VIDC_SESSION_TYPE_ENC ) - vpp_freq = low_power ? inst_pos->clk_data.vpp_freq : - inst_pos->clk_data.low_power_freq; + vpp_freq = low_power ? inst_pos->clk_data.low_power_freq : + inst_pos->clk_data.vpp_freq;else continue ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 196/1039 media: venus: core: Fix a potential NULL pointer dereference in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit e4debea9be7d5db52bc6a565a4c02c3c6560d093 ]
The normal path of the function makes the assumption that 'pm_ops->core_power' may be NULL.
We should make the same assumption in the error handling path or a NULL pointer dereference may occur.
Add the missing test before calling 'pm_ops->core_power'
--- drivers/media/platform/qcom/venus/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/venus/core.c +2 -1
@@ -473,7 +473,8 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev) err_video_path:icc_set_bw (core->cpucfg_path,kbps_to_icc (1000 ),0 ); err_cpucfg_path: - pm_ops->core_power (core,POWER_ON ); +if (pm_ops->core_power) + pm_ops->core_power (core,POWER_ON );return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 197/1039 media: venus: core: Fix a resource leak in the error handling path of venus_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 8cc7a1b2aca067397a016cdb971a5e6ad9b640c7 ]
A successful 'of_platform_populate()' call should be balanced by a corresponding 'of_platform_depopulate()' call in the error handling path of the probe, as already done in the remove function.
A successful 'venus_firmware_init()' call should be balanced by a corresponding 'venus_firmware_deinit()' call in the error handling path of the probe, as already done in the remove function.
Update the error handling path accordingly.
--- drivers/media/platform/qcom/venus/core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/core.c +6 -2
@@ -350,11 +350,11 @@ static int venus_probe(struct platform_device *pdev) ret =venus_firmware_init (core);if (ret) - goto err_runtime_disable; + goto err_of_depopulate; ret =venus_boot (core);if (ret) - goto err_runtime_disable; + goto err_firmware_deinit; ret =hfi_core_resume (core, true);if (ret)
@@ -386,6 +386,10 @@ err_dev_unregister:v4l2_device_unregister (&core->v4l2_dev); err_venus_shutdown:venus_shutdown (core); +err_firmware_deinit: +venus_firmware_deinit (core); +err_of_depopulate: +of_platform_depopulate (dev); err_runtime_disable:pm_runtime_put_noidle (dev);pm_runtime_set_suspended (dev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 198/1039 net: stmmac: Add platform level debug register dump feature
In reply to Greg Kroah-HartmanFrom: Bhupesh Sharma <[email protected]>
[ Upstream commit 4047b9db1aa7512a10ba3560a3f63821c8c40235 ]
dwmac-qcom-ethqos currently exposes a mechanism to dump rgmii registers after the 'stmmac_dvr_probe()' returns. However with commit 5ec55823438e ("net: stmmac: add clocks management for gmac driver"), we now let 'pm_runtime_put()' disable the clocks before returning from 'stmmac_dvr_probe()'.
This causes a crash when 'rgmii_dump()' register dumps are enabled, as the clocks are already off.
Since other dwmac drivers (possible future users as well) might require a similar register dump feature, introduce a platform level callback to allow the same.
This fixes the crash noticed while enabling rgmii_dump() dumps in dwmac-qcom-ethqos driver as well. It also allows future changes to keep a invoking the register dump callback from the correct place inside 'stmmac_dvr_probe()'.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 7 ++++--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++ include/linux/stmmac.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +4 -3
@@ -113,8 +113,10 @@ static void rgmii_updatel(struct qcom_ethqos *ethqos,rgmii_writel (ethqos, temp, offset); } -static void rgmii_dump (struct qcom_ethqos *ethqos) +static void rgmii_dump (void *priv) { +struct qcom_ethqos *ethqos = priv; +dev_dbg (ðqos->pdev->dev,"Rgmii register dump\n" );dev_dbg (ðqos->pdev->dev,"RGMII_IO_MACRO_CONFIG: %x\n" ,rgmii_readl (ethqos,RGMII_IO_MACRO_CONFIG ));
@@ -499,6 +501,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->bsp_priv = ethqos; plat_dat->fix_mac_speed = ethqos_fix_mac_speed; + plat_dat->dump_debug_regs = rgmii_dump; plat_dat->has_gmac4 =1 ; plat_dat->pmt =1 ; plat_dat->tso_en =of_property_read_bool (np,"snps,tso" );
@@ -507,8 +510,6 @@ static int qcom_ethqos_probe(struct platform_device *pdev)if (ret) goto err_clk; -rgmii_dump (ethqos); -return ret; err_clk:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -0
@@ -7094,6 +7094,9 @@ int stmmac_dvr_probe(struct device *device,stmmac_init_fs (ndev);#endif +if (priv->plat->dump_debug_regs) + priv->plat->dump_debug_regs (priv->plat->bsp_priv); +/* Let pm_runtime_put() disable the clocks. * If CONFIG_PM is not enabled, the clocks will stay powered. */
include/linux/stmmac.h +1 -0
@@ -233,6 +233,7 @@ struct plat_stmmacenet_data {int (*clks_config)(void *priv,bool enabled);int (*crosststamp)(ktime_t *device,struct system_counterval_t *system,void *ctx); +void (*dump_debug_regs)(void *priv);void *bsp_priv;struct clk *stmmac_clk;struct clk *pclk;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 199/1039 net: lantiq: fix missing free_netdev() on error in ltq_etop_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 2680ce7fc9939221da16e86a2e73cc1df563c82c ]
Add the missing free_netdev() before return from ltq_etop_probe() in the error handling case.
--- drivers/net/ethernet/lantiq_etop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/lantiq_etop.c +2 -2
@@ -687,13 +687,13 @@ ltq_etop_probe(struct platform_device *pdev) err =device_property_read_u32 (&pdev->dev,"lantiq,tx-burst-length" , &priv->tx_burst_len);if (err <0 ) {dev_err (&pdev->dev,"unable to read tx-burst-length property\n" ); -return err; + goto err_free; } err =device_property_read_u32 (&pdev->dev,"lantiq,rx-burst-length" , &priv->rx_burst_len);if (err <0 ) {dev_err (&pdev->dev,"unable to read rx-burst-length property\n" ); -return err; + goto err_free; }for (i =0 ; i <MAX_DMA_CHAN ; i++) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 200/1039 thermal/drivers/imx: Implement runtime PM support
In reply to Greg Kroah-HartmanFrom: Oleksij Rempel <[email protected]>
[ Upstream commit 4cf2ddf16e175ee18c5c29865c32da7d6269cf44 ]
Starting with commit d92ed2c9d3ff ("thermal: imx: Use driver's local data to decide whether to run a measurement") this driver stared using irq_enabled flag to make decision to power on/off the thermal core. This triggered a regression, where after reaching critical temperature, alarm IRQ handler set irq_enabled to false, disabled thermal core and was not able read temperature and disable cooling sequence.
In case the cooling device is "CPU/GPU freq", the system will run with reduce performance until next reboot.
To solve this issue, we need to move all parts implementing hand made runtime power management and let it handle actual runtime PM framework.
--- drivers/thermal/imx_thermal.c | 145 +++++++++++++++++++++------------- 1 file changed, 91 insertions(+), 54 deletions(-)
drivers/thermal/imx_thermal.c +91 -54
@@ -15,6 +15,7 @@#include <linux/regmap.h> #include <linux/thermal.h> #include <linux/nvmem-consumer.h> +#include <linux/pm_runtime.h> #define REG_SET 0x4#define REG_CLR 0x8
@@ -194,6 +195,7 @@ static struct thermal_soc_data thermal_imx7d_data = { };struct imx_thermal_data { +struct device *dev;struct cpufreq_policy *policy;struct thermal_zone_device *tz;struct thermal_cooling_device *cdev;
@@ -252,44 +254,15 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)const struct thermal_soc_data *soc_data = data->socdata;struct regmap *map = data->tempmon;unsigned int n_meas; -bool wait, run_measurement;u32 val; +int ret; - run_measurement = !data->irq_enabled; -if (!run_measurement) { -/* Check if a measurement is currently in progress */ -regmap_read (map, soc_data->temp_data, &val); - wait = !(val & soc_data->temp_valid_mask); - }else { -/* -* Every time we measure the temperature, we will power on the -* temperature sensor, enable measurements, take a reading, -* disable measurements, power off the temperature sensor. -*/ -regmap_write (map, soc_data->sensor_ctrl +REG_CLR , - soc_data->power_down_mask); -regmap_write (map, soc_data->sensor_ctrl +REG_SET , - soc_data->measure_temp_mask); - - wait = true; - } - -/* -* According to the temp sensor designers, it may require up to ~17us -* to complete a measurement. -*/ -if (wait) -usleep_range (20 ,50 ); + ret =pm_runtime_resume_and_get (data->dev); +if (ret <0 ) +return ret;regmap_read (map, soc_data->temp_data, &val); -if (run_measurement) { -regmap_write (map, soc_data->sensor_ctrl +REG_CLR , - soc_data->measure_temp_mask); -regmap_write (map, soc_data->sensor_ctrl +REG_SET , - soc_data->power_down_mask); - } -if ((val & soc_data->temp_valid_mask) ==0 ) {dev_dbg (&tz->device,"temp measurement never finished\n" );return -EAGAIN ;
@@ -328,6 +301,8 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)enable_irq (data->irq); } +pm_runtime_put (data->dev); +return 0 ; }
@@ -335,24 +310,16 @@ static int imx_change_mode(struct thermal_zone_device *tz, enum thermal_device_mode mode) {struct imx_thermal_data *data = tz->devdata; -struct regmap *map = data->tempmon; -const struct thermal_soc_data *soc_data = data->socdata;if (mode ==THERMAL_DEVICE_ENABLED ) { -regmap_write (map, soc_data->sensor_ctrl +REG_CLR , - soc_data->power_down_mask); -regmap_write (map, soc_data->sensor_ctrl +REG_SET , - soc_data->measure_temp_mask); +pm_runtime_get (data->dev);if (!data->irq_enabled) { data->irq_enabled = true;enable_irq (data->irq); } }else { -regmap_write (map, soc_data->sensor_ctrl +REG_CLR , - soc_data->measure_temp_mask); -regmap_write (map, soc_data->sensor_ctrl +REG_SET , - soc_data->power_down_mask); +pm_runtime_put (data->dev);if (data->irq_enabled) {disable_irq (data->irq);
@@ -393,6 +360,11 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, int temp) {struct imx_thermal_data *data = tz->devdata; +int ret; + + ret =pm_runtime_resume_and_get (data->dev); +if (ret <0 ) +return ret;/* do not allow changing critical threshold */ if (trip ==IMX_TRIP_CRITICAL )
@@ -406,6 +378,8 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,imx_set_alarm_temp (data, temp); +pm_runtime_put (data->dev); +return 0 ; }
@@ -681,6 +655,8 @@ static int imx_thermal_probe(struct platform_device *pdev)if (!data)return -ENOMEM ; + data->dev = &pdev->dev; + map =syscon_regmap_lookup_by_phandle (pdev->dev.of_node,"fsl,tempmon" );if (IS_ERR (map)) { ret =PTR_ERR (map);
@@ -800,6 +776,16 @@ static int imx_thermal_probe(struct platform_device *pdev) data->socdata->power_down_mask);regmap_write (map, data->socdata->sensor_ctrl +REG_SET , data->socdata->measure_temp_mask); +/* After power up, we need a delay before first access can be done. */ +usleep_range (20 ,50 ); + +/* the core was configured and enabled just before */ +pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (data->dev); + + ret =pm_runtime_resume_and_get (data->dev); +if (ret <0 ) + goto disable_runtime_pm; data->irq_enabled = true; ret =thermal_zone_device_enable (data->tz);
@@ -814,10 +800,15 @@ static int imx_thermal_probe(struct platform_device *pdev) goto thermal_zone_unregister; } +pm_runtime_put (data->dev); +return 0 ; thermal_zone_unregister:thermal_zone_device_unregister (data->tz); +disable_runtime_pm: +pm_runtime_put_noidle (data->dev); +pm_runtime_disable (data->dev); clk_disable:clk_disable_unprepare (data->thermal_clk); legacy_cleanup:
@@ -829,13 +820,9 @@ legacy_cleanup:static int imx_thermal_remove (struct platform_device *pdev) {struct imx_thermal_data *data =platform_get_drvdata (pdev); -struct regmap *map = data->tempmon; -/* Disable measurements */ -regmap_write (map, data->socdata->sensor_ctrl +REG_SET , - data->socdata->power_down_mask); -if (!IS_ERR (data->thermal_clk)) -clk_disable_unprepare (data->thermal_clk); +pm_runtime_put_noidle (data->dev); +pm_runtime_disable (data->dev);thermal_zone_device_unregister (data->tz);imx_thermal_unregister_legacy_cooling (data);
@@ -858,29 +845,79 @@ static int __maybe_unused imx_thermal_suspend(struct device *dev) ret =thermal_zone_device_disable (data->tz);if (ret)return ret; + +return pm_runtime_force_suspend (data->dev); +} + +static int __maybe_unused imx_thermal_resume (struct device *dev) +{ +struct imx_thermal_data *data =dev_get_drvdata (dev); +int ret; + + ret =pm_runtime_force_resume (data->dev); +if (ret) +return ret; +/* Enabled thermal sensor after resume */ +return thermal_zone_device_enable (data->tz); +} + +static int __maybe_unused imx_thermal_runtime_suspend (struct device *dev) +{ +struct imx_thermal_data *data =dev_get_drvdata (dev); +const struct thermal_soc_data *socdata = data->socdata; +struct regmap *map = data->tempmon; +int ret; + + ret =regmap_write (map, socdata->sensor_ctrl +REG_CLR , + socdata->measure_temp_mask); +if (ret) +return ret; + + ret =regmap_write (map, socdata->sensor_ctrl +REG_SET , + socdata->power_down_mask); +if (ret) +return ret; +clk_disable_unprepare (data->thermal_clk);return 0 ; } -static int __maybe_unused imx_thermal_resume (struct device *dev) +static int __maybe_unused imx_thermal_runtime_resume (struct device *dev) {struct imx_thermal_data *data =dev_get_drvdata (dev); +const struct thermal_soc_data *socdata = data->socdata; +struct regmap *map = data->tempmon;int ret; ret =clk_prepare_enable (data->thermal_clk);if (ret)return ret; -/* Enabled thermal sensor after resume */ - ret =thermal_zone_device_enable (data->tz); + + ret =regmap_write (map, socdata->sensor_ctrl +REG_CLR , + socdata->power_down_mask); +if (ret) +return ret; + + ret =regmap_write (map, socdata->sensor_ctrl +REG_SET , + socdata->measure_temp_mask);if (ret)return ret; +/* +* According to the temp sensor designers, it may require up to ~17us +* to complete a measurement. +*/ +usleep_range (20 ,50 ); +return 0 ; } -static SIMPLE_DEV_PM_OPS(imx_thermal_pm_ops, - imx_thermal_suspend, imx_thermal_resume); +static const struct dev_pm_ops imx_thermal_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume) +SET_RUNTIME_PM_OPS (imx_thermal_runtime_suspend, + imx_thermal_runtime_resume,NULL ) +};static struct platform_driver imx_thermal = { .driver = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 201/1039 igc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 4fa8fcd3440101dbacf4fae91de69877ef751977 ]
Driver already implicitly supports XDP metadata access in AF_XDP zero-copy mode, as xsk_buff_pool's xp_alloc() naturally set xdp_buff data_meta equal data.
This works fine for XDP and AF_XDP, but if a BPF-prog adjust via bpf_xdp_adjust_meta() and choose to call XDP_PASS, then igc function igc_construct_skb_zc() will construct an invalid SKB packet. The function correctly include the xdp->data_meta area in the memcpy, but forgot to pull header to take metasize into account.
--- drivers/net/ethernet/intel/igc/igc_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_main.c +3 -1
@@ -2448,8 +2448,10 @@ static struct sk_buff *igc_construct_skb_zc(struct igc_ring *ring,skb_reserve (skb, xdp->data_meta - xdp->data_hard_start);memcpy (__skb_put (skb, totalsize), xdp->data_meta, totalsize); -if (metasize) +if (metasize) {skb_metadata_set (skb, metasize); +__skb_pull (skb, metasize); + }return skb; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 202/1039 netfilter: bridge: add support for pppoe filtering
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 28b78ecffea8078d81466b2e01bb5a154509f1ba ]
This makes 'bridge-nf-filter-pppoe-tagged' sysctl work for bridged traffic.
Looking at the original commit it doesn't appear this ever worked:
static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb,
[..]
if (skb->protocol == htons(ETH_P_8021Q)) {
skb_pull(skb, VLAN_HLEN);
skb->network_header += VLAN_HLEN;
+ } else if (skb->protocol == htons(ETH_P_PPP_SES)) {
+ skb_pull(skb, PPPOE_SES_HLEN);
+ skb->network_header += PPPOE_SES_HLEN;
}
[..]
NF_HOOK(... POST_ROUTING, ...)... but the adjusted offsets are never restored.
The alternative would be to rip this code out for good, but otoh we'd have to keep this anyway for the vlan handling (which works because vlan tag info is in the skb, not the packet
payload).
--- net/bridge/br_netfilter_hooks.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/bridge/br_netfilter_hooks.c +3 -4
@@ -743,6 +743,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buffif (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) mtu = nf_bridge->frag_max_size; +nf_bridge_update_protocol (skb); +nf_bridge_push_encap_header (skb); +if (skb_is_gso (skb) || skb->len + mtu_reserved <= mtu) {nf_bridge_info_free (skb);return br_dev_queue_push_xmit (net, sk, skb);
@@ -760,8 +763,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buffIPCB (skb)->frag_max_size = nf_bridge->frag_max_size; -nf_bridge_update_protocol (skb); - data =this_cpu_ptr (&brnf_frag_data_storage);if (skb_vlan_tag_present (skb)) {
@@ -789,8 +790,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buffIP6CB (skb)->frag_max_size = nf_bridge->frag_max_size; -nf_bridge_update_protocol (skb); - data =this_cpu_ptr (&brnf_frag_data_storage); data->encap_size =nf_bridge_encap_header_len (skb); data->size =ETH_HLEN + data->encap_size;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 203/1039 powerpc: Avoid discarding flags in system_call_exception()
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit 08b0af5b2affbe7419853e8dd1330e4b3fe27125 ]
Some thread flags can be set remotely, and so even when IRQs are disabled, the flags can change under our feet. Thus, when setting flags we must use an atomic operation rather than a plain read-modify-write sequence, as a plain read-modify-write may discard flags which are concurrently set by a remote thread, e.g.
// task A // task B tmp = A->thread_info.flags; set_tsk_thread_flag(A, NEWFLAG_B); tmp |= NEWFLAG_A; A->thread_info.flags = tmp;
arch/powerpc/kernel/interrupt.c's system_call_exception() sets _TIF_RESTOREALL in the thread info flags with a read-modify-write, which may result in other flags being discarded.
Elsewhere in the file it uses clear_bits() to atomically remove flag bits, so use set_bits() here for consistency with those.
There may be reasons (e.g. instrumentation) that prevent the use of set_thread_flag() and clear_thread_flag() here, which would otherwise be preferable.
--- arch/powerpc/kernel/interrupt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/interrupt.c +1 -1
@@ -148,7 +148,7 @@ notrace long system_call_exception(long r3, long r4, long r5,*/ if (IS_ENABLED (CONFIG_PPC_TRANSACTIONAL_MEM ) &&unlikely (MSR_TM_TRANSACTIONAL (regs->msr))) -current_thread_info ()->flags |= _TIF_RESTOREALL; +set_bits (_TIF_RESTOREALL, ¤t_thread_info ()->flags);/* * If the system call was made with a transaction active, doom it and
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 204/1039 rcu: Avoid alloc_pages() when recording stack
In reply to Greg Kroah-HartmanFrom: Jun Miao <[email protected]>
[ Upstream commit 300c0c5e721834f484b03fa3062602dd8ff48413 ]
The default kasan_record_aux_stack() calls stack_depot_save() with GFP_NOWAIT, which in turn can then call alloc_pages(GFP_NOWAIT, ...). In general, however, it is not even possible to use either GFP_ATOMIC nor GFP_NOWAIT in certain non-preemptive contexts/RT kernel including raw_spin_locks (see gfp.h and ab00db216c9c7). Fix it by instructing stackdepot to not expand stack storage via alloc_pages() in case it runs out by using kasan_record_aux_stack_noalloc().
Jianwei Hu reported:
BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:969
in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 15319, name: python3
INFO: lockdep is turned off.
irq event stamp: 0
hardirqs last enabled at (0): [<0000000000000000>] 0x0
hardirqs last disabled at (0): [<ffffffff856c8b13>] copy_process+0xaf3/0x2590
softirqs last enabled at (0): [<ffffffff856c8b13>] copy_process+0xaf3/0x2590
softirqs last disabled at (0): [<0000000000000000>] 0x0
CPU: 6 PID: 15319 Comm: python3 Tainted: G W O 5.15-rc7-preempt-rt #1
Hardware name: Supermicro SYS-E300-9A-8C/A2SDi-8C-HLN4F, BIOS 1.1b 12/17/2018
Call Trace:
show_stack+0x52/0x58
dump_stack+0xa1/0xd6
___might_sleep.cold+0x11c/0x12d
rt_spin_lock+0x3f/0xc0
rmqueue+0x100/0x1460
rmqueue+0x100/0x1460
mark_usage+0x1a0/0x1a0
ftrace_graph_ret_addr+0x2a/0xb0
rmqueue_pcplist.constprop.0+0x6a0/0x6a0
__kasan_check_read+0x11/0x20
__zone_watermark_ok+0x114/0x270
get_page_from_freelist+0x148/0x630
is_module_text_address+0x32/0xa0
__alloc_pages_nodemask+0x2f6/0x790
__alloc_pages_slowpath.constprop.0+0x12d0/0x12d0
create_prof_cpu_mask+0x30/0x30
alloc_pages_current+0xb1/0x150
stack_depot_save+0x39f/0x490
kasan_save_stack+0x42/0x50
kasan_save_stack+0x23/0x50
kasan_record_aux_stack+0xa9/0xc0
__call_rcu+0xff/0x9c0
call_rcu+0xe/0x10
put_object+0x53/0x70
__delete_object+0x7b/0x90
kmemleak_free+0x46/0x70
slab_free_freelist_hook+0xb4/0x160
kfree+0xe5/0x420
kfree_const+0x17/0x30
kobject_cleanup+0xaa/0x230
kobject_put+0x76/0x90
netdev_queue_update_kobjects+0x17d/0x1f0
... ...
ksys_write+0xd9/0x180
__x64_sys_write+0x42/0x50
do_syscall_64+0x38/0x50
entry_SYSCALL_64_after_hwframe+0x44/0xa9--- kernel/rcu/tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/rcu/tree.c +2 -2
@@ -2982,7 +2982,7 @@ __call_rcu(struct rcu_head *head, rcu_callback_t func) head->func = func; head->next =NULL ;local_irq_save (flags); -kasan_record_aux_stack (head); +kasan_record_aux_stack_noalloc (head); rdp =this_cpu_ptr (&rcu_data);/* Add the callback to our list. */
@@ -3547,7 +3547,7 @@ void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func)return ; } -kasan_record_aux_stack (ptr); +kasan_record_aux_stack_noalloc (ptr); success =add_ptr_to_bulk_krc_lock (&krcp, &flags, ptr, !head);if (!success) {run_page_cache_worker (krcp);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 205/1039 arm64: dts: qcom: msm8916: fix MMC controller aliases
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit b0293c19d42f6d6951c2fab9a47fed50baf2c14d ]
Change sdhcN aliases to mmcN to make them actually work. Currently the board uses non-standard aliases sdhcN, which do not work, resulting in mmc0 and mmc1 hosts randomly changing indices between boots.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +2 -2
@@ -19,8 +19,8 @@ #size-cells = <2>; aliases { - sdhc1 = &sdhc_1; /* SDC1 eMMC slot */ - sdhc2 = &sdhc_2; /* SDC2 SD card slot */ + mmc0 = &sdhc_1; /* SDC1 eMMC slot */ + mmc1 = &sdhc_2; /* SDC2 SD card slot */ }; chosen { };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 206/1039 drm/vmwgfx: Remove the deprecated lower mem limit
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
[ Upstream commit 826c387d015247df396a91eadbaca94f0394853c ]
TTM during the transition to the new page allocator lost the ability to constrain the allocations via the lower_mem_limit. The code has been unused since the change:256dd44bd897 ("drm/ttm: nuke old page allocator")
and there's no reason to keep it.
--- drivers/gpu/drm/vmwgfx/ttm_memory.c | 99 +---------------------------- drivers/gpu/drm/vmwgfx/ttm_memory.h | 6 +- 2 files changed, 2 insertions(+), 103 deletions(-)
drivers/gpu/drm/vmwgfx/ttm_memory.c +1 -98
@@ -34,7 +34,6 @@#include <linux/mm.h> #include <linux/module.h> #include <linux/slab.h> -#include <linux/swap.h> #include <drm/drm_device.h> #include <drm/drm_file.h>
@@ -173,69 +172,7 @@ static struct kobj_type ttm_mem_zone_kobj_type = { .sysfs_ops = &ttm_mem_zone_ops, .default_attrs = ttm_mem_zone_attrs, }; - -static struct attribute ttm_mem_global_lower_mem_limit = { - .name ="lower_mem_limit" , - .mode =S_IRUGO |S_IWUSR -}; - -static ssize_t ttm_mem_global_show (struct kobject *kobj, -struct attribute *attr, -char *buffer) -{ -struct ttm_mem_global *glob = - container_of(kobj, struct ttm_mem_global, kobj); -uint64_t val =0 ; - -spin_lock (&glob->lock); - val = glob->lower_mem_limit; -spin_unlock (&glob->lock); -/* convert from number of pages to KB */ - val <<= (PAGE_SHIFT -10 ); -return snprintf (buffer,PAGE_SIZE ,"%llu\n" , - (unsigned long long ) val); -} - -static ssize_t ttm_mem_global_store (struct kobject *kobj, -struct attribute *attr, -const char *buffer, -size_t size) -{ -int chars; -uint64_t val64; -unsigned long val; -struct ttm_mem_global *glob = - container_of(kobj, struct ttm_mem_global, kobj); - - chars =sscanf (buffer,"%lu" , &val); -if (chars ==0 ) -return size; - - val64 = val; -/* convert from KB to number of pages */ - val64 >>= (PAGE_SHIFT -10 ); - -spin_lock (&glob->lock); - glob->lower_mem_limit = val64; -spin_unlock (&glob->lock); - -return size; -} - -static struct attribute *ttm_mem_global_attrs[] = { - &ttm_mem_global_lower_mem_limit, -NULL -}; - -static const struct sysfs_ops ttm_mem_global_ops = { - .show = &ttm_mem_global_show, - .store = &ttm_mem_global_store, -}; - -static struct kobj_type ttm_mem_glob_kobj_type = { - .sysfs_ops = &ttm_mem_global_ops, - .default_attrs = ttm_mem_global_attrs, -}; +static struct kobj_type ttm_mem_glob_kobj_type = {0 };static bool ttm_zones_above_swap_target (struct ttm_mem_global *glob,bool from_wq,uint64_t extra)
@@ -435,11 +372,6 @@ int ttm_mem_global_init(struct ttm_mem_global *glob, struct device *dev)si_meminfo (&si); -spin_lock (&glob->lock); -/* set it as 0 by default to keep original behavior of OOM */ - glob->lower_mem_limit =0 ; -spin_unlock (&glob->lock); - ret =ttm_mem_init_kernel_zone (glob, &si);if (unlikely (ret !=0 )) goto out_no_zone;
@@ -526,35 +458,6 @@ void ttm_mem_global_free(struct ttm_mem_global *glob, }EXPORT_SYMBOL (ttm_mem_global_free); -/* -* check if the available mem is under lower memory limit -* -* a. if no swap disk at all or free swap space is under swap_mem_limit -* but available system mem is bigger than sys_mem_limit, allow TTM -* allocation; -* -* b. if the available system mem is less than sys_mem_limit but free -* swap disk is bigger than swap_mem_limit, allow TTM allocation. -*/ -bool -ttm_check_under_lowerlimit (struct ttm_mem_global *glob, -uint64_t num_pages, -struct ttm_operation_ctx *ctx) -{ -int64_t available; - -/* We allow over commit during suspend */ -if (ctx->force_alloc) -return false; - - available =get_nr_swap_pages () +si_mem_available (); - available -= num_pages; -if (available < glob->lower_mem_limit) -return true; - -return false; -} -static int ttm_mem_global_reserve (struct ttm_mem_global *glob,struct ttm_mem_zone *single_zone,uint64_t amount,bool reserve)
drivers/gpu/drm/vmwgfx/ttm_memory.h +1 -5
@@ -50,8 +50,6 @@* @work: The workqueue callback for the shrink queue. * @lock: Lock to protect the @shrink - and the memory accounting members, * that is, essentially the whole structure with some exceptions. -* @lower_mem_limit: include lower limit of swap space and lower limit of -* system memory. * @zones: Array of pointers to accounting zones. * @num_zones: Number of populated entries in the @zones array. * @zone_kernel: Pointer to the kernel zone.
@@ -69,7 +67,6 @@ extern struct ttm_mem_global {struct workqueue_struct *swap_queue;struct work_struct work;spinlock_t lock; -uint64_t lower_mem_limit;struct ttm_mem_zone *zones[TTM_MEM_MAX_ZONES ];unsigned int num_zones;struct ttm_mem_zone *zone_kernel;
@@ -91,6 +88,5 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,void ttm_mem_global_free_page (struct ttm_mem_global *glob,struct page *page,uint64_t size);size_t ttm_round_pot (size_t size); -bool ttm_check_under_lowerlimit (struct ttm_mem_global *glob,uint64_t num_pages, -struct ttm_operation_ctx *ctx); +#endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 207/1039 drm/vmwgfx: Fail to initialize on broken configs
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
[ Upstream commit c451af78f301ff5156998d571c37cab329c10051 ]
Some of our hosts have a bug where rescaning a pci bus results in stale fifo memory being mapped on the host. This makes any fifo communication impossible resulting in various kernel crashes.
Instead of unexpectedly crashing, predictably fail to load the driver which will preserve the system.
--- drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c +7 -0
@@ -145,6 +145,13 @@ struct vmw_fifo_state *vmw_fifo_create(struct vmw_private *dev_priv) (unsigned int ) max, (unsigned int ) min, (unsigned int) fifo->capabilities); + +if (unlikely (min >= max)) { +drm_warn (&dev_priv->drm, +"FIFO memory is not usable. Driver failed to initialize." ); +return ERR_PTR (-ENXIO ); + } +return fifo; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 208/1039 cgroup: Trace event cgroup id fields should be u64
In reply to Greg Kroah-HartmanFrom: William Kucharski <[email protected]>
[ Upstream commit e14da77113bb890d7bf9e5d17031bdd476a7ce5e ]
Various trace event fields that store cgroup IDs were declared as ints, but cgroup_id(() returns a u64 and the structures and associated TP_printk() calls were not updated to reflect this.
--- include/trace/events/cgroup.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
include/trace/events/cgroup.h +6 -6
@@ -59,8 +59,8 @@ DECLARE_EVENT_CLASS(cgroup,TP_STRUCT__entry (__field (int ,root ) -__field ( int, id )__field ( int, level ) +__field ( u64, id )__string ( path, path ) ),
@@ -71,7 +71,7 @@ DECLARE_EVENT_CLASS(cgroup,__assign_str (path, path); ), -TP_printk ("root=%d id=%d level=%d path=%s" , +TP_printk ("root=%d id=%llu level=%d path=%s" , __entry->root, __entry->id, __entry->level,__get_str (path)) );
@@ -126,8 +126,8 @@ DECLARE_EVENT_CLASS(cgroup_migrate,TP_STRUCT__entry (__field (int ,dst_root ) -__field ( int, dst_id )__field ( int, dst_level ) +__field ( u64, dst_id )__field ( int, pid )__string ( dst_path, path ) __string( comm, task->comm )
@@ -142,7 +142,7 @@ DECLARE_EVENT_CLASS(cgroup_migrate,__assign_str (comm, task->comm); ), -TP_printk ("dst_root=%d dst_id=%d dst_level=%d dst_path=%s pid=%d comm=%s" , +TP_printk ("dst_root=%d dst_id=%llu dst_level=%d dst_path=%s pid=%d comm=%s" , __entry->dst_root, __entry->dst_id, __entry->dst_level,__get_str (dst_path), __entry->pid,__get_str (comm)) );
@@ -171,8 +171,8 @@ DECLARE_EVENT_CLASS(cgroup_event,TP_STRUCT__entry (__field (int ,root ) -__field ( int, id )__field ( int, level ) +__field ( u64, id )__string ( path, path )__field ( int, val ) ),
@@ -185,7 +185,7 @@ DECLARE_EVENT_CLASS(cgroup_event, __entry->val = val; ), -TP_printk ("root=%d id=%d level=%d path=%s val=%d" , +TP_printk ("root=%d id=%llu level=%d path=%s val=%d" , __entry->root, __entry->id, __entry->level,__get_str (path), __entry->val) );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 209/1039 ACPI: EC: Rework flushing of EC work while suspended to idle
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 4a9af6cac050dce2e895ec3205c4615383ad9112 ]
The flushing of pending work in the EC driver uses drain_workqueue() to flush the event handling work that can requeue itself via advance_transaction(), but this is problematic, because that work may also be requeued from the query workqueue.
Namely, if an EC transaction is carried out during the execution of a query handler, it involves calling advance_transaction() which may queue up the event handling work again. This causes the kernel to complain about attempts to add a work item to the EC event workqueue while it is being drained and worst-case it may cause a valid event to be skipped.
To avoid this problem, introduce two new counters, events_in_progress and queries_in_progress, incremented when a work item is queued on the event workqueue or the query workqueue, respectively, and decremented at the end of the corresponding work function, and make acpi_ec_dispatch_gpe() the workqueues in a loop until the both of these counters are zero (or system wakeup is pending) instead of calling acpi_ec_flush_work().
At the same time, change __acpi_ec_flush_work() to call flush_workqueue() instead of drain_workqueue() to flush the event workqueue.
While at it, use the observation that the work item queued in acpi_ec_query() cannot be pending at that time, because it is used only once, to simplify the code in there.
Additionally, clean up a comment in acpi_ec_query() and adjust white space in acpi_ec_event_processor().
--- drivers/acpi/ec.c | 57 +++++++++++++++++++++++++++++++---------- drivers/acpi/internal.h | 2 ++ 2 files changed, 45 insertions(+), 14 deletions(-)
drivers/acpi/ec.c +43 -14
@@ -166,6 +166,7 @@ struct acpi_ec_query {struct transaction transaction;struct work_struct work;struct acpi_ec_query_handler *handler; +struct acpi_ec *ec; };static int acpi_ec_query (struct acpi_ec *ec,u8 *data);
@@ -452,6 +453,7 @@ static void acpi_ec_submit_query(struct acpi_ec *ec)ec_dbg_evt ("Command(%s) submitted/blocked" ,acpi_ec_cmd_string (ACPI_EC_COMMAND_QUERY )); ec->nr_pending_queries++; + ec->events_in_progress++;queue_work (ec_wq, &ec->work); } }
@@ -518,7 +520,7 @@ static void acpi_ec_enable_event(struct acpi_ec *ec)#ifdef CONFIG_PM_SLEEP static void __acpi_ec_flush_work (void ) { -drain_workqueue (ec_wq);/* flush ec->work */ +flush_workqueue (ec_wq);/* flush ec->work */ flush_workqueue (ec_query_wq);/* flush queries */ }
@@ -1103,7 +1105,7 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) }EXPORT_SYMBOL_GPL (acpi_ec_remove_query_handler); -static struct acpi_ec_query *acpi_ec_create_query (u8 *pval) +static struct acpi_ec_query *acpi_ec_create_query (struct acpi_ec *ec,u8 *pval) {struct acpi_ec_query *q;struct transaction *t;
@@ -1111,11 +1113,13 @@ static struct acpi_ec_query *acpi_ec_create_query(u8 *pval) q =kzalloc (sizeof (struct acpi_ec_query ),GFP_KERNEL );if (!q)return NULL ; +INIT_WORK (&q->work, acpi_ec_event_processor); t = &q->transaction; t->command =ACPI_EC_COMMAND_QUERY ; t->rdata = pval; t->rlen =1 ; + q->ec = ec;return q; }
@@ -1132,13 +1136,21 @@ static void acpi_ec_event_processor(struct work_struct *work) { struct acpi_ec_query *q = container_of(work, struct acpi_ec_query, work);struct acpi_ec_query_handler *handler = q->handler; +struct acpi_ec *ec = q->ec;ec_dbg_evt ("Query(0x%02x) started" , handler->query_bit); +if (handler->func) handler->func (handler->data);else if (handler->handle)acpi_evaluate_object (handler->handle,NULL ,NULL ,NULL ); +ec_dbg_evt ("Query(0x%02x) stopped" , handler->query_bit); + +spin_lock_irq (&ec->lock); + ec->queries_in_progress--; +spin_unlock_irq (&ec->lock); +acpi_ec_delete_query (q); }
@@ -1148,7 +1160,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data)int result;struct acpi_ec_query *q; - q =acpi_ec_create_query (&value); + q =acpi_ec_create_query (ec, &value);if (!q)return -ENOMEM ;
@@ -1170,19 +1182,20 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data) }/* -* It is reported that _Qxx are evaluated in a parallel way on -* Windows: +* It is reported that _Qxx are evaluated in a parallel way on Windows: * https://bugzilla.kernel.org/show_bug.cgi?id=94411 * -* Put this log entry before schedule_work() in order to make -* it appearing before any other log entries occurred during the -* work queue execution. +* Put this log entry before queue_work() to make it appear in the log +* before any other messages emitted during workqueue handling. */ ec_dbg_evt ("Query(0x%02x) scheduled" , value); -if (!queue_work (ec_query_wq, &q->work)) { -ec_dbg_evt ("Query(0x%02x) overlapped" , value); - result = -EBUSY ; - } + +spin_lock_irq (&ec->lock); + + ec->queries_in_progress++; +queue_work (ec_query_wq, &q->work); + +spin_unlock_irq (&ec->lock); err_exit:if (result)
@@ -1240,6 +1253,10 @@ static void acpi_ec_event_handler(struct work_struct *work)ec_dbg_evt ("Event stopped" );acpi_ec_check_event (ec); + +spin_lock_irqsave (&ec->lock, flags); + ec->events_in_progress--; +spin_unlock_irqrestore (&ec->lock, flags); }static void acpi_ec_handle_interrupt (struct acpi_ec *ec)
@@ -2021,6 +2038,7 @@ void acpi_ec_set_gpe_wake_mask(u8 action)bool acpi_ec_dispatch_gpe (void ) { +bool work_in_progress;u32 ret;if (!first_ec)
@@ -2041,8 +2059,19 @@ bool acpi_ec_dispatch_gpe(void)if (ret ==ACPI_INTERRUPT_HANDLED )pm_pr_dbg ("ACPI EC GPE dispatched\n" ); -/* Flush the event and query workqueues. */ -acpi_ec_flush_work (); +/* Drain EC work. */ +do { +acpi_ec_flush_work (); + +pm_pr_dbg ("ACPI EC work flushed\n" ); + +spin_lock_irq (&first_ec->lock); + + work_in_progress = first_ec->events_in_progress + + first_ec->queries_in_progress >0 ; + +spin_unlock_irq (&first_ec->lock); + }while (work_in_progress && !pm_wakeup_pending ());return false; }
drivers/acpi/internal.h +2 -0
@@ -183,6 +183,8 @@ struct acpi_ec {struct work_struct work;unsigned long timestamp;unsigned long nr_pending_queries; +unsigned int events_in_progress; +unsigned int queries_in_progress;bool busy_polling;unsigned int polling_guard; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 210/1039 pinctrl: mediatek: uninitialized variable in mtk_pctrl_show_one_pin()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 67bbbcb49b968a93251de7b23616d5aff5d3a726 ]
The "try_all_type" variable is not set if (hw->soc->pull_type) is false leading to the following Smatch warning:
drivers/pinctrl/mediatek/pinctrl-paris.c:599 mtk_pctrl_show_one_pin()
error: uninitialized symbol 'try_all_type'.
--- drivers/pinctrl/mediatek/pinctrl-paris.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/mediatek/pinctrl-paris.c +1 -1
@@ -581,7 +581,7 @@ ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw, {int pinmux, pullup, pullen, len =0 , r1 =-1 , r0 =-1 , rsel =-1 ;const struct mtk_pin_desc *desc; -u32 try_all_type; +u32 try_all_type =0 ;if (gpio >= hw->soc->npins)return -EINVAL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 211/1039 pinctrl: mediatek: add a check for error in mtk_pinconf_bias_get_rsel()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 9f9d17c228c89e38ed612500126daf626270be9a ]
All the other mtk_hw_get_value() calls have a check for "if (err)" so we can add one here as well. This silences a Smatch warning:
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:819 mtk_pinconf_bias_get_rsel()
error: uninitialized symbol 'pd'.
--- drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +2 -0
@@ -815,6 +815,8 @@ static int mtk_pinconf_bias_get_rsel(struct mtk_pinctrl *hw, goto out; err =mtk_hw_get_value (hw, desc,PINCTRL_PIN_REG_PD , &pd); +if (err) + goto out;if (pu ==0 && pd ==0 ) { *pullup =0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 212/1039 thermal/drivers/imx8mm: Enable ADC when enabling monitor
In reply to Greg Kroah-HartmanFrom: Paul Gerber <[email protected]>
[ Upstream commit 3de89d8842a2b5d3dd22ebf97dd561ae0a330948 ]
The i.MX 8MP has a ADC_PD bit in the TMU_TER register that controls the operating mode of the ADC:
* 0 means normal operating mode
* 1 means power down mode
When enabling/disabling the TMU, the ADC operating mode must be set accordingly.
i.MX 8M Mini & Nano are lacking this bit.
--- drivers/thermal/imx8mm_thermal.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/thermal/imx8mm_thermal.c +3 -0
@@ -21,6 +21,7 @@#define TPS 0x4#define TRITSR 0x20/* TMU immediate temp */ +#define TER_ADC_PD BIT(30)#define TER_EN BIT(31)#define TRITSR_TEMP0_VAL_MASK 0xff#define TRITSR_TEMP1_VAL_MASK 0xff0000
@@ -113,6 +114,8 @@ static void imx8mm_tmu_enable(struct imx8mm_tmu *tmu, bool enable) val =readl_relaxed (tmu->base +TER ); val = enable ? (val |TER_EN ) : (val & ~TER_EN ); +if (tmu->socdata->version ==TMU_VER2 ) + val = enable ? (val & ~TER_ADC_PD ) : (val |TER_ADC_PD );writel_relaxed (val, tmu->base +TER ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 213/1039 drm/amdgpu: Fix a NULL pointer dereference in amdgpu_connector_lcd_native_mode()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit b220110e4cd442156f36e1d9b4914bb9e87b0d00 ]
In amdgpu_connector_lcd_native_mode(), the return value of drm_mode_duplicate() is assigned to mode, and there is a dereference of it in amdgpu_connector_lcd_native_mode(), which will lead to a NULL pointer dereference on failure of drm_mode_duplicate().
Fix this bug add a check of mode.
This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs.
Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug.
Builds with CONFIG_DRM_AMDGPU=m show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +6 -0
@@ -387,6 +387,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) native_mode->vdisplay != 0 && native_mode->clock != 0) { mode =drm_mode_duplicate (dev, native_mode); +if (!mode) +return NULL ; + mode->type =DRM_MODE_TYPE_PREFERRED |DRM_MODE_TYPE_DRIVER ;drm_mode_set_name (mode);
@@ -401,6 +404,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder)* simpler. */ mode =drm_cvt_mode (dev, native_mode->hdisplay, native_mode->vdisplay,60 , true, false, false); +if (!mode) +return NULL ; + mode->type =DRM_MODE_TYPE_PREFERRED |DRM_MODE_TYPE_DRIVER ;DRM_DEBUG_KMS ("Adding cvt approximation of native panel mode %s\n" , mode->name); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 214/1039 drm/radeon/radeon_kms: Fix a NULL pointer dereference in radeon_driver_open_kms()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit ab50cb9df8896b39aae65c537a30de2c79c19735 ]
In radeon_driver_open_kms(), radeon_vm_bo_add() is assigned to vm->ib_bo_va and passes and used in radeon_vm_bo_set_addr(). In radeon_vm_bo_set_addr(), there is a dereference of vm->ib_bo_va, which could lead to a NULL pointer dereference on failure of radeon_vm_bo_add().
Fix this bug by adding a check of vm->ib_bo_va.
This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs.
Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug.
Builds with CONFIG_DRM_RADEON=m show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/gpu/drm/radeon/radeon_kms.c | 36 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/gpu/drm/radeon/radeon_kms.c +20 -16
@@ -648,6 +648,8 @@ void radeon_driver_lastclose_kms(struct drm_device *dev)int radeon_driver_open_kms (struct drm_device *dev,struct drm_file *file_priv) {struct radeon_device *rdev = dev->dev_private; +struct radeon_fpriv *fpriv; +struct radeon_vm *vm;int r; file_priv->driver_priv =NULL ;
@@ -660,8 +662,6 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)/* new gpu have virtual address space support */ if (rdev->family >=CHIP_CAYMAN ) { -struct radeon_fpriv *fpriv; -struct radeon_vm *vm; fpriv =kzalloc (sizeof (*fpriv),GFP_KERNEL );if (unlikely (!fpriv)) {
@@ -672,35 +672,39 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)if (rdev->accel_working) { vm = &fpriv->vm; r =radeon_vm_init (rdev, vm); -if (r) { -kfree (fpriv); - goto out_suspend; - } +if (r) + goto out_fpriv; r =radeon_bo_reserve (rdev->ring_tmp_bo.bo, false); -if (r) { -radeon_vm_fini (rdev, vm); -kfree (fpriv); - goto out_suspend; - } +if (r) + goto out_vm_fini;/* map the ib pool buffer read only into * virtual address space */ vm->ib_bo_va =radeon_vm_bo_add (rdev, vm, rdev->ring_tmp_bo.bo); +if (!vm->ib_bo_va) { + r = -ENOMEM ; + goto out_vm_fini; + } + r =radeon_vm_bo_set_addr (rdev, vm->ib_bo_va,RADEON_VA_IB_OFFSET ,RADEON_VM_PAGE_READABLE |RADEON_VM_PAGE_SNOOPED ); -if (r) { -radeon_vm_fini (rdev, vm); -kfree (fpriv); - goto out_suspend; - } +if (r) + goto out_vm_fini; } file_priv->driver_priv = fpriv; } +if (!r) + goto out_suspend; + +out_vm_fini: +radeon_vm_fini (rdev, vm); +out_fpriv: +kfree (fpriv); out_suspend:pm_runtime_mark_last_busy (dev->dev);pm_runtime_put_autosuspend (dev->dev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 215/1039 libbpf: Clean gen_loaders attach kind.
In reply to Greg Kroah-HartmanFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit 19250f5fc0c283892a61f3abf9d65e6325f63897 ]
The gen_loader has to clear attach_kind otherwise the programs without attach_btf_id will fail load if they follow programs with attach_btf_id.
--- tools/lib/bpf/gen_loader.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/lib/bpf/gen_loader.c +3 -1
@@ -993,9 +993,11 @@ void bpf_gen__prog_load(struct bpf_gen *gen,debug_ret (gen,"prog_load %s insn_cnt %d" , attr.prog_name, attr.insn_cnt);/* successful or not, close btf module FDs used in extern ksyms and attach_btf_obj_fd */ cleanup_relos (gen, insns); -if (gen->attach_kind) +if (gen->attach_kind) {emit_sys_close_blob (gen,attr_field (prog_load_attr, attach_btf_obj_fd)); + gen->attach_kind =0 ; + }emit_check_err (gen);/* remember prog_fd in the stack, if successful */ emit(gen, BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_7,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 216/1039 null_blk: allow zero poll queues
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit 2bfdbe8b7ebd17b5331071071a910fbabc64b436 ]
There isn't any reason to not allow zero poll queues from user viewpoint.
Also sometimes we need to compare io poll between poll mode and irq mode, so not allowing poll queues is bad.
--- drivers/block/null_blk/main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/block/null_blk/main.c +2 -4
@@ -340,9 +340,9 @@ static int nullb_update_nr_hw_queues(struct nullb_device *dev,return 0 ;/* -* Make sure at least one queue exists for each of submit and poll. +* Make sure at least one submit queue exists. */ -if (!submit_queues || !poll_queues) +if (!submit_queues)return -EINVAL ;/*
@@ -1918,8 +1918,6 @@ static int null_validate_conf(struct nullb_device *dev)if (dev->poll_queues > g_poll_queues) dev->poll_queues = g_poll_queues; -else if (dev->poll_queues ==0 ) - dev->poll_queues =1 ; dev->prev_poll_queues = dev->poll_queues; dev->queue_mode = min_t(unsigned int, dev->queue_mode, NULL_Q_MQ);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 217/1039 crypto: caam - save caam memory to support crypto engine retry mechanism.
In reply to Greg Kroah-HartmanFrom: Gaurav Jain <[email protected]>
[ Upstream commit 087e1d715bccf25dc0e83294576e416b0386ba20 ]
When caam queue is full (-ENOSPC), caam frees descriptor memory. crypto-engine checks if retry support is true and h/w queue is full(-ENOSPC), then requeue the crypto request.
During processing the requested descriptor again, caam gives below error. (caam_jr 30902000.jr: 40000006: DECO: desc idx 0: Invalid KEY Command).
This patch adds a check to return when caam input ring is full and retry support is true. so descriptor memory is not freed and requeued request can be processed again.
--- drivers/crypto/caam/caamalg.c | 6 ++++++ drivers/crypto/caam/caamhash.c | 3 +++ drivers/crypto/caam/caampkc.c | 3 +++ 3 files changed, 12 insertions(+)
drivers/crypto/caam/caamalg.c +6 -0
@@ -1533,6 +1533,9 @@ static int aead_do_one_req(struct crypto_engine *engine, void *areq) ret =caam_jr_enqueue (ctx->jrdev, desc, aead_crypt_done, req); +if (ret == -ENOSPC && engine->retry_support) +return ret; +if (ret != -EINPROGRESS ) {aead_unmap (ctx->jrdev, rctx->edesc, req);kfree (rctx->edesc);
@@ -1762,6 +1765,9 @@ static int skcipher_do_one_req(struct crypto_engine *engine, void *areq) ret =caam_jr_enqueue (ctx->jrdev, desc, skcipher_crypt_done, req); +if (ret == -ENOSPC && engine->retry_support) +return ret; +if (ret != -EINPROGRESS ) {skcipher_unmap (ctx->jrdev, rctx->edesc, req);kfree (rctx->edesc);
drivers/crypto/caam/caamhash.c +3 -0
@@ -765,6 +765,9 @@ static int ahash_do_one_req(struct crypto_engine *engine, void *areq) ret =caam_jr_enqueue (jrdev, desc, state->ahash_op_done, req); +if (ret == -ENOSPC && engine->retry_support) +return ret; +if (ret != -EINPROGRESS ) {ahash_unmap (jrdev, state->edesc, req,0 );kfree (state->edesc);
drivers/crypto/caam/caampkc.c +3 -0
@@ -380,6 +380,9 @@ static int akcipher_do_one_req(struct crypto_engine *engine, void *areq) ret =caam_jr_enqueue (jrdev, desc, req_ctx->akcipher_op_done, req); +if (ret == -ENOSPC && engine->retry_support) +return ret; +if (ret != -EINPROGRESS ) {rsa_pub_unmap (jrdev, req_ctx->edesc, req);rsa_io_unmap (jrdev, req_ctx->edesc, req);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 218/1039 arm64: dts: ti: k3-am642: Fix the L2 cache sets
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
[ Upstream commit a27a93bf70045be54b594fa8482959ffb84166d7 ]
A53's L2 cache[1] on AM642[2] is 256KB. A53's L2 is fixed line length of 64 bytes and 16-way set-associative cache structure.
256KB of L2 / 64 (line length) = 4096 ways
4096 ways / 16 = 256 sets
Fix the l2 cache-sets.
[1] https://developer.arm.com/documentation/ddi0500/j/Level-2-Memory-System/About-the-L2-memory-system?lang=en
[2] https://www.ti.com/lit/pdf/spruim2
--- arch/arm64/boot/dts/ti/k3-am642.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am642.dtsi +1 -1
@@ -60,6 +60,6 @@ cache-level = <2>; cache-size = <0x40000>; cache-line-size = <64>; - cache-sets = <512>; + cache-sets = <256>; }; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 219/1039 arm64: dts: ti: k3-j7200: Fix the L2 cache sets
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
[ Upstream commit d0c826106f3fc11ff97285102b576b65576654ae ]
A72's L2 cache[1] on J7200[2] is 1MB. A72's L2 is fixed line length of 64 bytes and 16-way set-associative cache structure.
1MB of L2 / 64 (line length) = 16384 ways
16384 ways / 16 = 1024 sets
Fix the l2 cache-sets.
[1] https://developer.arm.com/documentation/100095/0003/Level-2-Memory-System/About-the-L2-memory-system
[2] https://www.ti.com/lit/pdf/spruiu1
--- arch/arm64/boot/dts/ti/k3-j7200.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j7200.dtsi +1 -1
@@ -86,7 +86,7 @@ cache-level = <2>; cache-size = <0x100000>; cache-line-size = <64>; - cache-sets = <2048>; + cache-sets = <1024>; next-level-cache = <&msmc_l3>; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 220/1039 arm64: dts: ti: k3-j721e: Fix the L2 cache sets
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
[ Upstream commit e9ba3a5bc6fdc2c796c69fdaf5ed6c9957cf9f9d ]
A72's L2 cache[1] on J721e[2] is 1MB. A72's L2 is fixed line length of 64 bytes and 16-way set-associative cache structure.
1MB of L2 / 64 (line length) = 16384 ways
16384 ways / 16 = 1024 sets
Fix the l2 cache-sets.
[1] https://developer.arm.com/documentation/100095/0003/Level-2-Memory-System/About-the-L2-memory-system
[2] http://www.ti.com/lit/pdf/spruil1
--- arch/arm64/boot/dts/ti/k3-j721e.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j721e.dtsi +1 -1
@@ -88,7 +88,7 @@ cache-level = <2>; cache-size = <0x100000>; cache-line-size = <64>; - cache-sets = <2048>; + cache-sets = <1024>; next-level-cache = <&msmc_l3>; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 221/1039 arm64: dts: ti: k3-j7200: Correct the d-cache-sets info
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
[ Upstream commit a172c86931709d6663318609d71a811333bdf4b0 ]
A72 Cluster (chapter 1.3.1 [1]) has 48KB Icache, 32KB Dcache and 1MB L2 Cache
- ICache is 3-way set-associative
- Dcache is 2-way set-associative
- Line size are 64bytes
32KB (Dcache)/64 (fixed line length of 64 bytes) = 512 ways 512 ways / 2 (Dcache is 2-way per set) = 256 sets.
So, correct the d-cache-sets info.
[1] https://www.ti.com/lit/pdf/spruiu1
--- arch/arm64/boot/dts/ti/k3-j7200.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/ti/k3-j7200.dtsi +2 -2
@@ -62,7 +62,7 @@ i-cache-sets = <256>; d-cache-size = <0x8000>; d-cache-line-size = <64>; - d-cache-sets = <128>; + d-cache-sets = <256>; next-level-cache = <&L2_0>; };
@@ -76,7 +76,7 @@ i-cache-sets = <256>; d-cache-size = <0x8000>; d-cache-line-size = <64>; - d-cache-sets = <128>; + d-cache-sets = <256>; next-level-cache = <&L2_0>; }; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 222/1039 tty: serial: uartlite: allow 64 bit address
In reply to Greg Kroah-HartmanFrom: Lizhi Hou <[email protected]>
[ Upstream commit 3672fb65155530b5eea6225685c75329b6debec3 ]
The base address of uartlite registers could be 64 bit address which is from device resource. When ulite_probe() calls ulite_assign(), this 64 bit address is casted to 32-bit. The fix is to replace "u32" type with "phys_addr_t" type for the base address in ulite_assign() argument list.
--- drivers/tty/serial/uartlite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/uartlite.c +1 -1
@@ -626,7 +626,7 @@ static struct uart_driver ulite_uart_driver = {* * Returns: 0 on success, <0 otherwise */ -static int ulite_assign (struct device *dev,int id,u32 base,int irq, +static int ulite_assign (struct device *dev,int id,phys_addr_t base,int irq,struct uartlite_data *pdata) {struct uart_port *port;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 223/1039 serial: amba-pl011: do not request memory region twice
In reply to Greg Kroah-HartmanFrom: Lino Sanfilippo <[email protected]>
[ Upstream commit d1180405c7b5c7a1c6bde79d5fc24fe931430737 ]
With commit 3873e2d7f63a ("drivers: PL011: refactor pl011_probe()") the function devm_ioremap() called from pl011_setup_port() was replaced with devm_ioremap_resource(). Since this function not only remaps but also requests the ports io memory region it now collides with the .config_port() callback which requests the same region at uart port registration.
Since devm_ioremap_resource() already claims the memory successfully, the request in .config_port() fails.
Later at uart port deregistration the attempt to release the unclaimed memory also fails. The failure results in a “Trying to free nonexistent resource" warning.
Fix these issues by removing the callbacks that implement the redundant memory allocation/release. Also make sure that changing the drivers io memory base address via TIOCSSERIAL is not allowed any more.
--- drivers/tty/serial/amba-pl011.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-)
drivers/tty/serial/amba-pl011.c +3 -24
@@ -2183,32 +2183,13 @@ static const char *pl011_type(struct uart_port *port)return uap->port.type ==PORT_AMBA ? uap->type :NULL ; } -/* -* Release the memory region(s) being used by 'port' -*/ -static void pl011_release_port (struct uart_port *port) -{ -release_mem_region (port->mapbase,SZ_4K ); -} - -/* -* Request the memory region(s) being used by 'port' -*/ -static int pl011_request_port (struct uart_port *port) -{ -return request_mem_region (port->mapbase,SZ_4K ,"uart-pl011" ) - !=NULL ?0 : -EBUSY ; -} -/* * Configure/autoconfigure the port. */ static void pl011_config_port (struct uart_port *port,int flags) { -if (flags &UART_CONFIG_TYPE ) { +if (flags &UART_CONFIG_TYPE ) port->type =PORT_AMBA ; -pl011_request_port (port); - } }/*
@@ -2223,6 +2204,8 @@ static int pl011_verify_port(struct uart_port *port, struct serial_struct *ser) ret = -EINVAL ;if (ser->baud_base <9600 ) ret = -EINVAL ; +if (port->mapbase != (unsigned long ) ser->iomem_base) + ret = -EINVAL ;return ret; }
@@ -2275,8 +2258,6 @@ static const struct uart_ops amba_pl011_pops = { .flush_buffer = pl011_dma_flush_buffer, .set_termios = pl011_set_termios, .type = pl011_type, - .release_port = pl011_release_port, - .request_port = pl011_request_port, .config_port = pl011_config_port, .verify_port = pl011_verify_port,#ifdef CONFIG_CONSOLE_POLL
@@ -2306,8 +2287,6 @@ static const struct uart_ops sbsa_uart_pops = { .shutdown = sbsa_uart_shutdown, .set_termios = sbsa_uart_set_termios, .type = pl011_type, - .release_port = pl011_release_port, - .request_port = pl011_request_port, .config_port = pl011_config_port, .verify_port = pl011_verify_port,#ifdef CONFIG_CONSOLE_POLL
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 224/1039 mtd: core: provide unique name for nvmem device
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit c048b60d39e109c201d31ed5ad3a4f939064d6c4 ]
If there is more than one mtd device which supports OTP, there will be a kernel warning about duplicated sysfs entries and the probing will fail. This is because the nvmem device name is not unique. Make it unique by prepending the name of the mtd. E.g. before the name was "user-otp", now it will be "mtd0-user-otp".
For reference the kernel splash is:
[ 4.665531] sysfs: cannot create duplicate filename '/bus/nvmem/devices/user-otp' [ 4.673056] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0-next-20211101+ #1296 [ 4.680565] Hardware name: Kontron SMARC-sAL28 (Single PHY) on SMARC Eval 2.0 carrier (DT) [ 4.688856] Call trace: [ 4.691303] dump_backtrace+0x0/0x1bc [ 4.694984] show_stack+0x24/0x30 [ 4.698306] dump_stack_lvl+0x68/0x84 [ 4.701980] dump_stack+0x18/0x34 [ 4.705302] sysfs_warn_dup+0x70/0x90 [ 4.708973] sysfs_do_create_link_sd+0x144/0x150 [ 4.713603] sysfs_create_link+0x2c/0x50 [ 4.717535] bus_add_device+0x74/0x120 [ 4.721293] device_add+0x330/0x890 [ 4.724791] device_register+0x2c/0x40 [ 4.728550] nvmem_register+0x240/0x9f0 [ 4.732398] mtd_otp_nvmem_register+0xb0/0x10c [ 4.736854] mtd_device_parse_register+0x28c/0x2b4 [ 4.741659] spi_nor_probe+0x20c/0x2e0 [ 4.745418] spi_mem_probe+0x78/0xbc [ 4.749001] spi_probe+0x90/0xf0 [ 4.752237] really_probe.part.0+0xa4/0x320 .. [ 4.873936] mtd mtd1: Failed to register OTP NVMEM device [ 4.894468] spi-nor: probe of spi0.0 failed with error -17
--- drivers/mtd/mtdcore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/mtdcore.c +2 -2
@@ -825,8 +825,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd,/* OTP nvmem will be registered on the physical device */ config.dev = mtd->dev.parent; -/* just reuse the compatible as name */ - config.name = compatible; + config.name =kasprintf (GFP_KERNEL ,"%s-%s" ,dev_name (&mtd->dev), compatible); config.id =NVMEM_DEVID_NONE ; config.owner =THIS_MODULE ; config.type =NVMEM_TYPE_OTP ;
@@ -842,6 +841,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd, nvmem =NULL ;of_node_put (np); +kfree (config.name);return nvmem; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 225/1039 floppy: Fix hang in watchdog when disk is ejected
In reply to Greg Kroah-HartmanFrom: Tasos Sahanidis <[email protected]>
[ Upstream commit fb48febce7e30baed94dd791e19521abd2c3fd83 ]
When the watchdog detects a disk change, it calls cancel_activity(), which in turn tries to cancel the fd_timer delayed work.
In the above scenario, fd_timer_fn is set to fd_watchdog(), meaning it is trying to cancel its own work.
This results in a hang as cancel_delayed_work_sync() is waiting for the watchdog (itself) to return, which never happens.
This can be reproduced relatively consistently by attempting to read a broken floppy, and ejecting it while IO is being attempted and retried.
To resolve this, this patch calls cancel_delayed_work() instead, which cancels the work without waiting for the watchdog to return and finish.
Before this regression was introduced, the code in this section used del_timer(), and not del_timer_sync() to delete the watchdog timer.
--- drivers/block/floppy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/floppy.c +1 -1
@@ -1015,7 +1015,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn);static void cancel_activity (void ) { do_floppy =NULL ; -cancel_delayed_work_sync (&fd_timer); +cancel_delayed_work (&fd_timer);cancel_work_sync (&floppy_work); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 226/1039 staging: rtl8192e: return error code from rtllib_softmac_init()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 68bf78ff59a0891eb1239948e94ce10f73a9dd30 ]
If it fails to allocate 'dot11d_info', rtllib_softmac_init() should return error code. And remove unneccessary error message.
--- drivers/staging/rtl8192e/rtllib.h | 2 +- drivers/staging/rtl8192e/rtllib_softmac.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtllib.h +1 -1
@@ -1980,7 +1980,7 @@ void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn);void rtllib_softmac_xmit (struct rtllib_txb *txb,struct rtllib_device *ieee);void rtllib_start_ibss (struct rtllib_device *ieee); -void rtllib_softmac_init (struct rtllib_device *ieee); +int rtllib_softmac_init (struct rtllib_device *ieee);void rtllib_softmac_free (struct rtllib_device *ieee);void rtllib_disassociate (struct rtllib_device *ieee);void rtllib_stop_scan (struct rtllib_device *ieee);
drivers/staging/rtl8192e/rtllib_softmac.c +4 -2
@@ -2952,7 +2952,7 @@ void rtllib_start_protocol(struct rtllib_device *ieee) } } -void rtllib_softmac_init (struct rtllib_device *ieee) +int rtllib_softmac_init (struct rtllib_device *ieee) {int i;
@@ -2963,7 +2963,8 @@ void rtllib_softmac_init(struct rtllib_device *ieee) ieee->seq_ctrl[i] =0 ; ieee->dot11d_info =kzalloc (sizeof (struct rt_dot11d_info ),GFP_ATOMIC );if (!ieee->dot11d_info) -netdev_err (ieee->dev,"Can't alloc memory for DOT11D\n" ); +return -ENOMEM ; + ieee->LinkDetectInfo.SlotIndex =0 ; ieee->LinkDetectInfo.SlotNum =2 ; ieee->LinkDetectInfo.NumRecvBcnInPeriod =0 ;
@@ -3029,6 +3030,7 @@ void rtllib_softmac_init(struct rtllib_device *ieee)tasklet_setup (&ieee->ps_task, rtllib_sta_ps); +return 0 ; }void rtllib_softmac_free (struct rtllib_device *ieee)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 227/1039 staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit e730cd57ac2dfe94bca0f14a3be8e1b21de41a9c ]
Some variables are leaked in the error handling in alloc_rtllib(), free the variables in the error path.
--- drivers/staging/rtl8192e/rtllib_module.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/staging/rtl8192e/rtllib_module.c +12 -4
@@ -88,7 +88,7 @@ struct net_device *alloc_rtllib(int sizeof_priv) err =rtllib_networks_allocate (ieee);if (err) {pr_err ("Unable to allocate beacon storage: %d\n" , err); - goto failed; + goto free_netdev; }rtllib_networks_initialize (ieee);
@@ -121,11 +121,13 @@ struct net_device *alloc_rtllib(int sizeof_priv) ieee->hwsec_active =0 ;memset (ieee->swcamtable,0 ,sizeof (struct sw_cam_table ) *32 ); -rtllib_softmac_init (ieee); + err =rtllib_softmac_init (ieee); +if (err) + goto free_crypt_info; ieee->pHTInfo =kzalloc (sizeof (struct rt_hi_throughput ),GFP_KERNEL );if (!ieee->pHTInfo) -return NULL ; + goto free_softmac;HTUpdateDefaultSetting (ieee);HTInitializeHTInfo (ieee);
@@ -141,8 +143,14 @@ struct net_device *alloc_rtllib(int sizeof_priv)return dev; - failed: +free_softmac: +rtllib_softmac_free (ieee); +free_crypt_info: +lib80211_crypt_info_free (&ieee->crypt_info); +rtllib_networks_free (ieee); +free_netdev:free_netdev (dev); +return NULL ; }EXPORT_SYMBOL (alloc_rtllib);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 228/1039 Bluetooth: btmtksdio: fix resume failure
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 561ae1d46a8ddcbc13162d5771f5ed6c8249e730 ]
btmtksdio have to rely on MMC_PM_KEEP_POWER in pm_flags to avoid that SDIO power is being shut off during the device is in suspend. That fixes the SDIO command fails to access the bus after the device is resumed.
--- drivers/bluetooth/btmtksdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btmtksdio.c +2 -0
@@ -1042,6 +1042,8 @@ static int btmtksdio_runtime_suspend(struct device *dev)if (!bdev)return 0 ; +sdio_set_host_pm_flags (func,MMC_PM_KEEP_POWER ); +sdio_claim_host (bdev->func);sdio_writel (bdev->func,C_FW_OWN_REQ_SET ,MTK_REG_CHLPCR , &err);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 229/1039 bpf: Fix the test_task_vma selftest to support output shorter than 1 kB
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit da54ab14953c38d98cb3e34c564c06c3739394b2 ]
The test for bpf_iter_task_vma assumes that the output will be longer than 1 kB, as the comment above the loop says. Due to this assumption, the loop becomes infinite if the output turns to be shorter than 1 kB. The return value of read_fd_into_buffer is 0 when the end of file was reached, and len isn't being increased any more.
This commit adds a break on EOF to handle short output correctly. For the reference, this is the contents that I get when running test_progs under vmtest.sh, and it's shorter than 1 kB:
00400000-00401000 r--p 00000000 fe:00 25867 /root/bpf/test_progs 00401000-00674000 r-xp 00001000 fe:00 25867 /root/bpf/test_progs 00674000-0095f000 r--p 00274000 fe:00 25867 /root/bpf/test_progs 0095f000-00983000 r--p 0055e000 fe:00 25867 /root/bpf/test_progs 00983000-00a8a000 rw-p 00582000 fe:00 25867 /root/bpf/test_progs
00a8a000-0484e000 rw-p 00000000 00:00 0 7f6c64000000-7f6c64021000 rw-p 00000000 00:00 0 7f6c64021000-7f6c68000000 ---p 00000000 00:00 0 7f6c6ac8f000-7f6c6ac90000 r--s 00000000 00:0d 8032 anon_inode:bpf-map 7f6c6ac90000-7f6c6ac91000 ---p 00000000 00:00 0 7f6c6ac91000-7f6c6b491000 rw-p 00000000 00:00 0 7f6c6b491000-7f6c6b492000 r--s 00000000 00:0d 8032 anon_inode:bpf-map 7f6c6b492000-7f6c6b493000 rw-s 00000000 00:0d 8032 anon_inode:bpf-map 7ffc1e23d000-7ffc1e25e000 rw-p 00000000 00:00 0 7ffc1e3b8000-7ffc1e3bc000 r--p 00000000 00:00 0 7ffc1e3bc000-7ffc1e3bd000 r-xp 00000000 00:00 0 7fffffffe000-7ffffffff000 --xp 00000000 00:00 0
--- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/bpf_iter.c +3 -2
@@ -1206,13 +1206,14 @@ static void test_task_vma(void) goto out;/* Read CMP_BUFFER_SIZE (1kB) from bpf_iter. Read in small chunks -* to trigger seq_file corner cases. The expected output is much -* longer than 1kB, so the while loop will terminate. +* to trigger seq_file corner cases. */ len =0 ;while (len <CMP_BUFFER_SIZE ) { err =read_fd_into_buffer (iter_fd, task_vma_output + len,min (read_size,CMP_BUFFER_SIZE - len)); +if (!err) +break ;if (CHECK (err <0 ,"read_iter_fd" ,"read_iter_fd failed\n" )) goto out; len += err;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 230/1039 sched/fair: Fix detection of per-CPU kthreads waking a task
In reply to Greg Kroah-HartmanFrom: Vincent Donnefort <[email protected]>
[ Upstream commit 8b4e74ccb582797f6f0b0a50372ebd9fd2372a27 ]
select_idle_sibling() has a special case for tasks woken up by a per-CPU kthread, where the selected CPU is the previous one. However, the current condition for this exit path is incomplete. A task can wake up from an interrupt context (e.g. hrtimer), while a per-CPU kthread is running. A such scenario would spuriously trigger the special case described above. Also, a recent change made the idle task like a regular per-CPU kthread, hence making that situation more likely to happen (is_per_cpu_kthread(swapper) being true now).
Checking for task context makes sure select_idle_sibling() will not interpret a wake up from any other context as a wake up by a per-CPU kthread.
--- kernel/sched/fair.c | 1 + 1 file changed, 1 insertion(+)
kernel/sched/fair.c +1 -0
@@ -6398,6 +6398,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)* pattern is IO completions. */ if (is_per_cpu_kthread (current) && +in_task () && prev ==smp_processor_id () &&this_rq ()->nr_running <=1 ) {return prev;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 231/1039 sched/fair: Fix per-CPU kthread and wakee stacking for asym CPU capacity
In reply to Greg Kroah-HartmanFrom: Vincent Donnefort <[email protected]>
[ Upstream commit 014ba44e8184e1acf93e0cbb7089ee847802f8f0 ]
select_idle_sibling() has a special case for tasks woken up by a per-CPU kthread where the selected CPU is the previous one. For asymmetric CPU capacity systems, the assumption was that the wakee couldn't have a bigger utilization during task placement than it used to have during the last activation. That was not considering uclamp.min which can completely change between two task activations and as a consequence mandates the fitness criterion asym_fits_capacity(), even for the exit path described above.
--- kernel/sched/fair.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/fair.c +2 -1
@@ -6400,7 +6400,8 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)if (is_per_cpu_kthread (current) &&in_task () && prev ==smp_processor_id () && -this_rq ()->nr_running <=1 ) { +this_rq ()->nr_running <=1 && +asym_fits_capacity (task_util, prev)) {return prev; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 232/1039 bpf: Adjust BTF log size limit.
In reply to Greg Kroah-HartmanFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit c5a2d43e998a821701029f23e25b62f9188e93ff ]
Make BTF log size limit to be the same as the verifier log size limit. Otherwise tools that progressively increase log size and use the same log for BTF loading and program loading will be hitting hard to debug EINVAL.
--- kernel/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/btf.c +1 -1
@@ -4460,7 +4460,7 @@ static struct btf *btf_parse(bpfptr_t btf_data, u32 btf_data_size, log->len_total = log_size;/* log attributes have to be sane */ -if (log->len_total <128 || log->len_total >UINT_MAX >>8 || +if (log->len_total <128 || log->len_total >UINT_MAX >>2 || !log->level || !log->ubuf) { err = -EINVAL ; goto errout;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 233/1039 bpf: Disallow BPF_LOG_KERNEL log level for bpf(BPF_BTF_LOAD)
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit 866de407444398bc8140ea70de1dba5f91cc34ac ]
BPF_LOG_KERNEL is only used internally, so disallow bpf_btf_load() to set log level as BPF_LOG_KERNEL. The same checking has already been done in bpf_check(), so factor out a helper to check the validity of log attributes and use it in both places.
--- include/linux/bpf_verifier.h | 7 +++++++ kernel/bpf/btf.c | 3 +-- kernel/bpf/verifier.c | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-)
include/linux/bpf_verifier.h +7 -0
@@ -396,6 +396,13 @@ static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log) log->level == BPF_LOG_KERNEL); } +static inline bool +bpf_verifier_log_attr_valid (const struct bpf_verifier_log *log) +{ +return log->len_total >=128 && log->len_total <=UINT_MAX >>2 && + log->level && log->ubuf && !(log->level & ~BPF_LOG_MASK ); +} +#define BPF_MAX_SUBPROGS 256struct bpf_subprog_info {
kernel/bpf/btf.c +1 -2
@@ -4460,8 +4460,7 @@ static struct btf *btf_parse(bpfptr_t btf_data, u32 btf_data_size, log->len_total = log_size;/* log attributes have to be sane */ -if (log->len_total <128 || log->len_total >UINT_MAX >>2 || - !log->level || !log->ubuf) { +if (!bpf_verifier_log_attr_valid (log)) { err = -EINVAL ; goto errout; }
kernel/bpf/verifier.c +3 -3
@@ -13960,11 +13960,11 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr) log->ubuf = (char __user *) (unsigned long ) attr->log_buf; log->len_total = attr->log_size; - ret = -EINVAL ;/* log attributes have to be sane */ -if (log->len_total <128 || log->len_total >UINT_MAX >>2 || - !log->level || !log->ubuf || log->level & ~BPF_LOG_MASK ) +if (!bpf_verifier_log_attr_valid (log)) { + ret = -EINVAL ; goto err_unlock; + } }if (IS_ERR (btf_vmlinux)) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 234/1039 bpf: Remove config check to enable bpf support for branch records
In reply to Greg Kroah-HartmanFrom: Kajol Jain <[email protected]>
[ Upstream commit db52f57211b4e45f0ebb274e2c877b211dc18591 ]
Branch data available to BPF programs can be very useful to get stack traces out of userspace application.
Commit fff7b64355ea ("bpf: Add bpf_read_branch_records() helper") added BPF support to capture branch records in x86. Enable this feature also for other architectures as well by removing checks specific to x86.
If an architecture doesn't support branch records, bpf_read_branch_records() still has appropriate checks and it will return an -EINVAL in that scenario. Based on UAPI helper doc in include/uapi/linux/bpf.h, unsupported architectures should return -ENOENT in such case. Hence, update the appropriate check to return -ENOENT instead.
Selftest 'perf_branches' result on power9 machine which has the branch stacks support:
- Before this patch:
[command]# ./test_progs -t perf_branches
#88/1 perf_branches/perf_branches_hw:FAIL
#88/2 perf_branches/perf_branches_no_hw:OK
#88 perf_branches:FAIL
Summary: 0/1 PASSED, 0 SKIPPED, 1 FAILED
- After this patch:
[command]# ./test_progs -t perf_branches
#88/1 perf_branches/perf_branches_hw:OK
#88/2 perf_branches/perf_branches_no_hw:OK
#88 perf_branches:OK
Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED
Selftest 'perf_branches' result on power9 machine which doesn't have branch stack report:
- After this patch:
[command]# ./test_progs -t perf_branches
#88/1 perf_branches/perf_branches_hw:SKIP
#88/2 perf_branches/perf_branches_no_hw:OK
#88 perf_branches:OK
Summary: 1/1 PASSED, 1 SKIPPED, 0 FAILED
--- kernel/trace/bpf_trace.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
kernel/trace/bpf_trace.c +1 -5
@@ -1400,9 +1400,6 @@ static const struct bpf_func_proto bpf_perf_prog_read_value_proto = { BPF_CALL_4(bpf_read_branch_records, struct bpf_perf_event_data_kern *, ctx, void *, buf, u32, size, u64, flags) { -#ifndef CONFIG_X86 -return -ENOENT ; -#else static const u32 br_entry_size =sizeof (struct perf_branch_entry );struct perf_branch_stack *br_stack = ctx->data->br_stack;u32 to_copy;
@@ -1411,7 +1408,7 @@ BPF_CALL_4(bpf_read_branch_records, struct bpf_perf_event_data_kern *, ctx,return -EINVAL ;if (unlikely (!br_stack)) -return -EINVAL ; +return -ENOENT ;if (flags &BPF_F_GET_BRANCH_RECORDS_SIZE )return br_stack->nr * br_entry_size;
@@ -1423,7 +1420,6 @@ BPF_CALL_4(bpf_read_branch_records, struct bpf_perf_event_data_kern *, ctx,memcpy (buf, br_stack->entries, to_copy);return to_copy; -#endif }static const struct bpf_func_proto bpf_read_branch_records_proto = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 235/1039 drm: rcar-du: Add DSI support to rcar_du_output_name
In reply to Greg Kroah-HartmanFrom: Kieran Bingham <[email protected]>
[ Upstream commit e0e4c64a64780a8672480618142776de8bf98d07 ]
The DSI output names were not added when the DSI pipeline support was introduced.
Add the correct labels for these outputs, and fix the sort order to match 'enum rcar_du_output' while we are here.
--- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_drv.c +4 -2
@@ -544,10 +544,12 @@ const char *rcar_du_output_name(enum rcar_du_output output)static const char *const names[] = { [RCAR_DU_OUTPUT_DPAD0 ] ="DPAD0" , [RCAR_DU_OUTPUT_DPAD1 ] ="DPAD1" , - [RCAR_DU_OUTPUT_LVDS0 ] ="LVDS0" , - [RCAR_DU_OUTPUT_LVDS1 ] ="LVDS1" , + [RCAR_DU_OUTPUT_DSI0 ] ="DSI0" , + [RCAR_DU_OUTPUT_DSI1 ] ="DSI1" , [RCAR_DU_OUTPUT_HDMI0 ] ="HDMI0" , [RCAR_DU_OUTPUT_HDMI1 ] ="HDMI1" , + [RCAR_DU_OUTPUT_LVDS0 ] ="LVDS0" , + [RCAR_DU_OUTPUT_LVDS1 ] ="LVDS1" , [RCAR_DU_OUTPUT_TCON ] ="TCON" , };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 236/1039 drm: rcar-du: crtc: Support external DSI dot clock
In reply to Greg Kroah-HartmanFrom: Kieran Bingham <[email protected]>
[ Upstream commit 57b290cb905bec520372ac635d9e9f0548d9d67e ]
On platforms with an external clock, both the group and crtc must be handled accordingly to correctly pass through the external clock and configure the DU to use the external rate.
The CRTC support was missed while adding the DSI support on the r8a779a0 which led to the output clocks being incorrectly determined.
Ensure that when a CRTC is routed through the DSI encoder, the external clock is used without any further divider being applied.
--- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +6 -5
@@ -261,12 +261,13 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)rcar_du_group_write (rcrtc->group,DPLLCR , dpllcr); escr =ESCR_DCLKSEL_DCLKIN | div; - }else if (rcdu->info->lvds_clk_mask &BIT (rcrtc->index)) { + }else if (rcdu->info->lvds_clk_mask &BIT (rcrtc->index) || + rcdu->info->dsi_clk_mask &BIT (rcrtc->index)) {/* -* Use the LVDS PLL output as the dot clock when outputting to -* the LVDS encoder on an SoC that supports this clock routing -* option. We use the clock directly in that case, without any -* additional divider. +* Use the external LVDS or DSI PLL output as the dot clock when +* outputting to the LVDS or DSI encoder on an SoC that supports +* this clock routing option. We use the clock directly in that +* case, without any additional divider. */ escr =ESCR_DCLKSEL_DCLKIN ; }else {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 237/1039 arm64: clear_page() shouldnt use DC ZVA when DCZID_EL0.DZP == 1
In reply to Greg Kroah-HartmanFrom: Reiji Watanabe <[email protected]>
[ Upstream commit f0616abd4e67143b45b04b565839148458857347 ]
Currently, clear_page() uses DC ZVA instruction unconditionally. But it should make sure that DCZID_EL0.DZP, which indicates whether or not use of DC ZVA instruction is prohibited, is zero when using the instruction. Use STNP instead when DCZID_EL0.DZP == 1.
--- arch/arm64/lib/clear_page.S | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/lib/clear_page.S +10 -0
@@ -16,6 +16,7 @@ */ SYM_FUNC_START_PI(clear_page) mrs x1, dczid_el0 + tbnz x1, #4, 2f /* Branch if DC ZVA is prohibited */ and w1, w1, #0xf mov x2, #4 lsl x1, x2, x1
@@ -25,5 +26,14 @@ SYM_FUNC_START_PI(clear_page) tst x0, #(PAGE_SIZE - 1) b.ne 1b ret + +2: stnp xzr, xzr, [x0] + stnp xzr, xzr, [x0, #16] + stnp xzr, xzr, [x0, #32] + stnp xzr, xzr, [x0, #48] + add x0, x0, #64 + tst x0, #(PAGE_SIZE - 1) + b.ne 2b + ret SYM_FUNC_END_PI(clear_page) EXPORT_SYMBOL(clear_page)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 238/1039 arm64: mte: DC {GVA,GZVA} shouldnt be used when DCZID_EL0.DZP == 1
In reply to Greg Kroah-HartmanFrom: Reiji Watanabe <[email protected]>
[ Upstream commit 685e2564daa1493053fcd7f1dbed38b35ee2f3cb ]
Currently, mte_set_mem_tag_range() and mte_zero_clear_page_tags() use DC {GVA,GZVA} unconditionally. But, they should make sure that DCZID_EL0.DZP, which indicates whether or not use of those instructions is prohibited, is zero when using those instructions.
Use ST{G,ZG,Z2G} instead when DCZID_EL0.DZP == 1.
--- arch/arm64/include/asm/mte-kasan.h | 8 +++++--- arch/arm64/lib/mte.S | 8 +++++++- 2 files changed, 12 insertions(+), 4 deletions(-)
arch/arm64/include/asm/mte-kasan.h +5 -3
@@ -84,10 +84,12 @@ static inline void __dc_gzva(u64 p)static inline void mte_set_mem_tag_range (void *addr,size_t size,u8 tag,bool init) { -u64 curr, mask, dczid_bs, end1, end2, end3; +u64 curr, mask, dczid, dczid_bs, dczid_dzp, end1, end2, end3;/* Read DC G(Z)VA block size from the system register. */ - dczid_bs =4ul << (read_cpuid (DCZID_EL0 ) &0xf ); + dczid =read_cpuid (DCZID_EL0 ); + dczid_bs =4ul << (dczid &0xf ); + dczid_dzp = (dczid >>4 ) &1 ; curr = (u64 )__tag_set (addr, tag); mask = dczid_bs -1 ;
@@ -106,7 +108,7 @@ static inline void mte_set_mem_tag_range(void *addr, size_t size, u8 tag,*/ #define SET_MEMTAG_RANGE (stg_post, dc_gva) \ do { \ - if (size >= 2 * dczid_bs) { \ + if (!dczid_dzp && size >= 2 * dczid_bs) {\ do { \ curr = stg_post(curr); \ } while (curr < end1); \
arch/arm64/lib/mte.S +7 -1
@@ -43,17 +43,23 @@ SYM_FUNC_END(mte_clear_page_tags) * x0 - address to the beginning of the page */ SYM_FUNC_START(mte_zero_clear_page_tags) + and x0, x0, #(1 << MTE_TAG_SHIFT) - 1 // clear the tag mrs x1, dczid_el0 + tbnz x1, #4, 2f // Branch if DC GZVA is prohibited and w1, w1, #0xf mov x2, #4 lsl x1, x2, x1 - and x0, x0, #(1 << MTE_TAG_SHIFT) - 1 // clear the tag 1: dc gzva, x0 add x0, x0, x1 tst x0, #(PAGE_SIZE - 1) b.ne 1b ret + +2: stz2g x0, [x0], #(MTE_GRANULE_SIZE * 2) + tst x0, #(PAGE_SIZE - 1) + b.ne 2b + ret SYM_FUNC_END(mte_zero_clear_page_tags) /*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 239/1039 platform/x86: wmi: Replace read_takes_no_args with a flags field
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit a90b38c58667142ecff2521481ed44286d46b140 ]
Replace the wmi_block.read_takes_no_args bool field with an unsigned long flags field, used together with test_bit() and friends.
This is a preparation patch for fixing a driver->notify() vs ->probe() race, which requires atomic flag handling.
--- drivers/platform/x86/wmi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/platform/x86/wmi.c +7 -4
@@ -57,6 +57,10 @@ static_assert(sizeof(typeof_member(struct guid_block, guid)) == 16);static_assert (sizeof (struct guid_block ) ==20 );static_assert (__alignof__(struct guid_block ) ==1 ); +enum {/* wmi_block flags */ +WMI_READ_TAKES_NO_ARGS , +}; +struct wmi_block {struct wmi_device dev;struct list_head list;
@@ -67,8 +71,7 @@ struct wmi_block {wmi_notify_handler handler;void *handler_data;u64 req_buf_size; - -bool read_takes_no_args; +unsigned long flags; };
@@ -367,7 +370,7 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance, wq_params[0 ].type =ACPI_TYPE_INTEGER ; wq_params[0 ].integer.value = instance; -if (instance ==0 && wblock->read_takes_no_args) +if (instance ==0 &&test_bit (WMI_READ_TAKES_NO_ARGS , &wblock->flags)) input.count =0 ;/*
@@ -1113,7 +1116,7 @@ static int wmi_create_device(struct device *wmi_bus_dev,* laptops, WQxx may not be a method at all.) */ if (info->type !=ACPI_TYPE_METHOD || info->param_count ==0 ) - wblock->read_takes_no_args = true; +set_bit (WMI_READ_TAKES_NO_ARGS , &wblock->flags);kfree (info);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 240/1039 platform/x86: wmi: Fix driver->notify() vs ->probe() race
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 9918878676a5f9e99b98679f04b9e6c0f5426b0a ]
The driver core sets struct device->driver before calling out to the bus' probe() method, this leaves a window where an ACPI notify may happen on the WMI object before the driver's probe() method has completed running, causing e.g. the driver's notify() callback to get called with drvdata not yet being set leading to a NULL pointer deref.
At a check for this to the WMI core, ensuring that the notify() callback is not called before the driver is ready.
--- drivers/platform/x86/wmi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/x86/wmi.c +5 -1
@@ -59,6 +59,7 @@ static_assert(__alignof__(struct guid_block) == 1);enum {/* wmi_block flags */ WMI_READ_TAKES_NO_ARGS , +WMI_PROBED , };struct wmi_block {
@@ -1008,6 +1009,7 @@ static int wmi_dev_probe(struct device *dev) } } +set_bit (WMI_PROBED , &wblock->flags);return 0 ; probe_misc_failure:
@@ -1025,6 +1027,8 @@ static void wmi_dev_remove(struct device *dev)struct wmi_block *wblock =dev_to_wblock (dev);struct wmi_driver *wdriver =drv_to_wdrv (dev->driver); +clear_bit (WMI_PROBED , &wblock->flags); +if (wdriver->filter_callback) {misc_deregister (&wblock->char_dev);kfree (wblock->char_dev.name);
@@ -1322,7 +1326,7 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event,return ;/* If a driver is bound, then notify the driver. */ -if (wblock->dev.dev.driver) { +if (test_bit (WMI_PROBED , &wblock->flags) && wblock->dev.dev.driver) {struct wmi_driver *driver =drv_to_wdrv (wblock->dev.dev.driver);struct acpi_buffer evdata = {ACPI_ALLOCATE_BUFFER ,NULL };acpi_status status;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 241/1039 samples/bpf: Clean up samples/bpf build failes
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 527024f7aeb683ce7ef49b07ef7ce9ecf015288d ]
Remove xdp_samples_user.o rule redefinition which generates Makefile warning and instead override TPROGS_CFLAGS. This seems to work fine when building inside selftests/bpf.
That was one big head-scratcher before I found that generic Makefile.target hid this surprising specialization for for xdp_samples_user.o.
Main change is to use actual locally installed libbpf headers.
Also drop printk macro re-definition (not even used!).
--- samples/bpf/Makefile | 13 ++++++++++++- samples/bpf/Makefile.target | 11 ----------- samples/bpf/lwt_len_hist_kern.c | 7 ------- 3 files changed, 12 insertions(+), 19 deletions(-)
samples/bpf/Makefile +12 -1
@@ -328,7 +328,7 @@ $(BPF_SAMPLES_PATH)/*.c: verify_target_bpf $(LIBBPF) $(src)/*.c: verify_target_bpf $(LIBBPF) libbpf_hdrs: $(LIBBPF) -$(obj)/$(TRACE_HELPERS): | libbpf_hdrs +$(obj)/$(TRACE_HELPERS) $(obj)/$(CGROUP_HELPERS) $(obj)/$(XDP_SAMPLE): | libbpf_hdrs .PHONY: libbpf_hdrs
@@ -343,6 +343,17 @@ $(obj)/hbm_out_kern.o: $(src)/hbm.h $(src)/hbm_kern.h $(obj)/hbm.o: $(src)/hbm.h $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h +# Override includes for xdp_sample_user.o because $(srctree)/usr/include in +# TPROGS_CFLAGS causes conflicts +XDP_SAMPLE_CFLAGS += -Wall -O2 -lm \ + -I$(src)/../../tools/include \ + -I$(src)/../../tools/include/uapi \ + -I$(LIBBPF_INCLUDE) \ + -I$(src)/../../tools/testing/selftests/bpf + +$(obj)/$(XDP_SAMPLE): TPROGS_CFLAGS = $(XDP_SAMPLE_CFLAGS) +$(obj)/$(XDP_SAMPLE): $(src)/xdp_sample_user.h $(src)/xdp_sample_shared.h + -include $(BPF_SAMPLES_PATH)/Makefile.target VMLINUX_BTF_PATHS ?= $(abspath $(if $(O),$(O)/vmlinux)) \
samples/bpf/Makefile.target +0 -11
@@ -73,14 +73,3 @@ quiet_cmd_tprog-cobjs = CC $@ cmd_tprog-cobjs = $(CC) $(tprogc_flags) -c -o $@ $< $(tprog-cobjs): $(obj)/%.o: $(src)/%.c FORCE $(call if_changed_dep,tprog-cobjs) - -# Override includes for xdp_sample_user.o because $(srctree)/usr/include in -# TPROGS_CFLAGS causes conflicts -XDP_SAMPLE_CFLAGS += -Wall -O2 -lm \ - -I./tools/include \ - -I./tools/include/uapi \ - -I./tools/lib \ - -I./tools/testing/selftests/bpf -$(obj)/xdp_sample_user.o: $(src)/xdp_sample_user.c \ - $(src)/xdp_sample_user.h $(src)/xdp_sample_shared.h - $(CC) $(XDP_SAMPLE_CFLAGS) -c -o $@ $<
samples/bpf/lwt_len_hist_kern.c +0 -7
@@ -16,13 +16,6 @@#include <uapi/linux/in.h> #include <bpf/bpf_helpers.h> -# define printk (fmt, ...) \ - ({ \ - char ____fmt[] = fmt; \ - bpf_trace_printk(____fmt, sizeof(____fmt), \ - ##__VA_ARGS__); \ - }) -struct bpf_elf_map {__u32 type;__u32 size_key;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 242/1039 samples: bpf: Fix xdp_sample_user.o linking with Clang
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit e64fbcaa7a666f16329b1c67af15ea501bc84586 ]
Clang (13) doesn't get the jokes about specifying libraries to link in cclags of individual .o objects:
clang-13: warning: -lm: 'linker' input unused [-Wunused-command-line-argument] [ ... ]
LD samples/bpf/xdp_redirect_cpu LD samples/bpf/xdp_redirect_map_multi LD samples/bpf/xdp_redirect_map LD samples/bpf/xdp_redirect LD samples/bpf/xdp_monitor
/usr/bin/ld: samples/bpf/xdp_sample_user.o: in function `sample_summary_print':
xdp_sample_user.c:(.text+0x84c): undefined reference to floor' /usr/bin/ld: xdp_sample_user.c:(.text+0x870): undefined reference to ceil' /usr/bin/ld: xdp_sample_user.c:(.text+0x8cf): undefined reference to floor' /usr/bin/ld: xdp_sample_user.c:(.text+0x8f3): undefined reference to ceil' [ more ]
Specify '-lm' as ldflags for all xdp_sample_user.o users in the main Makefile and remove it from ccflags of ^ in Makefile.target -- just like it's done for all other samples. This works with all compilers.
--- samples/bpf/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
samples/bpf/Makefile +6 -1
@@ -215,6 +215,11 @@ TPROGS_LDFLAGS := -L$(SYSROOT)/usr/lib endif TPROGS_LDLIBS += $(LIBBPF) -lelf -lz +TPROGLDLIBS_xdp_monitor += -lm +TPROGLDLIBS_xdp_redirect += -lm +TPROGLDLIBS_xdp_redirect_cpu += -lm +TPROGLDLIBS_xdp_redirect_map += -lm +TPROGLDLIBS_xdp_redirect_map_multi += -lm TPROGLDLIBS_tracex4 += -lrt TPROGLDLIBS_trace_output += -lrt TPROGLDLIBS_map_perf_test += -lrt
@@ -345,7 +350,7 @@ $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h # Override includes for xdp_sample_user.o because $(srctree)/usr/include in # TPROGS_CFLAGS causes conflicts -XDP_SAMPLE_CFLAGS += -Wall -O2 -lm \ +XDP_SAMPLE_CFLAGS += -Wall -O2 \ -I$(src)/../../tools/include \ -I$(src)/../../tools/include/uapi \ -I$(LIBBPF_INCLUDE) \
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 243/1039 samples: bpf: Fix unknown warning group build warning on Clang
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 6f670d06e47c774bc065aaa84a527a4838f34bd8 ]
Clang doesn't have 'stringop-truncation' group like GCC does, and complains about it when building samples which use xdp_sample_user infra:
samples/bpf/xdp_sample_user.h:48:32: warning: unknown warning group '-Wstringop-truncation', ignored [-Wunknown-warning-option] #pragma GCC diagnostic ignored "-Wstringop-truncation"
^
[ repeat ]
Those are harmless, but avoidable when guarding it with ifdef. I could guard push/pop as well, but this would require one more ifdef cruft around a single line which I don't think is reasonable.
--- samples/bpf/xdp_sample_user.h | 2 ++ 1 file changed, 2 insertions(+)
samples/bpf/xdp_sample_user.h +2 -0
@@ -45,7 +45,9 @@ const char *get_driver_name(int ifindex);int get_mac_addr (int ifindex,void *mac_addr);#pragma GCC diagnostic push +#ifndef __clang__#pragma GCC diagnostic ignored "-Wstringop-truncation" +#endif __attribute__((unused))static inline char *safe_strncpy (char *dst,const char *src,size_t size) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 244/1039 media: uvcvideo: Fix memory leak of object map on error exit path
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 4b065060555b14c7a9b86c013a1c9bee8e8b6fbd ]
Currently when the allocation of map->name fails the error exit path does not kfree the previously allocated object map. Fix this by setting ret to -ENOMEM and taking the free_map exit error path to ensure map is kfree'd.
Addresses-Coverity: ("Resource leak")
--- drivers/media/usb/uvc/uvc_v4l2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_v4l2.c +4 -2
@@ -44,8 +44,10 @@ static int uvc_ioctl_ctrl_map(struct uvc_video_chain *chain,if (v4l2_ctrl_get_name (map->id) ==NULL ) { map->name =kmemdup (xmap->name,sizeof (xmap->name),GFP_KERNEL ); -if (!map->name) -return -ENOMEM ; +if (!map->name) { + ret = -ENOMEM ; + goto free_map; + } }memcpy (map->entity, xmap->entity,sizeof (map->entity)); map->selector = xmap->selector;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 245/1039 media: uvcvideo: Avoid invalid memory access
In reply to Greg Kroah-HartmanFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit f0577b1b6394f954903fcc67e12fe9e7001dafd6 ]
If mappings points to an invalid memory, we will be invalid accessing it. Solve it by initializing the value of the variable mapping and by changing the order in the conditional statement (to avoid accessing mapping->id if not needed).
Fix:
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN NOPTI
--- drivers/media/usb/uvc/uvc_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_ctrl.c +1 -1
@@ -1638,7 +1638,7 @@ static int uvc_ctrl_find_ctrl_idx(struct uvc_entity *entity,struct v4l2_ext_controls *ctrls, struct uvc_control *uvc_control) { - struct uvc_control_mapping *mapping; + struct uvc_control_mapping *mapping = NULL;struct uvc_control *ctrl_found;unsigned int i;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 246/1039 media: uvcvideo: Avoid returning invalid controls
In reply to Greg Kroah-HartmanFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit 414d3b49d9fd4a0bb16a13d929027847fd094f3f ]
If the memory where ctrl_found is placed has the value of uvc_ctrl and __uvc_find_control does not find the control we will return an invalid index.
--- drivers/media/usb/uvc/uvc_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_ctrl.c +1 -1
@@ -1639,7 +1639,7 @@ static int uvc_ctrl_find_ctrl_idx(struct uvc_entity *entity, struct uvc_control *uvc_control) {struct uvc_control_mapping *mapping =NULL ; -struct uvc_control *ctrl_found; +struct uvc_control *ctrl_found =NULL ;unsigned int i;if (!entity)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 247/1039 media: dib8000: Fix a memleak in dib8000_init()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit 8dbdcc7269a83305ee9d677b75064d3530a48ee2 ]
In dib8000_init(), the variable fe is not freed or passed out on the failure of dib8000_identify(&state->i2c), which could lead to a memleak.
Fix this bug by adding a kfree of fe in the error path.
This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs.
Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug.
Builds with CONFIG_DVB_DIB8000=m show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/media/dvb-frontends/dib8000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/dib8000.c +3 -1
@@ -4473,8 +4473,10 @@ static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_ad state->timf_default = cfg->pll->timf; -if (dib8000_identify (&state->i2c) ==0 ) +if (dib8000_identify (&state->i2c) ==0 ) { +kfree (fe); goto error; + }dibx000_init_i2c_master (&state->i2c_master,DIB8000 , state->i2c.adap, state->i2c.addr);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 248/1039 media: saa7146: mxb: Fix a NULL pointer dereference in mxb_attach()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit 0407c49ebe330333478440157c640fffd986f41b ]
In mxb_attach(dev, info), saa7146_vv_init() is called to allocate a new memory for dev->vv_data. saa7146_vv_release() will be called on failure of mxb_probe(dev). There is a dereference of dev->vv_data in saa7146_vv_release(), which could lead to a NULL pointer dereference on failure of saa7146_vv_init().
Fix this bug by adding a check of saa7146_vv_init().
This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs.
Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug.
Builds with CONFIG_VIDEO_MXB=m show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/media/pci/saa7146/mxb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/pci/saa7146/mxb.c +7 -1
@@ -683,10 +683,16 @@ static struct saa7146_ext_vv vv_data;static int mxb_attach (struct saa7146_dev *dev,struct saa7146_pci_extension_data *info) {struct mxb *mxb; +int ret;DEB_EE ("dev:%p\n" , dev); -saa7146_vv_init (dev, &vv_data); + ret =saa7146_vv_init (dev, &vv_data); +if (ret) { +ERR ("Error in saa7146_vv_init()" ); +return ret; + } +if (mxb_probe (dev)) {saa7146_vv_release (dev);return -1 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 249/1039 media: si2157: Fix "warm" tuner state detection
In reply to Greg Kroah-HartmanFrom: Robert Schlabbach <[email protected]>
[ Upstream commit a6441ea29cb2c9314654e093a1cd8020b9b851c8 ]
Commit e955f959ac52 ("media: si2157: Better check for running tuner in init") completely broke the "warm" tuner detection of the si2157 driver due to a simple endian error: The Si2157 CRYSTAL_TRIM property code is 0x0402 and needs to be transmitted LSB first. However, it was inserted MSB first, causing the warm detection to always fail and spam the kernel log with tuner initialization messages each time the DVB frontend device was closed and reopened:
[ 312.215682] si2157 16-0060: found a 'Silicon Labs Si2157-A30' [ 312.264334] si2157 16-0060: firmware version: 3.0.5 [ 342.248593] si2157 16-0060: found a 'Silicon Labs Si2157-A30' [ 342.295743] si2157 16-0060: firmware version: 3.0.5 [ 372.328574] si2157 16-0060: found a 'Silicon Labs Si2157-A30' [ 372.385035] si2157 16-0060: firmware version: 3.0.5
Also, the reinitializations were observed disturb _other_ tuners on multi-tuner cards such as the Hauppauge WinTV-QuadHD, leading to missed or errored packets when one of the other DVB frontend devices on that card was opened.
Fix the order of the property code bytes to make the warm detection work again, also reducing the tuner initialization message in the kernel log to once per power-on, as well as fixing the interference with other tuners.
--- drivers/media/tuners/si2157.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/tuners/si2157.c +1 -1
@@ -90,7 +90,7 @@ static int si2157_init(struct dvb_frontend *fe)dev_dbg (&client->dev,"\n" );/* Try to get Xtal trim property, to verify tuner still running */ -memcpy (cmd.args,"\x15\x00\x04\x02" ,4 ); +memcpy (cmd.args,"\x15\x00\x02\x04" ,4 ); cmd.wlen =4 ; cmd.rlen =4 ; ret =si2157_cmd_execute (client, &cmd);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 250/1039 wireless: iwlwifi: Fix a double free in iwl_txq_dyn_alloc_dma
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit f973795a8d19cbf3d03807704eb7c6ff65788d5a ]
In iwl_txq_dyn_alloc_dma, txq->tfds is freed at first time by:
iwl_txq_alloc()->goto err_free_tfds->dma_free_coherent(). But it forgot to set txq->tfds to NULL.
Then the txq->tfds is freed again in iwl_txq_dyn_alloc_dma by:
goto error->iwl_txq_gen2_free_memory()->dma_free_coherent().
My patch sets txq->tfds to NULL after the first free to avoid the double free.
--- drivers/net/wireless/intel/iwlwifi/queue/tx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/queue/tx.c +1 -0
@@ -1072,6 +1072,7 @@ int iwl_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, int slots_num,return 0 ; err_free_tfds:dma_free_coherent (trans->dev, tfd_sz, txq->tfds, txq->dma_addr); + txq->tfds =NULL ; error:if (txq->entries && cmd_queue)for (i =0 ; i < slots_num; i++)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 251/1039 sched/rt: Try to restart rt period timer when rt runtime exceeded
In reply to Greg Kroah-HartmanFrom: Li Hua <[email protected]>
[ Upstream commit 9b58e976b3b391c0cf02e038d53dd0478ed3013c ]
When rt_runtime is modified from -1 to a valid control value, it may cause the task to be throttled all the time. Operations like the following will trigger the bug. E.g:
1. echo -1 > /proc/sys/kernel/sched_rt_runtime_us
2. Run a FIFO task named A that executes while(1)
3. echo 950000 > /proc/sys/kernel/sched_rt_runtime_us
When rt_runtime is -1, The rt period timer will not be activated when task A enqueued. And then the task will be throttled after setting rt_runtime to 950,000. The task will always be throttled because the rt period timer is not activated.
--- kernel/sched/rt.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
kernel/sched/rt.c +18 -5
@@ -52,11 +52,8 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime) rt_b->rt_period_timer.function = sched_rt_period_timer; } -static void start_rt_bandwidth (struct rt_bandwidth *rt_b) +static inline void do_start_rt_bandwidth (struct rt_bandwidth *rt_b) { -if (!rt_bandwidth_enabled () || rt_b->rt_runtime ==RUNTIME_INF ) -return ; -raw_spin_lock (&rt_b->rt_runtime_lock);if (!rt_b->rt_period_active) { rt_b->rt_period_active =1 ;
@@ -75,6 +72,14 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b)raw_spin_unlock (&rt_b->rt_runtime_lock); } +static void start_rt_bandwidth (struct rt_bandwidth *rt_b) +{ +if (!rt_bandwidth_enabled () || rt_b->rt_runtime ==RUNTIME_INF ) +return ; + +do_start_rt_bandwidth (rt_b); +} +void init_rt_rq (struct rt_rq *rt_rq) {struct rt_prio_array *array;
@@ -1031,13 +1036,17 @@ static void update_curr_rt(struct rq *rq)for_each_sched_rt_entity (rt_se) {struct rt_rq *rt_rq =rt_rq_of_se (rt_se); +int exceeded;if (sched_rt_runtime (rt_rq) !=RUNTIME_INF ) {raw_spin_lock (&rt_rq->rt_runtime_lock); rt_rq->rt_time += delta_exec; -if (sched_rt_runtime_exceeded (rt_rq)) + exceeded =sched_rt_runtime_exceeded (rt_rq); +if (exceeded)resched_curr (rq);raw_spin_unlock (&rt_rq->rt_runtime_lock); +if (exceeded) +do_start_rt_bandwidth (sched_rt_bandwidth (rt_rq)); } } }
@@ -2911,8 +2920,12 @@ static int sched_rt_global_validate(void)static void sched_rt_do_global (void ) { +unsigned long flags; + +raw_spin_lock_irqsave (&def_rt_bandwidth.rt_runtime_lock, flags); def_rt_bandwidth.rt_runtime =global_rt_runtime (); def_rt_bandwidth.rt_period =ns_to_ktime (global_rt_period ()); +raw_spin_unlock_irqrestore (&def_rt_bandwidth.rt_runtime_lock, flags); } int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 252/1039 mtd: spi-nor: Get rid of nor->page_size
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
[ Upstream commit 5854d4a6cc356ba3e16d8593ac1c089a32d1759c ]
nor->page_size duplicated what nor->params->page_size indicates for no good reason. page_size is a flash parameter of fixed value and it is better suited to be found in nor->params->page_size.
--- drivers/mtd/spi-nor/core.c | 19 +++++++++---------- drivers/mtd/spi-nor/xilinx.c | 17 ++++++++++------- include/linux/mtd/spi-nor.h | 2 -- 3 files changed, 19 insertions(+), 19 deletions(-)
drivers/mtd/spi-nor/core.c +9 -10
@@ -1952,6 +1952,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,struct spi_nor *nor =mtd_to_spi_nor (mtd);size_t page_offset, page_remain, i;ssize_t ret; +u32 page_size = nor->params->page_size;dev_dbg (nor->dev,"to 0x%08x, len %zd\n" , (u32 )to, len);
@@ -1968,16 +1969,15 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,* calculated with an AND operation. On the other cases we * need to do a modulus operation (more expensive). */ -if (is_power_of_2 (nor->page_size)) { - page_offset = addr & (nor->page_size -1 ); +if (is_power_of_2 (page_size)) { + page_offset = addr & (page_size -1 ); }else {uint64_t aux = addr; - page_offset =do_div (aux, nor->page_size); + page_offset =do_div (aux, page_size); }/* the size of data remaining on the first page */ - page_remain =min_t (size_t, - nor->page_size - page_offset, len - i); + page_remain =min_t (size_t, page_size - page_offset, len - i); addr =spi_nor_convert_addr (nor, addr);
@@ -3094,7 +3094,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,* We need the bounce buffer early to read/write registers when going * through the spi-mem layer (buffers have to be DMA-able). * For spi-mem drivers, we'll reallocate a new buffer if -* nor->page_size turns out to be greater than PAGE_SIZE (which +* nor->params->page_size turns out to be greater than PAGE_SIZE (which * shouldn't happen before long since NOR pages are usually less * than 1KB) after spi_nor_scan() returns. */
@@ -3171,8 +3171,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, mtd->flags |=MTD_NO_ERASE ; mtd->dev.parent = dev; - nor->page_size = nor->params->page_size; - mtd->writebufsize = nor->page_size; + mtd->writebufsize = nor->params->page_size;if (of_property_read_bool (np,"broken-flash-reset" )) nor->flags |=SNOR_F_BROKEN_RESET ;
@@ -3341,8 +3340,8 @@ static int spi_nor_probe(struct spi_mem *spimem)* and add this logic so that if anyone ever adds support for such * a NOR we don't end up with buffer overflows. */ -if (nor->page_size >PAGE_SIZE ) { - nor->bouncebuf_size = nor->page_size; +if (nor->params->page_size >PAGE_SIZE ) { + nor->bouncebuf_size = nor->params->page_size;devm_kfree (nor->dev, nor->bouncebuf); nor->bouncebuf = devm_kmalloc(nor->dev, nor->bouncebuf_size,
drivers/mtd/spi-nor/xilinx.c +10 -7
@@ -28,11 +28,12 @@ static const struct flash_info xilinx_parts[] = {*/ static u32 s3an_convert_addr (struct spi_nor *nor,u32 addr) { +u32 page_size = nor->params->page_size;u32 offset, page; - offset = addr % nor->page_size; - page = addr / nor->page_size; - page <<= (nor->page_size >512 ) ?10 :9 ; + offset = addr % page_size; + page = addr / page_size; + page <<= (page_size >512 ) ?10 :9 ;return page | offset; }
@@ -40,6 +41,7 @@ static u32 s3an_convert_addr(struct spi_nor *nor, u32 addr)static int xilinx_nor_setup (struct spi_nor *nor,const struct spi_nor_hwcaps *hwcaps) { +u32 page_size;int ret; ret =spi_nor_xread_sr (nor, nor->bouncebuf);
@@ -64,10 +66,11 @@ static int xilinx_nor_setup(struct spi_nor *nor,*/ if (nor->bouncebuf[0 ] &XSR_PAGESIZE ) {/* Flash in Power of 2 mode */ - nor->page_size = (nor->page_size ==264 ) ?256 :512 ; - nor->mtd.writebufsize = nor->page_size; - nor->mtd.size =8 * nor->page_size * nor->info->n_sectors; - nor->mtd.erasesize =8 * nor->page_size; + page_size = (nor->params->page_size ==264 ) ?256 :512 ; + nor->params->page_size = page_size; + nor->mtd.writebufsize = page_size; + nor->mtd.size =8 * page_size * nor->info->n_sectors; + nor->mtd.erasesize =8 * page_size; }else {/* Flash in Default addressing mode */ nor->params->convert_addr = s3an_convert_addr;
include/linux/mtd/spi-nor.h +0 -2
@@ -371,7 +371,6 @@ struct spi_nor_flash_parameter;* @bouncebuf_size: size of the bounce buffer * @info: SPI NOR part JEDEC MFR ID and other info * @manufacturer: SPI NOR manufacturer -* @page_size: the page size of the SPI NOR * @addr_width: number of address bytes * @erase_opcode: the opcode for erasing a sector * @read_opcode: the read opcode
@@ -401,7 +400,6 @@ struct spi_nor {size_t bouncebuf_size;const struct flash_info *info;const struct spi_nor_manufacturer *manufacturer; -u32 page_size;u8 addr_width;u8 erase_opcode;u8 read_opcode;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 253/1039 mtd: spi-nor: Fix mtd size for s3an flashes
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
[ Upstream commit f656b419d41aabafb6b526abc3988dfbf2e5c1ba ]
As it was before the blamed commit, s3an_nor_scan() was called after mtd size was set with params->size, and it overwrote the mtd size value with '8 * nor->page_size * nor->info->n_sectors' when XSR_PAGESIZE was set. With the introduction of s3an_post_sfdp_fixups(), we missed to update the mtd size for the s3an flashes. Fix the mtd size by updating both nor->params->size, (which will update the mtd_info size later on) and nor->mtd.size (which is used in spi_nor_set_addr_width()).
--- drivers/mtd/spi-nor/xilinx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/xilinx.c +2 -1
@@ -69,7 +69,8 @@ static int xilinx_nor_setup(struct spi_nor *nor, page_size = (nor->params->page_size ==264 ) ?256 :512 ; nor->params->page_size = page_size; nor->mtd.writebufsize = page_size; - nor->mtd.size =8 * page_size * nor->info->n_sectors; + nor->params->size =8 * page_size * nor->info->n_sectors; + nor->mtd.size = nor->params->size; nor->mtd.erasesize =8 * page_size; }else {/* Flash in Default addressing mode */
Signature · 1 line
2.34.1