6.18.53-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 116/1250 soundwire: intel: Move suspend tracking from trigger to pm suspend
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
[ Upstream commit acf676b9de0c86bc735a7f04962d3d688e156ffc ]
Mark all open DAI runtimes as suspended in the component .suspend callback instead of relying on SNDRV_PCM_TRIGGER_SUSPEND, which is not delivered during PAUSE or xrun states.
If during system suspend a dai is open it means that it is in either in SUSPENDED, PAUSED or STOPPED (due to xrun) state and they will need to be re-initialized during resume (which is done in .prepare callback).
--- drivers/soundwire/intel.c | 31 ++++++-------------------- drivers/soundwire/intel_ace2x.c | 39 ++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 37 deletions(-)
drivers/soundwire/intel.c +7 -24
@@ -907,19 +907,6 @@ static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct sn }switch (cmd) { -case SNDRV_PCM_TRIGGER_SUSPEND : - -/* -* The .prepare callback is used to deal with xruns and resume operations. -* In the case of xruns, the DMAs and SHIM registers cannot be touched, -* but for resume operations the DMAs and SHIM registers need to be initialized. -* the .trigger callback is used to track the suspend case only. -*/ - - dai_runtime->suspended = true; - -break ; -case SNDRV_PCM_TRIGGER_PAUSE_PUSH : dai_runtime->paused = true;break ;
@@ -956,10 +943,12 @@ static int intel_component_dais_suspend(struct snd_soc_component *component)struct snd_soc_dai *dai;/* -* In the corner case where a SUSPEND happens during a PAUSE, the ALSA core -* does not throw the TRIGGER_SUSPEND. This leaves the DAIs in an unbalanced state. -* Since the component suspend is called last, we can trap this corner case -* and force the DAIs to release their resources. +* Mark all open streams as suspended. +* Open streams at this point can be in SUSPENDED, PAUSED or STOPPED +* state and during prepare the DMAs and SHIM registers need to be +* initialized for them. +* The STOPPED state is a special corner case which can happen if audio +* experiences xrun at suspend time. */ for_each_component_dais (component, dai) {struct sdw_cdns *cdns =snd_soc_dai_get_drvdata (dai);
@@ -967,13 +956,7 @@ static int intel_component_dais_suspend(struct snd_soc_component *component) dai_runtime = cdns->dai_runtime_array[dai->id]; -if (!dai_runtime) -continue ; - -if (dai_runtime->suspended) -continue ; - -if (dai_runtime->paused) +if (dai_runtime) dai_runtime->suspended = true; }
drivers/soundwire/intel_ace2x.c +26 -13
@@ -822,19 +822,6 @@ static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct sn }switch (cmd) { -case SNDRV_PCM_TRIGGER_SUSPEND : - -/* -* The .prepare callback is used to deal with xruns and resume operations. -* In the case of xruns, the DMAs and SHIM registers cannot be touched, -* but for resume operations the DMAs and SHIM registers need to be initialized. -* the .trigger callback is used to track the suspend case only. -*/ - - dai_runtime->suspended = true; - -break ; -case SNDRV_PCM_TRIGGER_PAUSE_PUSH : dai_runtime->paused = true;break ;
@@ -858,8 +845,34 @@ static const struct snd_soc_dai_ops intel_pcm_dai_ops = { .get_stream = intel_get_sdw_stream, }; +static int intel_component_dais_suspend (struct snd_soc_component *component) +{ +struct snd_soc_dai *dai; + +/* +* Mark all open streams as suspended. +* Open streams at this point can be in SUSPENDED, PAUSED or STOPPED +* state and during prepare the DMAs and SHIM registers need to be +* initialized for them. +* The STOPPED state is a special corner case which can happen if audio +* experiences xrun at suspend time. +*/ +for_each_component_dais (component, dai) { +struct sdw_cdns *cdns =snd_soc_dai_get_drvdata (dai); +struct sdw_cdns_dai_runtime *dai_runtime; + + dai_runtime = cdns->dai_runtime_array[dai->id]; + +if (dai_runtime) + dai_runtime->suspended = true; + } + +return 0 ; +} +static const struct snd_soc_component_driver dai_component = { .name ="soundwire" , + .suspend = intel_component_dais_suspend, };/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 117/1250 clk: samsung: exynos850: mark APM I3C clocks as critical
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Klimov <[email protected]>
[ Upstream commit 44984aaf1aa727ff944dd4b72fcf069d08b0056d ]
The Exynos850 APM co-processor relies on the I3C bus to communicate with the PMIC. Currently, there is no dedicated PMIC consumer driver managing these clocks, so the clock subsystem automatically gates them during the initialisation. Once gated, any subsequent ACPM communication with APM results in timeouts.
As a temporary workaround (and let's hope it doesn't become permanent), mark both gout_i3c_pclk and gout_i3c_sclk as CLK_IS_CRITICAL ones to prevent the clock subsystem from disabling them. This makes the ACPM communication functional. This workaround should be reverted once a proper ACPM PMIC driver is implemented to manage these clocks.
--- drivers/clk/samsung/clk-exynos850.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/samsung/clk-exynos850.c +3 -2
@@ -684,10 +684,11 @@ static const struct samsung_gate_clock apm_gate_clks[] __initconst = { CLK_CON_GAT_GOUT_APM_APBIF_RTC_PCLK, 21, 0, 0),GATE (CLK_GOUT_TOP_RTC_PCLK ,"gout_top_rtc_pclk" ,"dout_apm_bus" ,CLK_CON_GAT_GOUT_APM_APBIF_TOP_RTC_PCLK ,21 ,0 ,0 ), +/* TODO: Should be dealt with or enabled in PMIC ACPM driver */ GATE (CLK_GOUT_I3C_PCLK ,"gout_i3c_pclk" ,"dout_apm_bus" , -CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_PCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_PCLK ,21 ,CLK_IS_CRITICAL ,0 ),GATE (CLK_GOUT_I3C_SCLK ,"gout_i3c_sclk" ,"mout_apm_i3c" , -CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_SCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_SCLK ,21 ,CLK_IS_CRITICAL ,0 ),GATE (CLK_GOUT_SPEEDY_PCLK ,"gout_speedy_pclk" ,"dout_apm_bus" , CLK_CON_GAT_GOUT_APM_SPEEDY_APM_PCLK, 21, 0, 0),/* TODO: Should be enabled in GPIO driver (or made CLK_IS_CRITICAL) */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 118/1250 scsi: pm8001: Reject firmware update in fatal error state
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kumar Meiyappan <[email protected]>
[ Upstream commit 2a8fbcfb04aa9db189bfa3842d4f586aecd0e631 ]
pm8001_store_update_fw() allows a firmware update request even when the controller has already entered a fatal error state.
Firmware update is not valid once the controller is in that state, and attempting it can lead to a call trace. Reject the request early by checking controller_fatal_error, set the firmware status to FAIL_PARAMETERS, and return -EINVAL.
--- drivers/scsi/pm8001/pm8001_ctl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/scsi/pm8001/pm8001_ctl.c +8 -0
@@ -823,6 +823,14 @@ static ssize_t pm8001_store_update_fw(struct device *cdev, goto out; } +if (pm8001_ha->controller_fatal_error) { +pm8001_dbg (pm8001_ha,FAIL , +"controller in fatal error state, firmware update rejected\n" ); + pm8001_ha->fw_status =FAIL_PARAMETERS ; + ret = -EINVAL ; + goto out; + } +for (i =0 ; flash_command_table[i].code !=FLASH_CMD_NONE ; i++) {if (!memcmp (flash_command_table[i].command, cmd_ptr,strlen (cmd_ptr))) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 119/1250 scsi: pm8001: Reject non-fatal dump when controller is crashed
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kumar Meiyappan <[email protected]>
[ Upstream commit aa3b8f56ef27ed72394a752820abdec4608b731c ]
pm80xx_get_non_fatal_dump() can be called even after the controller has entered a fatal error state. In that case the forensic memory contents are not safe to access for a non-fatal dump request, and attempting to do so can trigger a call trace.
Check controller_fatal_error before reading the non-fatal dump buffer and return -EINVAL when the controller is already in a crashed state.
This prevents non-fatal dump collection from running in an invalid controller state.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/scsi/pm8001/pm80xx_hwi.c +7 -0
@@ -401,6 +401,13 @@ ssize_t pm80xx_get_non_fatal_dump(struct device *cdev,char *buf_copy = buf; temp = (u32 *)pm8001_ha->memoryMap.region[FORENSIC_MEM ].virt_ptr; + +if (pm8001_ha->controller_fatal_error) { +pm8001_dbg (pm8001_ha,FAIL , +"non-fatal dump not available in fatal error state\n" ); +return -EINVAL ; + } +if (++pm8001_ha->non_fatal_count ==1 ) {if (pm8001_ha->chip_id == chip_8001) { snprintf(pm8001_ha->forensic_info.data_buf.direct_data,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 120/1250 crypto: ecc - Unbreak the build on arm with CONFIG_KASAN_STACK=y
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
[ Upstream commit c64ba13e2033c3c6dc1a097bf35f9f1fe457c3f7 ]
Andrew reports build breakage of arm allmodconfig, reproducible with gcc 14.2.0 and 15.2.0:
crypto/ecc.c: In function 'ecc_point_mult':
crypto/ecc.c:1380:1: error: the frame size of 1360 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
gcc aggressively inlines functions called by ecc_point_mult() (without there being any explicit inline declarations), which pushes stack usage close to the limit imposed by CONFIG_FRAME_WARN. allmodconfig implies CONFIG_KASAN_STACK=y, which increases the stack above that limit.
In the bugzilla entry linked below, gcc maintainers explain that gcc estimates extra stack usage caused by inlining, but ASAN instrumentation is added in post-IPA passes and thus the inlining heuristics cannot account for it.
It could be argued that -Werror=frame-larger-than=1280 instructs the compiler to avoid inlining beyond that limit lest the build breaks, which would imply gcc behaves incorrectly. But gcc maintainers reject this notion and believe that a warning switch should never affect code generation, even if it is promoted to an error.
One way to unbreak the build is to limit inlining via -finline-limit=100 or by explicitly declaring some functions noinline. However while it does keep stack usage of individual functions below the limit, *total* stack usage increases.
A longterm solution is to refactor ecc.c for reduced stack usage. It currently performs ECC point multiplication with a Montgomery ladder which uses co-Z (conjugate) addition to trade off memory for speed. The algorithm is susceptible to timing attacks and needs to be replaced with a constant time Montgomery ladder, which should consume less memory and thus resolve the stack usage issue as a side effect.
In the interim, raise the limit for ecc.c, as is already done for several other files in the source tree.
Constrain to gcc because clang 19.1.7 does not exhibit the issue. It makes do with a 724 bytes stack frame even though it inlines almost the same functions as gcc.
--- crypto/Makefile | 5 +++++ 1 file changed, 5 insertions(+)
crypto/Makefile +5 -0
@@ -183,6 +183,11 @@ obj-$(CONFIG_CRYPTO_ZSTD) += zstd.o obj-$(CONFIG_CRYPTO_ECC) += ecc.o obj-$(CONFIG_CRYPTO_ESSIV) += essiv.o +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124949 +ifeq ($(CONFIG_ARM)$(CONFIG_KASAN_STACK)$(CONFIG_CC_IS_GCC),yyy) +CFLAGS_ecc.o += $(call cc-option,-Wframe-larger-than=1536) +endif + ecdh_generic-y += ecdh.o ecdh_generic-y += ecdh_helper.o obj-$(CONFIG_CRYPTO_ECDH) += ecdh_generic.o
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 121/1250 ASoC: Intel: sof_sdw: append dai type to dai link name unconditionally
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
[ Upstream commit c84179a1d36bebe99d9694502737ae9f3a90d2bc ]
The dai_type is used to select function topologies. Since the topology stream name and DAI link name use partial matching, unconditionally appending the dai_type provides necessary selection metadata without breaking existing topologies.
--- sound/soc/intel/boards/sof_sdw.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
sound/soc/intel/boards/sof_sdw.c +12 -11
@@ -865,10 +865,16 @@ static int create_sdw_dailink(struct snd_soc_card *card, } } +/* +* The dai_type is used to select function topologies. Since the topology stream name +* and DAI link name use partial matching, unconditionally appending the dai_type provides +* necessary selection metadata without breaking existing topologies. Although +* ctx->append_dai_type is not checked here, we overwrite it to ensure consistency in case +* it is referenced elsewhere. +*/ + ctx->append_dai_type = true;for_each_pcm_streams (stream) {static const char *const sdw_stream_name[] = { -"SDW%d-Playback" , -"SDW%d-Capture" ,"SDW%d-Playback-%s" ,"SDW%d-Capture-%s" , };
@@ -896,15 +902,10 @@ static int create_sdw_dailink(struct snd_soc_card *card, }/* create stream name according to first link id */ -if (ctx->append_dai_type) - name =devm_kasprintf (dev,GFP_KERNEL , - sdw_stream_name[stream +2 ], -ffs (sof_end->link_mask) -1 , - type_strings[sof_end->dai_info->dai_type]); -else - name =devm_kasprintf (dev,GFP_KERNEL , - sdw_stream_name[stream], -ffs (sof_end->link_mask) -1 ); + name =devm_kasprintf (dev,GFP_KERNEL , + sdw_stream_name[stream], +ffs (sof_end->link_mask) -1 , + type_strings[sof_end->dai_info->dai_type]);if (!name)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 122/1250 crypto: atmel-ecc - add support for atecc608b
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
[ Upstream commit b668edaf8dcc8d09f6f1e71797422b44d4bd22a3 ]
Tested on hardware with an ATECC608B at 0x60. The device binds successfully, passes the driver's sanity check, and registers the ecdh-nist-p256 KPP algorithm.
The hardware ECDH path was also exercised using a minimal KPP test module, covering private key generation, public key derivation, and shared secret computation.
--- drivers/crypto/atmel-ecc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/atmel-ecc.c +3 -0
@@ -365,6 +365,8 @@ static void atmel_ecc_remove(struct i2c_client *client)static const struct of_device_id atmel_ecc_dt_ids[] = { { .compatible ="atmel,atecc508a" , + }, { + .compatible ="atmel,atecc608b" , }, {/* sentinel */ }
@@ -374,6 +376,7 @@ MODULE_DEVICE_TABLE(of, atmel_ecc_dt_ids);static const struct i2c_device_id atmel_ecc_id[] = { {"atecc508a" }, + {"atecc608b" }, { } };MODULE_DEVICE_TABLE (i2c, atmel_ecc_id);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 123/1250 net: airoha: Reserve RX headroom to avoid skb reallocation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit bbfb1983944f2eaa8ee192e0f7b59ecc0fda9981 ]
Reserve NET_SKB_PAD + NET_IP_ALIGN bytes of headroom for received packets to avoid skb head reallocation when pushing protocol headers into the skb.
--- drivers/net/ethernet/airoha/airoha_eth.c | 14 ++++++++------ drivers/net/ethernet/airoha/airoha_eth.h | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/net/ethernet/airoha/airoha_eth.c +8 -6
@@ -568,9 +568,10 @@ static int airoha_qdma_fill_rx_queue(struct airoha_queue *q) q->queued++; nframes++; + offset +=AIROHA_RX_HEADROOM ; e->buf =page_address (page) + offset; e->dma_addr =page_pool_get_dma_addr (page) + offset; - e->dma_len =SKB_WITH_OVERHEAD (q->buf_size); + e->dma_len =SKB_WITH_OVERHEAD (AIROHA_RX_LEN (q->buf_size)); val =FIELD_PREP (QDMA_DESC_LEN_MASK , e->dma_len);WRITE_ONCE (desc->ctrl,cpu_to_le32 (val));
@@ -635,13 +636,12 @@ static int airoha_qdma_rx_process(struct airoha_queue *q, int budget) q->tail = (q->tail +1 ) % q->ndesc; q->queued--; -dma_sync_single_for_cpu (eth->dev, e->dma_addr, -SKB_WITH_OVERHEAD (q->buf_size), dir); +dma_sync_single_for_cpu (eth->dev, e->dma_addr, e->dma_len, + dir); page =virt_to_head_page (e->buf); len =FIELD_GET (QDMA_DESC_LEN_MASK , desc_ctrl); - data_len = q->skb ? q->buf_size - :SKB_WITH_OVERHEAD (q->buf_size); + data_len = q->skb ?AIROHA_RX_LEN (q->buf_size) : e->dma_len;if (!len || data_len < len) goto free_frag;
@@ -651,10 +651,12 @@ static int airoha_qdma_rx_process(struct airoha_queue *q, int budget) port = eth->ports[p];if (!q->skb) {/* first buffer */ - q->skb =napi_build_skb (e->buf, q->buf_size); + q->skb =napi_build_skb (e->buf -AIROHA_RX_HEADROOM , + q->buf_size);if (!q->skb) goto free_frag; +skb_reserve (q->skb,AIROHA_RX_HEADROOM );__skb_put (q->skb, len);skb_mark_for_recycle (q->skb); q->skb->dev = port->dev;
drivers/net/ethernet/airoha/airoha_eth.h +2 -0
@@ -32,6 +32,8 @@#define AIROHA_FE_MC_MAX_VLAN_TABLE 64#define AIROHA_FE_MC_MAX_VLAN_PORT 16#define AIROHA_NUM_TX_IRQ 2 +#define AIROHA_RX_HEADROOM (NET_SKB_PAD + NET_IP_ALIGN) +#define AIROHA_RX_LEN (_n) ((_n) - AIROHA_RX_HEADROOM)#define HW_DSCP_NUM 2048#define IRQ_QUEUE_LEN (_n) ((_n) ? 1024 : 2048)#define TX_DSCP_NUM 1024
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 124/1250 clk: qcom: clk-rpmh: Make all VRMs optional
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Koskovich <[email protected]>
[ Upstream commit 25b8f50b0622689cd1f7233e452407ce777a479e ]
Some VRMs aren't present on all boards, so mark them as optional. This prevents probe failures on boards where not all VRMs are present.
This resolves an issue seen on the Nothing Phone (4a) Pro (Eliza) where probe fails due to RPMH_RF_CLK5 not being present on the board, this is due to this device having a slightly different PMIC configuration from the Eliza MTP.
This matches the downstream approach of marking all VRMs as optional and makes the previous clka_optional handling redundant.
--- drivers/clk/qcom/clk-rpmh.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/clk/qcom/clk-rpmh.c +1 -7
@@ -66,8 +66,6 @@ struct clk_rpmh {struct clk_rpmh_desc {struct clk_hw **clks;size_t num_clks; -/* RPMh clock clkaN are optional for this platform */ -bool clka_optional; };static DEFINE_MUTEX (rpmh_clk_lock);
@@ -680,7 +678,6 @@ static struct clk_hw *sm8550_rpmh_clocks[] = {static const struct clk_rpmh_desc clk_rpmh_sm8550 = { .clks = sm8550_rpmh_clocks, .num_clks =ARRAY_SIZE (sm8550_rpmh_clocks), - .clka_optional = true, };static struct clk_hw *sm8650_rpmh_clocks[] = {
@@ -712,7 +709,6 @@ static struct clk_hw *sm8650_rpmh_clocks[] = {static const struct clk_rpmh_desc clk_rpmh_sm8650 = { .clks = sm8650_rpmh_clocks, .num_clks =ARRAY_SIZE (sm8650_rpmh_clocks), - .clka_optional = true, };static struct clk_hw *sc7280_rpmh_clocks[] = {
@@ -881,7 +877,6 @@ static struct clk_hw *sm8750_rpmh_clocks[] = {static const struct clk_rpmh_desc clk_rpmh_sm8750 = { .clks = sm8750_rpmh_clocks, .num_clks =ARRAY_SIZE (sm8750_rpmh_clocks), - .clka_optional = true, };static struct clk_hw *glymur_rpmh_clocks[] = {
@@ -943,8 +938,7 @@ static int clk_rpmh_probe(struct platform_device *pdev)if (!res_addr) { hw_clks[i] =NULL ; -if (desc->clka_optional && - !strncmp (rpmh_clk->res_name,"clka" ,sizeof ("clka" ) -1 )) +if (rpmh_clk->res_addr ==CLK_RPMH_VRM_EN_OFFSET )continue ; dev_err(&pdev->dev, "missing RPMh resource address for %s\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 125/1250 media: imon: Add iMON VFD HID OEM v1.2 key mappings
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alessandro Baldi <[email protected]>
[ Upstream commit d97d13c24d7893abcfb80d38630ce74daaa1434c ]
Add Vol+/Vol-/Mute panel button mappings for iMON VFD HID OEM v1.2. This version differs in the codes that generate the KEY_VOLUMEUP, KEY_VOLUMEDOWN and KEY_MUTE events.
--- drivers/media/rc/imon.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/rc/imon.c +4 -0
@@ -290,6 +290,10 @@ static const struct imon_usb_dev_descr imon_OEM_VFD = { { 0x000100000000ffeell, KEY_VOLUMEUP }, { 0x010000000000ffeell, KEY_VOLUMEDOWN }, { 0x000000000100ffeell, KEY_MUTE }, +/* iMON VFD HID OEM v1.2 */ + { 0x000000000a00ffeell, KEY_VOLUMEUP }, + { 0x000000000b00ffeell, KEY_VOLUMEDOWN }, + { 0x000000000c00ffeell, KEY_MUTE },/* 0xffdc iMON MCE VFD */ { 0x00010000ffffffeell, KEY_VOLUMEUP }, { 0x01000000ffffffeell, KEY_VOLUMEDOWN },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 126/1250 RDMA/mlx5: Use QP port when decoding responder CQEs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenguang Zhao <[email protected]>
[ Upstream commit 194762e6e436acde0f8f6aef44200b0058c36791 ]
The responder CQE path determines the link layer via rdma_port_get_link_layer(). Use qp->port instead of hardcoding port 1, which can mis-decode completions on multi-port devices.
--- drivers/infiniband/hw/mlx5/cq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/cq.c +2 -1
@@ -169,7 +169,8 @@ enum {static void handle_responder (struct ib_wc *wc,struct mlx5_cqe64 *cqe,struct mlx5_ib_qp *qp) { -enum rdma_link_layer ll =rdma_port_get_link_layer (qp->ibqp.device,1 ); +enum rdma_link_layer ll = +rdma_port_get_link_layer (qp->ibqp.device, qp->port);struct mlx5_ib_dev *dev =to_mdev (qp->ibqp.device);struct mlx5_ib_srq *srq =NULL ;struct mlx5_ib_wq *wq;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 127/1250 coresight: perf: Retrieve path and source from event data
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit f37bc31447c0ddafedb25e3c4a4f4e2284034247 ]
ETM perf callbacks currently use the per-CPU csdev_src pointer, which can race with updates during device registration and unregistration.
The AUX setup already builds and stores the path in the event data. Use this path to retrieve the source instead of csdev_src to avoid the race.
Export coresight_get_source() and add etm_event_get_ctxt_path() to retrieve the context's path and its source with READ_ONCE() / WRITE_ONCE() accessors. Give the comments to explain why this approach is safe when pause or resume callbacks preempt the disable callback (e.g. via NMI).
--- drivers/hwtracing/coresight/coresight-core.c | 2 +- .../hwtracing/coresight/coresight-etm-perf.c | 114 +++++++++++------- drivers/hwtracing/coresight/coresight-priv.h | 1 + 3 files changed, 74 insertions(+), 43 deletions(-)
drivers/hwtracing/coresight/coresight-core.c +1 -1
@@ -79,7 +79,7 @@ struct coresight_device *coresight_get_percpu_sink(int cpu) }EXPORT_SYMBOL_GPL (coresight_get_percpu_sink); -static struct coresight_device *coresight_get_source (struct coresight_path *path) +struct coresight_device *coresight_get_source (struct coresight_path *path) {struct coresight_device *csdev;
drivers/hwtracing/coresight/coresight-etm-perf.c +72 -42
214 lines not on this page · raw message
drivers/hwtracing/coresight/coresight-priv.h +1 -0
@@ -250,6 +250,7 @@ void coresight_add_helper(struct coresight_device *csdev,void coresight_set_percpu_sink (int cpu,struct coresight_device *csdev);struct coresight_device *coresight_get_percpu_sink (int cpu); +struct coresight_device *coresight_get_source (struct coresight_path *path);void coresight_disable_source (struct coresight_device *csdev,void *data);void coresight_pause_source (struct coresight_device *csdev);int coresight_resume_source (struct coresight_device *csdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 128/1250 coresight: Disable source helpers in coresight_disable_path()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 5cae719943399929b4f9e612d9400017d3e2c1e1 ]
coresight_enable_path() enables helpers attached to every device in the path, including those bound to the source. However, coresight_disable_path() skips the source node, so source helpers had to be disabled separately in coresight_disable_source().
Move source helper disabling into coresight_disable_path() instead. Make coresight_disable_path_from() start from the passed node nd, so it can also disable helpers on the source. Update the comments accordingly.
As coresight_disable_path_from() now changes its semantics from "start beyond nd" to "start from nd", update the failure handling in coresight_enable_path(). If enabling a node fails, iterate to the previous node (the last successfully enabled one) and pass it to coresight_disable_path_from() for rollback.
--- drivers/hwtracing/coresight/coresight-core.c | 27 ++++++-------------- 1 file changed, 8 insertions(+), 19 deletions(-)
drivers/hwtracing/coresight/coresight-core.c +8 -19
@@ -378,19 +378,12 @@ static void coresight_disable_helpers(struct coresight_device *csdev, void *data }/* -* Helper function to call source_ops(csdev)->disable and also disable the -* helpers. -* -* There is an imbalance between coresight_enable_path() and -* coresight_disable_path(). Enabling also enables the source's helpers as part -* of the path, but disabling always skips the first item in the path (which is -* the source), so sources and their helpers don't get disabled as part of that -* function and we need the extra step here. +* coresight_disable_source() only disables the source, but do nothing for +* the associated helpers, which are controlled as part of the path. */ void coresight_disable_source (struct coresight_device *csdev,void *data) {source_ops (csdev)->disable (csdev, data); -coresight_disable_helpers (csdev,NULL ); }EXPORT_SYMBOL_GPL (coresight_disable_source);
@@ -417,9 +410,9 @@ int coresight_resume_source(struct coresight_device *csdev)EXPORT_SYMBOL_GPL (coresight_resume_source);/* -* coresight_disable_path_from : Disable components in the given path beyond -* @nd in the list. If @nd is NULL, all the components, except the SOURCE are -* disabled. +* coresight_disable_path_from : Disable components in the given path starting +* from @nd in the list. If @nd is NULL, all the components, except the SOURCE +* are disabled. */ static void coresight_disable_path_from (struct coresight_path *path,struct coresight_node *nd)
@@ -430,7 +423,7 @@ static void coresight_disable_path_from(struct coresight_path *path,if (!nd) nd = list_first_entry(&path->path_list, struct coresight_node, link); -list_for_each_entry_continue (nd, &path->path_list, link) { +list_for_each_entry_from (nd, &path->path_list, link) { csdev = nd->csdev; type = csdev->type;
@@ -450,12 +443,6 @@ static void coresight_disable_path_from(struct coresight_path *path,coresight_disable_sink (csdev);break ;case CORESIGHT_DEV_TYPE_SOURCE : -/* -* We skip the first node in the path assuming that it -* is the source. So we don't expect a source device in -* the middle of a path. -*/ -WARN_ON (1 );break ;case CORESIGHT_DEV_TYPE_LINK : parent =list_prev_entry (nd, link)->csdev;
@@ -561,6 +548,8 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode, err_disable_helpers:coresight_disable_helpers (csdev, path); err_disable_path: +/* Fetch the previous node, the last successfully enabled one */ + nd =list_next_entry (nd, link);coresight_disable_path_from (path, nd); goto out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 129/1250 drm/mediatek: dsi: Add compatible for mt8167-dsi
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Leonardo Scorcia <[email protected]>
[ Upstream commit 6428eaf0c1f39815b08d57054895c1934d5782f3 ]
The mt8167 DSI controller is fully compatible with the one found in mt2701. Unfortunately the device tree has a dedicated compatible for mt8167 since 2022 and it cannot be changed with a fallback nor removed at this point. The only way to get the device to work is to add the compatible to the driver.
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/mediatek/mtk_dsi.c +1 -0
@@ -1302,6 +1302,7 @@ static const struct mtk_dsi_driver_data mt8188_dsi_driver_data = {static const struct of_device_id mtk_dsi_of_match[] = { { .compatible ="mediatek,mt2701-dsi" , .data = &mt2701_dsi_driver_data }, + { .compatible ="mediatek,mt8167-dsi" , .data = &mt2701_dsi_driver_data }, { .compatible ="mediatek,mt8173-dsi" , .data = &mt8173_dsi_driver_data }, { .compatible ="mediatek,mt8183-dsi" , .data = &mt8183_dsi_driver_data }, { .compatible ="mediatek,mt8186-dsi" , .data = &mt8186_dsi_driver_data },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 130/1250 iomap: dont make REQ_POLLED imply REQ_NOWAIT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 47f28b493daf9049307494689e515205f1c377af ]
As described in commit 2bc057692599 ("block: don't make REQ_POLLED imply REQ_NOWAIT"), which fixed the same issue for the block device node, there are valid cases to poll for I/O completion without REQ_NOWAIT.
Additionally, sing REQ_NOWAIT for file system writes is currently not supported as file systems writes are not idempotent and would need a retry of just the bio and not the entire operation to be fully supported.
Switch iomap to set REQ_POLLED and remove the now unused bio_set_polled helper.
--- fs/iomap/direct-io.c | 2 +- include/linux/bio.h | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-)
fs/iomap/direct-io.c +1 -1
@@ -74,7 +74,7 @@ static void iomap_dio_submit_bio(const struct iomap_iter *iter,/* Sync dio can't be polled reliably */ if ((iocb->ki_flags &IOCB_HIPRI ) && !is_sync_kiocb (iocb)) { -bio_set_polled (bio, iocb); + bio->bi_opf |=REQ_POLLED ;WRITE_ONCE (iocb->private, bio); }
include/linux/bio.h +0 -14
@@ -690,20 +690,6 @@ static inline bool bioset_initialized(struct bio_set *bs)return bs->bio_slab !=NULL ; } -/* -* Mark a bio as polled. Note that for async polled IO, the caller must -* expect -EWOULDBLOCK if we cannot allocate a request (or other resources). -* We cannot block waiting for requests on polled IO, as those completions -* must be found by the caller. This is different than IRQ driven IO, where -* it's safe to wait for IO to complete. -*/ -static inline void bio_set_polled (struct bio *bio,struct kiocb *kiocb) -{ - bio->bi_opf |=REQ_POLLED ; -if (kiocb->ki_flags &IOCB_NOWAIT ) - bio->bi_opf |=REQ_NOWAIT ; -} -static inline void bio_clear_polled (struct bio *bio) { bio->bi_opf &= ~REQ_POLLED ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 131/1250 mailbox: Make mbox_send_message() return error code when tx fails
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joonwon Kang <[email protected]>
[ Upstream commit 96a3d2f3167f5644b30e60171898e67123c3c2c6 ]
When the mailbox controller failed transmitting message, the error code was only passed to the client's tx done handler and not to mbox_send_message() in blocking mode. For this reason, the function could return a false success. This commit resolves the issue by introducing the tx status and checking it before mbox_send_message() returns.
This commit works with the premise that the multi-threads' access to a channel in blocking mode is serialized by clients, not by the mailbox APIs, since the current mbox_send_message() in blocking mode does not support multi-threads.
--- drivers/mailbox/mailbox.c | 6 +++++- include/linux/mailbox_controller.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/mailbox/mailbox.c +5 -1
@@ -100,8 +100,10 @@ static void tx_tick(struct mbox_chan *chan, int r)if (chan->cl->tx_done) chan->cl->tx_done (chan->cl, mssg, r); -if (r != -ETIME && chan->cl->tx_block) +if (r != -ETIME && chan->cl->tx_block) { + chan->tx_status = r;complete (&chan->tx_complete); + } }static enum hrtimer_restart txdone_hrtimer (struct hrtimer *hrtimer)
@@ -270,6 +272,8 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg)if (ret ==0 ) { t = -ETIME ;tx_tick (chan, t); + }else if (chan->tx_status <0 ) { + t = chan->tx_status; } }
include/linux/mailbox_controller.h +2 -0
@@ -114,6 +114,7 @@ struct mbox_controller {* @txdone_method: Way to detect TXDone chosen by the API * @cl: Pointer to the current owner of this channel * @tx_complete: Transmission completion +* @tx_status: Transmission status * @active_req: Currently active request hook * @msg_count: No. of mssg currently queued * @msg_free: Index of next available mssg slot
@@ -126,6 +127,7 @@ struct mbox_chan {unsigned txdone_method;struct mbox_client *cl;struct completion tx_complete; +int tx_status;void *active_req;unsigned msg_count, msg_free;void *msg_data[MBOX_TX_QUEUE_LEN ];
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 132/1250 drm/amdgpu/userq: pin mqd and fw object bo to avoid eviction
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sunil Khatri <[email protected]>
[ Upstream commit a3bbf32a336939a1d21b9561f8e53333b684b7ef ]
mqd and fw objects are queue core objects which should remain valid and never be unmapped and evicted for user queues to work properly.
During eviction if these buffers are evicted the hw continue to use the invalid addresses and caused page faults and system hung.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +10 -3
@@ -270,16 +270,20 @@ int amdgpu_userq_create_object(struct amdgpu_userq_mgr *uq_mgr, goto free_obj; } + r =amdgpu_bo_pin (userq_obj->obj,AMDGPU_GEM_DOMAIN_GTT ); +if (r) + goto unresv; + r =amdgpu_ttm_alloc_gart (&(userq_obj->obj)->tbo);if (r) {drm_file_err (uq_mgr->file,"Failed to alloc GART for userqueue object (%d)" , r); - goto unresv; + goto unpin_bo; } r =amdgpu_bo_kmap (userq_obj->obj, &userq_obj->cpu_ptr);if (r) {drm_file_err (uq_mgr->file,"Failed to map BO for userqueue (%d)" , r); - goto unresv; + goto unpin_bo; } userq_obj->gpu_addr =amdgpu_bo_gpu_offset (userq_obj->obj);
@@ -287,11 +291,13 @@ int amdgpu_userq_create_object(struct amdgpu_userq_mgr *uq_mgr,memset (userq_obj->cpu_ptr,0 , size);return 0 ; +unpin_bo: +amdgpu_bo_unpin (userq_obj->obj); unresv:amdgpu_bo_unreserve (userq_obj->obj); - free_obj:amdgpu_bo_unref (&userq_obj->obj); +return r; }
@@ -299,6 +305,7 @@ void amdgpu_userq_destroy_object(struct amdgpu_userq_mgr *uq_mgr, struct amdgpu_userq_obj *userq_obj) {amdgpu_bo_kunmap (userq_obj->obj); +amdgpu_bo_unpin (userq_obj->obj);amdgpu_bo_unref (&userq_obj->obj); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 133/1250 PCI: Wait for device readiness after D3hot -> D0uninitialized transition
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
[ Upstream commit 41167a1e98536b4baf0846fd259c8124bd1c4e1b ]
For a device that advertises No_Soft_Reset == 0, a transition from D3hot to D0uninitialized is a soft reset, and the resulting internal device state is undefined.
Per PCIe r7.0, sec 2.3.1, a transition from D3hot to D0uninitialized mandates a minimum 10 ms delay before accessing the device. Following this delay, the device is permitted to respond to initial configuration requests with a Request Retry Status (RRS) completion status if it needs more time to initialize.
Call pci_dev_wait() after pci_power_up() performs a D3hot->D0uninitialized transition to ensure the device is ready to accept config accesses, as is done after the similar transition in pci_pm_reset().
If the device is already ready, this is essentially a no-op except for one additional config read.
--- drivers/pci/pci.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/pci/pci.c +22 -2
@@ -1305,7 +1305,18 @@ int pci_power_up(struct pci_dev *dev)bool need_restore;pci_power_t state;u16 pmcsr; +int ret; +/* +* When setting power state to D0, platform_pci_set_power_state() +* ensures main power is on. If it puts the device in D0, it also +* completes any required delays after the transition; if it leaves +* the device in D1, D2, or D3hot, we use the PM Capability to +* transition to D0. +* +* In all cases, the device is either Configuration-Ready or +* inaccessible upon return. +*/ platform_pci_set_power_state (dev,PCI_D0 );if (!dev->pm_cap) {
@@ -1346,10 +1357,19 @@ int pci_power_up(struct pci_dev *dev)pci_write_config_word (dev, dev->pm_cap +PCI_PM_CTRL ,0 );/* Mandatory transition delays; see PCI PM 1.2. */ -if (state == PCI_D3hot) +if (state == PCI_D3hot) {pci_dev_d3_sleep (dev); -else if (state ==PCI_D2 ) +if (!(pmcsr &PCI_PM_CTRL_NO_SOFT_RESET )) { + ret =pci_dev_wait (dev,"power up D3hot->D0uninitialized" , +PCIE_RESET_READY_POLL_MS ); +if (ret) { + dev->current_state = PCI_D3cold; +return -EIO ; + } + } + }else if (state ==PCI_D2 ) {udelay (PCI_PM_D2_DELAY ); + } end: dev->current_state =PCI_D0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 134/1250 drm/amdkfd: Check bounds for allocate_sdma_queue restore_sdma_id
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Francis <[email protected]>
[ Upstream commit bfe9a7545b2a7be1c543f1741e16f2d5ec4116ae ]
allocate_sdma_queue has an option where the sdma queue id can be specified (used by CRIU). We weren't bounds-checking that value.
Confirm it's less than the maximum number of queues.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +6 -0
@@ -1599,6 +1599,9 @@ static int allocate_sdma_queue(struct device_queue_manager *dqm, }if (restore_sdma_id) { +if (*restore_sdma_id >=get_num_sdma_queues (dqm)) +return -EINVAL ; +/* Re-use existing sdma_id */ if (!test_bit (*restore_sdma_id, dqm->sdma_bitmap)) {dev_err (dev,"SDMA queue already in use\n" );
@@ -1625,6 +1628,9 @@ static int allocate_sdma_queue(struct device_queue_manager *dqm,return -ENOMEM ; }if (restore_sdma_id) { +if (*restore_sdma_id >=get_num_xgmi_sdma_queues (dqm)) +return -EINVAL ; +/* Re-use existing sdma_id */ if (!test_bit (*restore_sdma_id, dqm->xgmi_sdma_bitmap)) {dev_err (dev,"SDMA queue already in use\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 135/1250 drm/amdkfd: Fix OOB memory exposure in get_wave_state()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sunday Clement <[email protected]>
[ Upstream commit 7ef144458f48d5589e36f1b3d83e83db2e5c5ba5 ]
The get_wave_state() function for v9 trusts cp_hqd_cntl_stack_size and cp_hqd_cntl_stack_offset values read directly from the MQD, which are written by GPU microcode and fully attacker-controlled on the CRIU-restore path (via AMDKFD_IOC_RESTORE_PROCESS with H3).
this leads to an unbounded copy_to_user() that can leak adjacent GTT/kernel memory. If offset > size, integer underflow produces a ~4 GiB read length, if size is set to 1 MiB against a 4 KiB allocation, we leak 1 MiB of adjacent kernel memory (other queues' MQDs, ring buffers, KASLR pointers).
Fix by clamping both cp_hqd_cntl_stack_size to the actual allocated buffer size (q->ctl_stack_size) and cp_hqd_cntl_stack_offset to the clamped size before performing arithmetic and copy_to_user().
This ensures we never read beyond the allocated kernel BO regardless of attacker-supplied MQD field values.
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +8 -3
@@ -341,11 +341,15 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd, {struct v9_mqd *m;struct kfd_context_save_area_header header; +u32 cntl_stack_size; +u32 cntl_stack_offset;/* Control stack is located one page after MQD. */ void *mqd_ctl_stack = (void *)((uintptr_t )mqd +PAGE_SIZE ); m =get_mqd (mqd); + cntl_stack_size =min_t (u32, m->cp_hqd_cntl_stack_size, q->ctl_stack_size); + cntl_stack_offset =min_t (u32, m->cp_hqd_cntl_stack_offset, cntl_stack_size); *ctl_stack_used_size = m->cp_hqd_cntl_stack_size - m->cp_hqd_cntl_stack_offset;
@@ -361,9 +365,10 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd,if (copy_to_user (ctl_stack, &header,sizeof (header.wave_state)))return -EFAULT ; -if (copy_to_user (ctl_stack + m->cp_hqd_cntl_stack_offset, - mqd_ctl_stack + m->cp_hqd_cntl_stack_offset, - *ctl_stack_used_size)) + *ctl_stack_used_size = cntl_stack_size - cntl_stack_offset; + +if (copy_to_user (ctl_stack + cntl_stack_offset, mqd_ctl_stack + cntl_stack_offset, + *ctl_stack_used_size))return -EFAULT ;return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 136/1250 drm/amdkfd: Check bounds on allocate_doorbell
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Francis <[email protected]>
[ Upstream commit 1f087bb8cf9e8797633da35c85435e557ef74d06 ]
allocated_doorbell has an option to set the doorbell id to a specific value (used by CRIU). This value was not bounds checked.
Check to confirm it's less than KFD_MAX_NUM_OF_QUEUES_PER_PROCESS.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3 -0
@@ -472,6 +472,9 @@ static int allocate_doorbell(struct qcm_process_device *qpd, }else {/* For CP queues on SOC15 */ if (restore_id) { +if (*restore_id >=KFD_MAX_NUM_OF_QUEUES_PER_PROCESS ) +return -EINVAL ; +/* make sure that ID is free */ if (__test_and_set_bit (*restore_id, qpd->doorbell_bitmap))return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 137/1250 ALSA: hda/ca0132: add QUIRK_GENERIC path for Gigabyte GA-Z170X-Gaming G1
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ezio Galeazzi <[email protected]>
[ Upstream commit e79615b05c78d19b085c8eb7971c82cb5b0f22d1 ]
Some CA0132 implementations (e.g. Gigabyte GA-Z170X-Gaming G1) produce white noise when using the DSP firmware path. Add a QUIRK_GENERIC path that uses the standard HDA generic parser instead, with custom pin configs.
This patch applies against v6.18.24.
--- sound/hda/codecs/Kconfig | 1 + sound/hda/codecs/ca0132.c | 111 +++++++++++++++++++++++++++++++++----- 2 files changed, 99 insertions(+), 13 deletions(-)
sound/hda/codecs/Kconfig +1 -0
@@ -69,6 +69,7 @@ comment "Set to Y if you want auto-loading the codec driver" config SND_HDA_CODEC_CA0132 tristate "Build Creative CA0132 codec support" + select SND_HDA_GENERIC help Say Y or M here to include Creative CA0132 codec support in snd-hda-intel driver.
sound/hda/codecs/ca0132.c +98 -13
198 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 138/1250 ALSA: ice1724: Fix blocking open for independent surround PCMs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit 1ab8e422dc779a91acba2d0aafc47b0db6680b4b ]
The independent surround playback open path rejects a substream when the matching PDMA channel is reserved by the multi-channel PDMA0 stream. It currently returns -EBUSY for that case, although the driver has carried a FIXME noting that blocking mode is not handled properly.
ALSA PCM open waits and retries only when the low-level open callback returns -EAGAIN. Returning -EBUSY therefore makes blocking opens fail immediately, the same as nonblocking opens.
Return -EAGAIN for the temporary PDMA0 reservation conflict. The PCM core continues to report -EBUSY for O_NONBLOCK callers, while blocking callers sleep and retry.
Also wake the independent surround PCM wait queue when hw_free releases a PDMA reservation. The reservation can be released by the pro PCM, while waiters are sleeping on the independent surround PCM, so waking the current substream PCM is not sufficient for this cross-PCM reservation.
--- sound/pci/ice1712/ice1724.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
sound/pci/ice1712/ice1724.c +14 -5
@@ -730,13 +730,22 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,static int snd_vt1724_pcm_hw_free (struct snd_pcm_substream *substream) {struct snd_ice1712 *ice =snd_pcm_substream_chip (substream); +bool released = false;int i; -guard (mutex)(&ice->open_mutex); -/* unmark surround channels */ -for (i =0 ; i <3 ; i++) -if (ice->pcm_reserved[i] == substream) + scoped_guard(mutex, &ice->open_mutex) { +/* unmark surround channels */ +for (i =0 ; i <3 ; i++) { +if (ice->pcm_reserved[i] != substream) +continue ; ice->pcm_reserved[i] =NULL ; + released = true; + } + } + +if (released && ice->pcm_ds) +wake_up (&ice->pcm_ds->open_wait); +return 0 ; }
@@ -1364,7 +1373,7 @@ static int snd_vt1724_playback_indep_open(struct snd_pcm_substream *substream) scoped_guard(mutex, &ice->open_mutex) {/* already used by PDMA0? */ if (ice->pcm_reserved[substream->number]) -return -EBUSY ;/* FIXME: should handle blocking mode properly */ +return -EAGAIN ; } runtime->private_data = (void *)&vt1724_playback_dma_regs[substream->number]; ice->playback_con_substream_ds[substream->number] = substream;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 139/1250 ALSA: usx2y: Drain pending US-428 pipe-4 output commands
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit 18977c0dd722f52217027ff75de2811c53cce2cc ]
The US-428 pipe-4 output path submits at most one pending p4out entry from the shared-memory ring per input interrupt. If userspace queues more than one command before the interrupt handler runs, later commands remain pending until later input interrupts, even when async pipe-4 URBs are available.
Drain pending entries while idle async URBs are available. Copy each command into the existing per-URB async buffer before submission, so the submitted transfer does not depend on a userspace-mapped ring slot remaining unchanged after p4out_sent is advanced.
Also update p4out_sent only after usb_submit_urb() succeeds, so a failed submission is not reported as sent.
This keeps the shared-memory ABI unchanged and fixes only the local queue-draining behavior.
--- sound/usb/usx2y/usbusx2y.c | 39 ++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-)
sound/usb/usx2y/usbusx2y.c +23 -16
@@ -180,7 +180,7 @@ static void i_usx2y_in04_int(struct urb *urb)struct usx2ydev *usx2y = urb->context;struct us428ctls_sharedmem *us428ctls = usx2y->us428ctls_sharedmem;struct us428_p4out *p4out; -int i, j, n, diff, send; +int i, j, n, diff, send, len; usx2y->in04_int_calls++;
@@ -222,24 +222,31 @@ static void i_usx2y_in04_int(struct urb *urb) }while (!err && usx2y->us04->submitted < usx2y->us04->len); } }else { -if (us428ctls && us428ctls->p4out_last >=0 && us428ctls->p4out_last <N_US428_P4OUT_BUFS ) { -if (us428ctls->p4out_last != us428ctls->p4out_sent) { - send = us428ctls->p4out_sent +1 ; -if (send >=N_US428_P4OUT_BUFS ) - send =0 ; -for (j =0 ; j <URBS_ASYNC_SEQ && !err; ++j) { -if (!usx2y->as04.urb[j]->status) { - p4out = us428ctls->p4out + send;// FIXME if more than 1 p4out is new, 1 gets lost. -usb_fill_bulk_urb (usx2y->as04.urb[j], usx2y->dev, -usb_sndbulkpipe (usx2y->dev,0x04 ), &p4out->val.vol, - p4out->type ==ELT_LIGHT ?sizeof (struct us428_lights ) :5 , - i_usx2y_out04_int, usx2y); - err =usb_submit_urb (usx2y->as04.urb[j],GFP_ATOMIC ); +while (us428ctls && + us428ctls->p4out_last >=0 && + us428ctls->p4out_last <N_US428_P4OUT_BUFS && + us428ctls->p4out_last != us428ctls->p4out_sent) { +for (j =0 ; j <URBS_ASYNC_SEQ && !err; ++j) { +if (!usx2y->as04.urb[j]->status) { + send = us428ctls->p4out_sent +1 ; +if (send >=N_US428_P4OUT_BUFS ) + send =0 ; + + p4out = us428ctls->p4out + send; + len = p4out->type ==ELT_LIGHT ? +sizeof (struct us428_lights ) :5 ; +memcpy (usx2y->as04.urb[j]->transfer_buffer, + &p4out->val.vol, len); + usx2y->as04.urb[j]->transfer_buffer_length = len; + err =usb_submit_urb (usx2y->as04.urb[j],GFP_ATOMIC ); +if (!err) us428ctls->p4out_sent = send; -break ; - } + +break ; } } +if (j >=URBS_ASYNC_SEQ || err) +break ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 140/1250 drm/amdgpu: use atomic operation to achieve lockless serialization
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sunil Khatri <[email protected]>
[ Upstream commit 4d50a14d346141e03a7c3905e496d91e048bc30c ]
In amdgpu_seq64_alloc there is a possibility that two difference cores from two separate NODES can try to and could get the same free slot. So this fixes that race here using atomic test_and_set clear operations.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c +8 -5
@@ -175,11 +175,14 @@ int amdgpu_seq64_alloc(struct amdgpu_device *adev, u64 *va, {unsigned long bit_pos; - bit_pos =find_first_zero_bit (adev->seq64.used, adev->seq64.num_sem); -if (bit_pos >= adev->seq64.num_sem) -return -ENOSPC ; +for (;;) { + bit_pos =find_first_zero_bit (adev->seq64.used, adev->seq64.num_sem); +if (bit_pos >= adev->seq64.num_sem) +return -ENOSPC ; -__set_bit (bit_pos, adev->seq64.used); +if (!test_and_set_bit (bit_pos, adev->seq64.used)) +break ; + } *va = bit_pos *sizeof (u64) +amdgpu_seq64_get_va_base (adev);
@@ -205,7 +208,7 @@ void amdgpu_seq64_free(struct amdgpu_device *adev, u64 va) bit_pos = (va -amdgpu_seq64_get_va_base (adev)) /sizeof (u64);if (bit_pos < adev->seq64.num_sem) -__clear_bit (bit_pos, adev->seq64.used); +clear_bit (bit_pos, adev->seq64.used); }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 141/1250 sched/fair: Reject misfit pulls onto busy SMT siblings on asym-capacity
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Righi <[email protected]>
[ Upstream commit bf6aa722198d3c06e4236e8c5a480f30a64e1513 ]
When SD_ASYM_CPUCAPACITY load balancing considers pulling a misfit task, capacity_of(dst_cpu) can overstate available compute if the SMT sibling is
busy: the core does not deliver its full nominal capacity.
If SMT is active and dst_cpu is not on a fully idle core, skip this destination so we do not migrate a misfit expecting a capacity upgrade we cannot actually provide.
--- kernel/sched/fair.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
kernel/sched/fair.c +10 -1
@@ -9498,6 +9498,7 @@ struct lb_env {int dst_cpu;struct rq *dst_rq; +bool dst_core_idle;struct cpumask *dst_grpmask;int new_dst_cpu;
@@ -10741,10 +10742,16 @@ static bool update_sd_pick_busiest(struct lb_env *env,* We can use max_capacity here as reduction in capacity on some * CPUs in the group should either be possible to resolve * internally or be covered by avg_load imbalance (eventually). +* +* When SMT is active, only pull a misfit to dst_cpu if it is on a +* fully idle core; otherwise the effective capacity of the core is +* reduced and we may not actually provide more capacity than the +* source. */ if ((env->sd->flags &SD_ASYM_CPUCAPACITY ) && (sgs->group_type == group_misfit_task) && - (!capacity_greater (capacity_of (env->dst_cpu), sg->sgc->max_capacity) || + (!env->dst_core_idle || + !capacity_greater (capacity_of (env->dst_cpu), sg->sgc->max_capacity) || sds->local_stat.group_type != group_has_spare))return false;
@@ -11311,6 +11318,8 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sdunsigned long sum_util =0 ;bool sg_overloaded =0 , sg_overutilized =0 ; + env->dst_core_idle = !sched_smt_active () ||is_core_idle (env->dst_cpu); + do { struct sg_lb_stats *sgs = &tmp_sgs; int local_group;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 142/1250 iommu: arm-smmu-qcom: Ensure smmu is powered up in set_ttbr0_cfg
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anna Maniscalco <[email protected]>
[ Upstream commit 8a0aab012b52b5c044ca3bec523e91f95dd40765 ]
arm_smmu_write_context_bank() assumes it is being called with RPM active, but it turns out that is not guaranteed in the path from qcom_adreno_smmu_set_ttbr0_cfg(), so it's possible for the register writes to get lost when configuring the context bank while the GPU is idle, leading to page faults later.
Add the RPM calls here to make sure the SMMU is active before we touch it.
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +9 -0
@@ -231,6 +231,7 @@ static int qcom_adreno_smmu_set_ttbr0_cfg(const void *cookie,struct io_pgtable *pgtable =io_pgtable_ops_to_pgtable (smmu_domain->pgtbl_ops);struct arm_smmu_cfg *cfg = &smmu_domain->cfg;struct arm_smmu_cb *cb = &smmu_domain->smmu->cbs[cfg->cbndx]; +int ret;/* The domain must have split pagetables already enabled */ if (cb->tcr[0 ] &ARM_SMMU_TCR_EPD1 )
@@ -260,8 +261,16 @@ static int qcom_adreno_smmu_set_ttbr0_cfg(const void *cookie, cb->ttbr[0 ] |=FIELD_PREP (ARM_SMMU_TTBRn_ASID, cb->cfg->asid); } + ret =pm_runtime_resume_and_get (smmu_domain->smmu->dev); +if (ret <0 ) { +dev_err (smmu_domain->smmu->dev,"failed to get runtime PM: %d\n" , ret); +return -ENODEV ; + } +arm_smmu_write_context_bank (smmu_domain->smmu, cb->cfg->cbndx); +pm_runtime_put_autosuspend (smmu_domain->smmu->dev); +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 143/1250 drm/imagination: Dont timeout job if its fence has been signaled
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brajesh Gupta <[email protected]>
[ Upstream commit ee7cb742531432ec1bb29b996e3363aacd860054 ]
Verify the job’s fence in the timeout handler; if the firmware has since signaled completion, then report NO HANG.
--- drivers/gpu/drm/imagination/pvr_queue.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/imagination/pvr_queue.c +6 -1
@@ -818,7 +818,9 @@ static void pvr_queue_start(struct pvr_queue *queue)* the scheduler, and re-assign parent fences in the middle. * * Return: -* * DRM_GPU_SCHED_STAT_RESET. +* *%DRM_GPU_SCHED_STAT_NO_HANG if the job fence has already been +* signaled, or +* *%DRM_GPU_SCHED_STAT_RESET otherwise. */ static enum drm_gpu_sched_stat pvr_queue_timedout_job (struct drm_sched_job *s_job)
@@ -829,6 +831,9 @@ pvr_queue_timedout_job(struct drm_sched_job *s_job)struct pvr_job *job;u32 job_count =0 ; +if (dma_fence_is_signaled (s_job->s_fence->parent)) +return DRM_GPU_SCHED_STAT_NO_HANG ; +dev_err (sched->dev,"Job timeout\n" );/* Before we stop the scheduler, make sure the queue is out of any list, so
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 144/1250 9p: invalidate readdir buffer on seek
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre Barre <[email protected]>
[ Upstream commit e661e17ddbed524b5fbda789a091b48b6b677067 ]
The per-fid readdir buffer (fid->rdir) is populated lazily and only refilled when fully drained (rdir->head == rdir->tail). userspace lseek() on a directory fd updates file->f_pos via generic_file_llseek() but does not touch the cached buffer, so the next getdents() iterates the stale cache and emits entries from the previous position instead of the one the caller asked for.
Track the file position the cached data corresponds to in struct p9_rdir, and drop the cache on entry to iterate_shared when it no longer matches ctx->pos. The 9p protocol's Tread/Treaddir already take an arbitrary offset on every request, so a refill at the new position is always legal; no .llseek override or seek restriction is needed.
Message-ID: <[email protected]>
--- fs/9p/vfs_dir.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/9p/vfs_dir.c +12 -0
@@ -27,6 +27,7 @@* struct p9_rdir - readdir accounting * @head: start offset of current dirread buffer * @tail: end offset of current dirread buffer +* @offset: file position the data at @head corresponds to * @buf: dirread buffer * * private structure for keeping track of readdir
@@ -36,6 +37,7 @@struct p9_rdir {int head;int tail; +loff_t offset;uint8_t buf[]; };
@@ -102,6 +104,9 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) kvec.iov_base = rdir->buf; kvec.iov_len = buflen; +if (rdir->head < rdir->tail && rdir->offset != ctx->pos) + rdir->head = rdir->tail =0 ; +while (1 ) {if (rdir->tail == rdir->head) {struct iov_iter to;
@@ -117,6 +122,7 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) rdir->head =0 ; rdir->tail = n; + rdir->offset = ctx->pos; }while (rdir->head < rdir->tail) { err = p9stat_read(fid->clnt, rdir->buf + rdir->head,
@@ -134,6 +140,7 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) rdir->head += err; ctx->pos += err; + rdir->offset = ctx->pos; } } }
@@ -161,6 +168,9 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx)if (!rdir)return -ENOMEM ; +if (rdir->head < rdir->tail && rdir->offset != ctx->pos) + rdir->head = rdir->tail =0 ; +while (1 ) {if (rdir->tail == rdir->head) { err = p9_client_readdir(fid, rdir->buf, buflen,
@@ -170,6 +180,7 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx) rdir->head =0 ; rdir->tail = err; + rdir->offset = ctx->pos; }while (rdir->head < rdir->tail) {
@@ -190,6 +201,7 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx) ctx->pos = curdirent.d_off; rdir->head += err; + rdir->offset = ctx->pos; } } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 145/1250 arm64: panic from init_IRQ if IRQ handler stacks cannot be allocated
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Osama Abdelkader <[email protected]>
[ Upstream commit 7dc6922f7fdd3496de4e7d8fb99284fc08f98003 ]
init_irq_stacks() and init_irq_scs() may fail when arch_alloc_vmap_stack or scs_alloc return NULL. Return -ENOMEM from both and call panic() once from init_IRQ(), covering per-CPU IRQ stacks and shadow IRQ stacks consistently.
--- arch/arm64/kernel/irq.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)
arch/arm64/kernel/irq.c +20 -9
@@ -10,6 +10,7 @@* Copyright (C) 2012 ARM Ltd. */ +#include <linux/errno.h> #include <linux/hardirq.h> #include <linux/init.h> #include <linux/irq.h>
@@ -32,34 +33,43 @@ DEFINE_PER_CPU(struct nmi_ctx, nmi_contexts); DEFINE_PER_CPU(unsigned long *, irq_stack_ptr); - DECLARE_PER_CPU(unsigned long *, irq_shadow_call_stack_ptr);#ifdef CONFIG_SHADOW_CALL_STACK DEFINE_PER_CPU(unsigned long *, irq_shadow_call_stack_ptr);#endif -static void init_irq_scs (void ) +static int __init init_irq_scs (void ) {int cpu; +void *s;if (!scs_is_enabled ()) -return ; +return 0 ; + +for_each_possible_cpu (cpu) { + s =scs_alloc (early_cpu_to_node (cpu)); +if (!s) +return -ENOMEM ; +per_cpu (irq_shadow_call_stack_ptr, cpu) = s; + } -for_each_possible_cpu (cpu) -per_cpu (irq_shadow_call_stack_ptr, cpu) = -scs_alloc (early_cpu_to_node (cpu)); +return 0 ; } -static void __init init_irq_stacks (void ) +static int __init init_irq_stacks (void ) {int cpu;unsigned long *p;for_each_possible_cpu (cpu) { p =arch_alloc_vmap_stack (IRQ_STACK_SIZE ,early_cpu_to_node (cpu)); +if (!p) +return -ENOMEM ;per_cpu (irq_stack_ptr, cpu) = p; } + +return 0 ; }#ifndef CONFIG_PREEMPT_RT
@@ -109,8 +119,9 @@ int __init set_handle_fiq(void (*handle_fiq)(struct pt_regs *))void __init init_IRQ (void ) { -init_irq_stacks (); -init_irq_scs (); +if (init_irq_stacks () ||init_irq_scs ()) +panic ("Failed to allocate IRQ stack resources\n" ); +irqchip_init ();if (system_uses_irq_prio_masking ()) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 146/1250 arm64/daifflags: Make local_daif_*() helpers __always_inline
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leonardo Bras <[email protected]>
[ Upstream commit 827ce94e0897a70241abf810b1d3d7d083053a39 ]
Make sure those helpers are always inlined and instrumentation safe.
--- arch/arm64/include/asm/daifflags.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm64/include/asm/daifflags.h +5 -5
@@ -19,7 +19,7 @@/* mask/save/unmask/restore all exceptions, including interrupts. */ -static inline void local_daif_mask (void ) +static __always_inline void local_daif_mask(void) { WARN_ON(system_has_prio_mask_debugging() && (read_sysreg_s(SYS_ICC_PMR_EL1) == (GIC_PRIO_IRQOFF |
@@ -38,7 +38,7 @@ static inline void local_daif_mask(void)trace_hardirqs_off (); } -static inline unsigned long local_daif_save_flags (void ) +static __always_inline unsigned long local_daif_save_flags (void ) {unsigned long flags;
@@ -53,7 +53,7 @@ static inline unsigned long local_daif_save_flags(void)return flags; } -static inline unsigned long local_daif_save (void ) +static __always_inline unsigned long local_daif_save (void ) {unsigned long flags;
@@ -64,7 +64,7 @@ static inline unsigned long local_daif_save(void)return flags; } -static inline void local_daif_restore (unsigned long flags) +static __always_inline void local_daif_restore(unsigned long flags) {bool irq_disabled = flags &PSR_I_BIT ;
@@ -124,7 +124,7 @@ static inline void local_daif_restore(unsigned long flags)* Called by synchronous exception handlers to restore the DAIF bits that were * modified by taking an exception. */ -static inline void local_daif_inherit (struct pt_regs *regs) +static __always_inline void local_daif_inherit(struct pt_regs *regs) {unsigned long flags = regs->pstate &DAIF_MASK ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 147/1250 drm/imagination: Populate FW common context ID before passing to the FW
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brajesh Gupta <[email protected]>
[ Upstream commit de1e8a590f4ed48b6b7902fc3aafc878262f8278 ]
Initialise the context ID for the FW common context correctly by moving the context allocation earlier.
--- drivers/gpu/drm/imagination/pvr_context.c | 30 ++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/gpu/drm/imagination/pvr_context.c +16 -14
@@ -320,10 +320,14 @@ int pvr_context_create(struct pvr_file *pvr_file, struct drm_pvr_ioctl_create_co goto err_put_vm; } - err =pvr_context_create_queues (ctx, args, ctx->data); + err =xa_alloc (&pvr_dev->ctx_ids, &ctx->ctx_id, ctx, xa_limit_32b,GFP_KERNEL );if (err) goto err_free_ctx_data; + err =pvr_context_create_queues (ctx, args, ctx->data); +if (err) + goto err_free_ctx_id; + err =init_fw_objs (ctx, args, ctx->data);if (err) goto err_destroy_queues;
@@ -331,23 +335,12 @@ int pvr_context_create(struct pvr_file *pvr_file, struct drm_pvr_ioctl_create_co err =pvr_fw_object_create (pvr_dev, ctx_size,PVR_BO_FW_FLAGS_DEVICE_UNCACHED , ctx_fw_data_init, ctx, &ctx->fw_obj);if (err) - goto err_free_ctx_data; + goto err_destroy_queues; - err =xa_alloc (&pvr_dev->ctx_ids, &ctx->ctx_id, ctx, xa_limit_32b,GFP_KERNEL ); + err =xa_alloc (&pvr_file->ctx_handles, &args->handle, ctx, xa_limit_32b,GFP_KERNEL );if (err) goto err_destroy_fw_obj; - err =xa_alloc (&pvr_file->ctx_handles, &args->handle, ctx, xa_limit_32b,GFP_KERNEL ); -if (err) { -/* -* It's possible that another thread could have taken a reference on the context at -* this point as it is in the ctx_ids xarray. Therefore instead of directly -* destroying the context, drop a reference instead. -*/ -pvr_context_put (ctx); -return err; - } -spin_lock (&pvr_dev->ctx_list_lock);list_add_tail (&ctx->file_link, &pvr_file->contexts);spin_unlock (&pvr_dev->ctx_list_lock);
@@ -360,6 +353,15 @@ int pvr_context_create(struct pvr_file *pvr_file, struct drm_pvr_ioctl_create_co err_destroy_queues:pvr_context_destroy_queues (ctx, true); +err_free_ctx_id: +/* +* Ctx_id is not exposed to userspace and not visible yet within +* the kernel/FW, plus a matching context handle (exposed to userspace) +* hasn't been allocated yet, so it is safe to remove ctx_id +* from the ctx_ids xarray. +*/ +xa_erase (&pvr_dev->ctx_ids, ctx->ctx_id); + err_free_ctx_data:kfree (ctx->data);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 148/1250 9p: use kvzalloc for readdir buffer
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre Barre <[email protected]>
[ Upstream commit b4d71bea144550ff4a0917f8c4b06d4063eb27a6 ]
The readdir buffer is sized to msize, so kzalloc() can fail under fragmentation with a page allocation failure in v9fs_alloc_rdir_buf() / v9fs_dir_readdir_dotl().
The buffer is only a response sink and is never pack_sg_list()'d, so kvzalloc() is safe for all transports, unlike the fcall buffers fixed in e21d451a82f3 ("9p: Use kvmalloc for message buffers on supported transports").
Message-ID: <[email protected]>
--- fs/9p/vfs_dir.c | 2 +- net/9p/client.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/9p/vfs_dir.c +1 -1
@@ -72,7 +72,7 @@ static struct p9_rdir *v9fs_alloc_rdir_buf(struct file *filp, int buflen)struct p9_fid *fid = filp->private_data;if (!fid->rdir) - fid->rdir =kzalloc (sizeof (struct p9_rdir ) + buflen,GFP_KERNEL ); + fid->rdir =kvzalloc (sizeof (struct p9_rdir ) + buflen,GFP_KERNEL );return fid->rdir; }
net/9p/client.c +1 -1
@@ -890,7 +890,7 @@ static void p9_fid_destroy(struct p9_fid *fid)spin_lock_irqsave (&clnt->lock, flags);idr_remove (&clnt->fids, fid->fid);spin_unlock_irqrestore (&clnt->lock, flags); -kfree (fid->rdir); +kvfree (fid->rdir);kfree (fid); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 149/1250 drm/amd/ras: reset CPER ring on corrupt entry size
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Liu <[email protected]>
[ Upstream commit 4d695e66d7027a0c78302e47ac76293675fbbb4d ]
When CPER ring overflow handling advances the read pointer, it trusts the parsed entry size from the current ring contents. Corrupt CPER data can produce an entry size that does not advance rptr after dword conversion and pointer masking.
In that case the recovery loop keeps testing the same location while holding the CPER ring mutex. This can hang the worker that is writing the next CPER record.
Detect a no-progress rptr update and reset the CPER ring to an empty state instead. This drops the corrupt contents and lets the writer leave the recovery path without spinning.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c +16 -4
@@ -465,7 +465,7 @@ static u32 amdgpu_cper_ring_get_ent_sz(struct amdgpu_ring *ring, u64 pos)void amdgpu_cper_ring_write (struct amdgpu_ring *ring,void *src,int count) { -u64 pos, wptr_old, rptr; +u64 pos, wptr_old, rptr, next_rptr;int rec_cnt_dw = count >>2 ;u32 chunk, ent_sz;u8 *s = (u8 *)src;
@@ -506,9 +506,19 @@ void amdgpu_cper_ring_write(struct amdgpu_ring *ring, void *src, int count) do { ent_sz = amdgpu_cper_ring_get_ent_sz(ring, pos); - - rptr += (ent_sz >> 2); - rptr &= ring->ptr_mask; + next_rptr = rptr; + if (ent_sz >= sizeof(u32)) + next_rptr = (rptr + (ent_sz >> 2)) & ring->ptr_mask; + + if (next_rptr == rptr) { + /* Corrupt entry size, reset the ring to avoid an infinite loop. */ + rptr = ring->wptr; + *ring->rptr_cpu_addr = rptr; + ring->count_dw = (ring->ring_size - 4) >> 2; + goto out_unlock; + } + + rptr = next_rptr; *ring->rptr_cpu_addr = rptr; pos = rptr;
@@ -517,6 +527,8 @@ void amdgpu_cper_ring_write(struct amdgpu_ring *ring, void *src, int count)if (ring->count_dw >= rec_cnt_dw) ring->count_dw -= rec_cnt_dw; + +out_unlock:mutex_unlock (&ring->adev->cper.ring_lock); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 150/1250 drm/amdgpu: cap ATOM command table nesting depth
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Candice Li <[email protected]>
[ Upstream commit 27ef1795bc4e47cae838e0a3ced531c549f9b23d ]
Cap nesting at 32 levels with execute_depth and return -ELOOP when exceeded.
--- drivers/gpu/drm/amd/amdgpu/atom.c | 11 +++++++++++ drivers/gpu/drm/amd/amdgpu/atom.h | 3 +++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/atom.c +11 -0
@@ -59,6 +59,9 @@#define ATOM_CMD_TIMEOUT_SEC 20 +/* Limit ATOM command table recursion (calltable) to avoid kernel stack overflow. */ +#define ATOM_EXECUTE_MAX_DEPTH 32 + typedef struct { struct atom_context *ctx; uint32_t *ps, *ws;
@@ -1229,6 +1232,13 @@ static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index,if (!base)return -EINVAL ; +if (ctx->execute_depth >=ATOM_EXECUTE_MAX_DEPTH ) { +DRM_ERROR ("atombios command table nesting exceeded limit (%u)\n" , +ATOM_EXECUTE_MAX_DEPTH ); +return -ELOOP ; + } + ctx->execute_depth++; + len =CU16 (base +ATOM_CT_SIZE_PTR ); ws =CU8 (base +ATOM_CT_WS_PTR ); ps =CU8 (base +ATOM_CT_PS_PTR ) &ATOM_CT_PS_MASK ;
@@ -1285,6 +1295,7 @@ static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index, free:if (ws)kfree (ectx.ws); + ctx->execute_depth--;return ret; }
drivers/gpu/drm/amd/amdgpu/atom.h +3 -0
@@ -153,6 +153,9 @@ struct atom_context {uint8_t vbios_ver_str[STRLEN_NORMAL ];uint8_t date[STRLEN_NORMAL ];uint8_t build_num[STRLEN_NORMAL ]; + +/* Nesting depth for ATOM_OP_CALLTABLE */ +unsigned int execute_depth; };extern int amdgpu_atom_debug;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 151/1250 drm/amdgpu: validate and share PSP fw_pri_buf copies via psp_copy_fw
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Candice Li <[email protected]>
[ Upstream commit d1f9f5839bd785a3a06335a01d53282e80f8e5fa ]
Change psp_copy_fw from void to int: return -ENODEV when drm_dev_enter fails, and -EINVAL when the image size is zero or larger than the 1 MiB PSP private buffer.
Replace open-coded memset/memcpy into fw_pri_buf with psp_copy_fw.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 32 ++++++++++++++++++------ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 8 ++++-- drivers/gpu/drm/amd/amdgpu/psp_v12_0.c | 8 ++++-- drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 14 +++++------ drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c | 14 +++++------ drivers/gpu/drm/amd/amdgpu/psp_v14_0.c | 14 +++++------ drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | 8 ++++-- 8 files changed, 62 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +25 -7
@@ -838,7 +838,11 @@ static int psp_load_toc(struct psp_context *psp,struct psp_gfx_cmd_resp *cmd =acquire_psp_cmd_buf (psp);/* Copy toc to psp firmware private buffer */ -psp_copy_fw (psp, psp->toc.start_addr, psp->toc.size_bytes); + ret =psp_copy_fw (psp, psp->toc.start_addr, psp->toc.size_bytes); +if (ret) { +release_psp_cmd_buf (psp); +return ret; + }psp_prep_load_toc_cmd_buf (cmd, psp->fw_pri_mc_addr, psp->toc.size_bytes);
@@ -1165,8 +1169,11 @@ static int psp_rl_load(struct amdgpu_device *adev) cmd =acquire_psp_cmd_buf (psp); -memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); -memcpy (psp->fw_pri_buf, psp->rl.start_addr, psp->rl.size_bytes); + ret =psp_copy_fw (psp, psp->rl.start_addr, psp->rl.size_bytes); +if (ret) { +release_psp_cmd_buf (psp); +return ret; + } cmd->cmd_id =GFX_CMD_ID_LOAD_IP_FW ; cmd->cmd.cmd_load_ip_fw.fw_phy_addr_lo =lower_32_bits (psp->fw_pri_mc_addr);
@@ -1389,8 +1396,12 @@ int psp_ta_load(struct psp_context *psp, struct ta_context *context) cmd =acquire_psp_cmd_buf (psp); -psp_copy_fw (psp, context->bin_desc.start_addr, - context->bin_desc.size_bytes); + ret =psp_copy_fw (psp, context->bin_desc.start_addr, + context->bin_desc.size_bytes); +if (ret) { +release_psp_cmd_buf (psp); +return ret; + }if (amdgpu_virt_xgmi_migrate_enabled (psp->adev) && context->mem_context.shared_bo)
@@ -4160,17 +4171,24 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,return count; } -void psp_copy_fw (struct psp_context *psp,uint8_t *start_addr,uint32_t bin_size) +int psp_copy_fw (struct psp_context *psp,uint8_t *start_addr,uint32_t bin_size) {int idx;if (!drm_dev_enter (adev_to_drm (psp->adev), &idx)) -return ; +return -ENODEV ; + +if (!bin_size || bin_size >PSP_1_MEG ) { +dev_err (psp->adev->dev,"PSP firmware is invalid\n" ); +drm_dev_exit (idx); +return -EINVAL ; + }memset (psp->fw_pri_buf,0 ,PSP_1_MEG );memcpy (psp->fw_pri_buf, start_addr, bin_size);drm_dev_exit (idx); +return 0 ; }/**
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +1 -1
@@ -605,7 +605,7 @@ int psp_get_fw_attestation_records_addr(struct psp_context *psp,int psp_update_fw_reservation (struct psp_context *psp);int psp_load_fw_list (struct psp_context *psp,struct amdgpu_firmware_info **ucode_list,int ucode_count); -void psp_copy_fw (struct psp_context *psp,uint8_t *start_addr,uint32_t bin_size); +int psp_copy_fw (struct psp_context *psp,uint8_t *start_addr,uint32_t bin_size);int psp_spatial_partition (struct psp_context *psp,int mode);int psp_memory_partition (struct psp_context *psp,int mode);
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +6 -2
@@ -217,7 +217,9 @@ static int psp_v11_0_bootloader_load_component(struct psp_context *psp,return ret;/* Copy PSP System Driver binary to memory */ -psp_copy_fw (psp, bin_desc->start_addr, bin_desc->size_bytes); + ret =psp_copy_fw (psp, bin_desc->start_addr, bin_desc->size_bytes); +if (ret) +return ret;/* Provide the sys driver to bootloader */ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
@@ -263,7 +265,9 @@ static int psp_v11_0_bootloader_load_sos(struct psp_context *psp)return ret;/* Copy Secure OS binary to PSP memory */ -psp_copy_fw (psp, psp->sos.start_addr, psp->sos.size_bytes); + ret =psp_copy_fw (psp, psp->sos.start_addr, psp->sos.size_bytes); +if (ret) +return ret;/* Provide the PSP secure OS to bootloader */ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +6 -2
@@ -87,7 +87,9 @@ static int psp_v12_0_bootloader_load_sysdrv(struct psp_context *psp)return ret;/* Copy PSP System Driver binary to memory */ -psp_copy_fw (psp, psp->sys.start_addr, psp->sys.size_bytes); + ret =psp_copy_fw (psp, psp->sys.start_addr, psp->sys.size_bytes); +if (ret) +return ret;/* Provide the sys driver to bootloader */ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
@@ -123,7 +125,9 @@ static int psp_v12_0_bootloader_load_sos(struct psp_context *psp)return ret;/* Copy Secure OS binary to PSP memory */ -psp_copy_fw (psp, psp->sos.start_addr, psp->sos.size_bytes); + ret =psp_copy_fw (psp, psp->sos.start_addr, psp->sos.size_bytes); +if (ret) +return ret;/* Provide the PSP secure OS to bootloader */ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +6 -8
@@ -265,10 +265,9 @@ static int psp_v13_0_bootloader_load_component(struct psp_context *psp,if (ret)return ret; -memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); - -/* Copy PSP KDB binary to memory */ -memcpy (psp->fw_pri_buf, bin_desc->start_addr, bin_desc->size_bytes); + ret =psp_copy_fw (psp, bin_desc->start_addr, bin_desc->size_bytes); +if (ret) +return ret;/* Provide the PSP KDB to bootloader */ WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36,
@@ -347,10 +346,9 @@ static int psp_v13_0_bootloader_load_sos(struct psp_context *psp)if (ret)return ret; -memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); - -/* Copy Secure OS binary to PSP memory */ -memcpy (psp->fw_pri_buf, psp->sos.start_addr, psp->sos.size_bytes); + ret =psp_copy_fw (psp, psp->sos.start_addr, psp->sos.size_bytes); +if (ret) +return ret;/* Provide the PSP secure OS to bootloader */ WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36,
drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c +6 -8
@@ -105,10 +105,9 @@ static int psp_v13_0_4_bootloader_load_component(struct psp_context *psp,if (ret)return ret; -memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); - -/* Copy PSP KDB binary to memory */ -memcpy (psp->fw_pri_buf, bin_desc->start_addr, bin_desc->size_bytes); + ret =psp_copy_fw (psp, bin_desc->start_addr, bin_desc->size_bytes); +if (ret) +return ret;/* Provide the PSP KDB to bootloader */ WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36,
@@ -168,10 +167,9 @@ static int psp_v13_0_4_bootloader_load_sos(struct psp_context *psp)if (ret)return ret; -memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); - -/* Copy Secure OS binary to PSP memory */ -memcpy (psp->fw_pri_buf, psp->sos.start_addr, psp->sos.size_bytes); + ret =psp_copy_fw (psp, psp->sos.start_addr, psp->sos.size_bytes); +if (ret) +return ret;/* Provide the PSP secure OS to bootloader */ WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36,
drivers/gpu/drm/amd/amdgpu/psp_v14_0.c +6 -8
@@ -140,10 +140,9 @@ static int psp_v14_0_bootloader_load_component(struct psp_context *psp,if (ret)return ret; -memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); - -/* Copy PSP KDB binary to memory */ -memcpy (psp->fw_pri_buf, bin_desc->start_addr, bin_desc->size_bytes); + ret =psp_copy_fw (psp, bin_desc->start_addr, bin_desc->size_bytes); +if (ret) +return ret;/* Provide the PSP KDB to bootloader */ WREG32_SOC15(MP0, 0, regMPASP_SMN_C2PMSG_36,
@@ -214,10 +213,9 @@ static int psp_v14_0_bootloader_load_sos(struct psp_context *psp)if (ret)return ret; -memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); - -/* Copy Secure OS binary to PSP memory */ -memcpy (psp->fw_pri_buf, psp->sos.start_addr, psp->sos.size_bytes); + ret =psp_copy_fw (psp, psp->sos.start_addr, psp->sos.size_bytes); +if (ret) +return ret;/* Provide the PSP secure OS to bootloader */ WREG32_SOC15(MP0, 0, regMPASP_SMN_C2PMSG_36,
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +6 -2
@@ -96,7 +96,9 @@ static int psp_v3_1_bootloader_load_sysdrv(struct psp_context *psp)return ret;/* Copy PSP System Driver binary to memory */ -psp_copy_fw (psp, psp->sys.start_addr, psp->sys.size_bytes); + ret =psp_copy_fw (psp, psp->sys.start_addr, psp->sys.size_bytes); +if (ret) +return ret;/* Provide the sys driver to bootloader */ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
@@ -135,7 +137,9 @@ static int psp_v3_1_bootloader_load_sos(struct psp_context *psp)return ret;/* Copy Secure OS binary to PSP memory */ -psp_copy_fw (psp, psp->sos.start_addr, psp->sos.size_bytes); + ret =psp_copy_fw (psp, psp->sos.start_addr, psp->sos.size_bytes); +if (ret) +return ret;/* Provide the PSP secure OS to bootloader */ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 152/1250 drm/amdgpu: add first record offset check
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gangliang Xie <[email protected]>
[ Upstream commit 4073cdf6713b7c170e35bf055354580cc52085d6 ]
check the upper and lower limits of first record offset
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +8 -0
@@ -1439,6 +1439,14 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control) } control->ras_fri =RAS_OFFSET_TO_INDEX (control, hdr->first_rec_offset); +if (hdr->first_rec_offset < control->ras_record_offset || + control->ras_fri >= control->ras_max_record_count) { +dev_err (adev->dev, +"RAS header invalid, ras_fri: %u, first_rec_offset:0x%x" , + control->ras_fri, hdr->first_rec_offset); +return -EINVAL ; + } + control->ras_num_mca_recs =0 ; control->ras_num_pa_recs =0 ;return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 153/1250 drm/amdgpu: Bound GPIO I2C table entry count from VBIOS
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Candice Li <[email protected]>
[ Upstream commit a99cd231cd924b7160fecb9fb3a94b801522323b ]
Reject undersized tables and cap the derived entry count to AMDGPU_MAX_I2C_BUS so we do not overrun adev->i2c_bus[] or walk an absurd number of entries on corrupt size fields.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 24 +++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +18 -6
@@ -36,6 +36,21 @@#include "atombios_encoders.h" #include "bif/bif_4_1_d.h" +/* VBIOS-reported table size is unchecked against the image; cap iterations and +* adev->i2c_bus[] indexing to AMDGPU_MAX_I2C_BUS. +*/ +static int amdgpu_atombios_gpio_i2c_num_entries (uint16_t size) +{ +u32 bytes; + +if (size <sizeof (ATOM_COMMON_TABLE_HEADER )) +return 0 ; + + bytes = size -sizeof (ATOM_COMMON_TABLE_HEADER ); +return (int )min_t (u32, bytes /sizeof (ATOM_GPIO_I2C_ASSIGMENT ), +AMDGPU_MAX_I2C_BUS ); +} +static struct amdgpu_i2c_bus_rec amdgpu_atombios_get_bus_rec_for_i2c_gpio (ATOM_GPIO_I2C_ASSIGMENT *gpio) {struct amdgpu_i2c_bus_rec i2c;
@@ -96,8 +111,7 @@ struct amdgpu_i2c_bus_rec amdgpu_atombios_lookup_i2c_gpio(struct amdgpu_device *if (amdgpu_atom_parse_data_header (ctx, index, &size,NULL ,NULL , &data_offset)) { i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); - num_indices = (size -sizeof (ATOM_COMMON_TABLE_HEADER )) / -sizeof (ATOM_GPIO_I2C_ASSIGMENT ); + num_indices =amdgpu_atombios_gpio_i2c_num_entries (size); gpio = &i2c_info->asGPIO_Info[0 ];for (i =0 ; i < num_indices; i++) {
@@ -127,8 +141,7 @@ void amdgpu_atombios_i2c_init(struct amdgpu_device *adev)if (amdgpu_atom_parse_data_header (ctx, index, &size,NULL ,NULL , &data_offset)) { i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); - num_indices = (size -sizeof (ATOM_COMMON_TABLE_HEADER )) / -sizeof (ATOM_GPIO_I2C_ASSIGMENT ); + num_indices =amdgpu_atombios_gpio_i2c_num_entries (size); gpio = &i2c_info->asGPIO_Info[0 ];for (i =0 ; i < num_indices; i++) {
@@ -158,8 +171,7 @@ void amdgpu_atombios_oem_i2c_init(struct amdgpu_device *adev, u8 i2c_id)if (amdgpu_atom_parse_data_header (ctx, index, &size,NULL ,NULL , &data_offset)) { i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); - num_indices = (size -sizeof (ATOM_COMMON_TABLE_HEADER )) / -sizeof (ATOM_GPIO_I2C_ASSIGMENT ); + num_indices =amdgpu_atombios_gpio_i2c_num_entries (size); gpio = &i2c_info->asGPIO_Info[0 ];for (i =0 ; i < num_indices; i++) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 154/1250 drm/amdgpu: avoid integer overflow in VA range check
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ce Sun <[email protected]>
[ Upstream commit cc768f4dd0bb9083c813683eeec44fc23921f771 ]
The original addition operation in 64-bit unsigned type may encounter overflow situations. To prevent such issues and safely reject invalid inputs, the check_add_overflow() function is used.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 -2
@@ -839,7 +839,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,struct dma_fence_chain *timeline_chain =NULL ;struct dma_fence *fence;struct drm_exec exec; -uint64_t vm_size; +uint64_t vm_size, tmp;int r =0 ;/* Validate virtual address range against reserved regions. */
@@ -863,7 +863,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, vm_size = adev->vm_manager.max_pfn *AMDGPU_GPU_PAGE_SIZE ; vm_size -=AMDGPU_VA_RESERVED_TOP ; -if (args->va_address + args->map_size > vm_size) { +if (check_add_overflow (args->va_address, args->map_size, &tmp) || tmp > vm_size) {dev_dbg (dev->dev,"va_address 0x%llx is in top reserved area 0x%llx\n" , args->va_address + args->map_size, vm_size);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 155/1250 drm/amdgpu: check and drop invalid bad page records
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: YiPeng Chai <[email protected]>
[ Upstream commit 3999aa4a04a04167d70bfe4dc3ba239257e5b5df ]
Check and drop invalid bad page records.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +27 -0
@@ -2884,6 +2884,25 @@ static int amdgpu_ras_mca2pa(struct amdgpu_device *adev,return -EINVAL ; } +static bool __check_record_in_range (struct amdgpu_device *adev, +struct eeprom_table_record *bps,int count) +{ +int i; + +for (i =0 ; i < count; i++) { +if (bps[i].retired_page >= + (adev->gmc.real_vram_size >>AMDGPU_GPU_PAGE_SHIFT )) { +dev_warn (adev->dev, +"Recorded address out of range: 0x%llx, 0x%llx, 0x%x, 0x%x\n" , + bps[i].address, bps[i].retired_page, + bps[i].mem_channel, bps[i].mcumc_id); +return false; + } + } + +return true; +} +static int __amdgpu_ras_restore_bad_pages (struct amdgpu_device *adev,struct eeprom_table_record *bps,int count) {
@@ -2891,6 +2910,9 @@ static int __amdgpu_ras_restore_bad_pages(struct amdgpu_device *adev,struct amdgpu_ras *con =amdgpu_ras_get_context (adev);struct ras_err_handler_data *data = con->eh_data; +if (!__check_record_in_range (adev, bps, count)) +return 0 ; +for (j =0 ; j < count; j++) {if (!data->space_left &&amdgpu_ras_realloc_eh_data_space (adev, data,256 )) {
@@ -5370,6 +5392,11 @@ int amdgpu_ras_reserve_page(struct amdgpu_device *adev, uint64_t pfn)uint64_t start = pfn <<AMDGPU_GPU_PAGE_SHIFT ;int ret =0 ; +if (pfn >= (adev->gmc.real_vram_size >>AMDGPU_GPU_PAGE_SHIFT )) { +dev_warn (adev->dev,"Ignoring out-of-range bad page 0x%llx" , start); +return 0 ; + } +if (amdgpu_ras_check_critical_address (adev, start))return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 156/1250 bridge: Add missing READ_ONCE() annotations around FDB destination port
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit bcdfd9fb109e0c9d76c345b2346b6b75ed1f476d ]
When roaming, the FDB destination port can change without holding the bridge's hash lock. Therefore, add missing READ_ONCE() annotations in both RCU readers and readers that hold the lock. In the latter case, the annotation is not needed in places where the FDB entry was already validated to be a local entry since such entries cannot roam.
--- net/bridge/br_device.c | 2 +- net/bridge/br_fdb.c | 7 ++++--- net/bridge/br_input.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-)
net/bridge/br_device.c +1 -1
@@ -107,7 +107,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)else br_flood (br, skb,BR_PKT_MULTICAST , false, true, vid); }else if ((dst =br_fdb_find_rcu (br, dest, vid)) !=NULL ) { -br_forward (dst->dst, skb, false, true); +br_forward (READ_ONCE (dst->dst), skb, false, true); }else {br_flood (br, skb,BR_PKT_UNICAST , false, true, vid); }
net/bridge/br_fdb.c +4 -3
@@ -470,7 +470,8 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)spin_lock_bh (&br->hash_lock); vg =nbp_vlan_group (p);hlist_for_each_entry (f, &br->fdb_list, fdb_node) { -if (f->dst == p &&test_bit (BR_FDB_LOCAL , &f->flags) && +if (READ_ONCE (f->dst) == p && +test_bit (BR_FDB_LOCAL , &f->flags) && !test_bit (BR_FDB_ADDED_BY_USER , &f->flags)) {/* delete old one */ fdb_delete_local (br, p, f);
@@ -878,7 +879,7 @@ void br_fdb_delete_by_port(struct net_bridge *br,spin_lock_bh (&br->hash_lock);hlist_for_each_entry_safe (f, tmp, &br->fdb_list, fdb_node) { -if (f->dst != p) +if (READ_ONCE (f->dst) != p)continue ;if (!do_all)
@@ -1660,7 +1661,7 @@ void br_fdb_clear_offload(const struct net_device *dev, u16 vid)spin_lock_bh (&p->br->hash_lock);hlist_for_each_entry (f, &p->br->fdb_list, fdb_node) { -if (f->dst == p && f->key.vlan_id == vid) +if (READ_ONCE (f->dst) == p && f->key.vlan_id == vid)clear_bit (BR_FDB_OFFLOADED , &f->flags); }spin_unlock_bh (&p->br->hash_lock);
net/bridge/br_input.c +1 -1
@@ -223,7 +223,7 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skbif (now !=READ_ONCE (dst->used))WRITE_ONCE (dst->used, now); -br_forward (dst->dst, skb, local_rcv, false); +br_forward (READ_ONCE (dst->dst), skb, local_rcv, false); }else {if (!mcast_hit)br_flood (br, skb, pkt_type, local_rcv, false, vid);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 157/1250 thunderbolt: Dont access path config space on Lane 1 adapters in tb_switch_reset_host()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pooja Katiyar <[email protected]>
[ Upstream commit 95c4379e37a0abea72dfd389cfe2c54452523690 ]
USB4 Lane 1 adapters do not have accessible path config space. Skip the path config space cleanup in tb_switch_reset_host() for these ports. The check is for USB4 switches only. Thunderbolt 1-3 Lane 1 adapters stay as is because we do need to program their path config space.
--- drivers/thunderbolt/switch.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/thunderbolt/switch.c +6 -0
@@ -1601,6 +1601,12 @@ static int tb_switch_reset_host(struct tb_switch *sw) ret =tb_port_reset (port);if (ret)return ret; +/* +* USB4 Lane 1 adapters do not have accessible +* path config space. +*/ +if (tb_switch_is_usb4 (sw) && !port->usb4) +continue ; }else if (tb_port_is_usb3_down (port) ||tb_port_is_usb3_up (port)) {tb_usb3_port_enable (port, false);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 158/1250 thunderbolt: Improve multi-display DisplayPort tunnel allocation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Borzeszkowski <[email protected]>
[ Upstream commit afe9021d63b46233f5c87d52b820fa26e7f562cd ]
When 3 monitors are connected through Thunderbolt dock to the system at once, one of the monitors might fail to establish DisplayPort tunnel. This happens during DP bandwidth negotiation - each monitor takes maximum bandwidth that is supported and there might not be enough for 3rd display. In this case Thunderbolt driver drops DP tunnel and 'forgets' about it but with DP bandwidth allocation mode, that comes in later, some bandwidth might be freed.
Make Thunderbolt driver check again if DP tunnel can be established after DP bandwidth consumption changed.
--- drivers/thunderbolt/tb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/thunderbolt/tb.c +3 -0
@@ -2847,6 +2847,9 @@ static void tb_handle_dp_bandwidth_request(struct work_struct *work)/* Update other clients about the allocation change */ tb_recalc_estimated_bandwidth (tb); + +tb_dbg (tb,"checking if more DP tunnels can be established now\n" ); +tb_tunnel_dp (tb); } put_sw:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 159/1250 thunderbolt: Verify PCIe adapter in detect state before tunnel setup
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gil Fine <[email protected]>
[ Upstream commit 69a7b98770b7e80deec0465d97710611a0e51774 ]
The USB4 Connection Manager guide suggests that a PCIe downstream and PCIe upstream adapters of the USB4 router is in the Detect state before setting up a PCIe tunnel.
Add this check by verifying the LTSSM field in ADP_PCIE_CS_0 before tunnel setup.
--- drivers/thunderbolt/tb.h | 1 + drivers/thunderbolt/tb_regs.h | 15 +++++++++++++++ drivers/thunderbolt/tunnel.c | 35 +++++++++++++++++++++++++++++++++++ drivers/thunderbolt/usb4.c | 24 ++++++++++++++++++++++++ 4 files changed, 75 insertions(+)
drivers/thunderbolt/tb.h +1 -0
@@ -1478,6 +1478,7 @@ int usb4_dp_port_allocate_bandwidth(struct tb_port *port, int bw);int usb4_dp_port_requested_bandwidth (struct tb_port *port);int usb4_pci_port_set_ext_encapsulation (struct tb_port *port,bool enable); +int usb4_pci_port_ltssm_state (struct tb_port *port);static inline bool tb_is_usb4_port_device (const struct device *dev) {
drivers/thunderbolt/tb_regs.h +15 -0
@@ -473,10 +473,25 @@ struct tb_regs_port_header {/* PCIe adapter registers */ #define ADP_PCIE_CS_0 0x00 +#define ADP_PCIE_CS_0_LTSSM_MASK GENMASK(28, 25)#define ADP_PCIE_CS_0_PE BIT(31)#define ADP_PCIE_CS_1 0x01#define ADP_PCIE_CS_1_EE BIT(0) +enum tb_pcie_ltssm_state { +USB4_PCIE_LTSSM_DETECT , +USB4_PCIE_LTSSM_POLLING , +USB4_PCIE_LTSSM_CONFIG , +USB4_PCIE_LTSSM_CONFIG_IDLE , +USB4_PCIE_LTSSM_RECOVERY , +USB4_PCIE_LTSSM_RECOVERY_IDLE , +USB4_PCIE_LTSSM_L0 , +USB4_PCIE_LTSSM_L1 , +USB4_PCIE_LTSSM_L2 , +USB4_PCIE_LTSSM_DISABLED , +USB4_PCIE_LTSSM_HOT_RESET , +}; +/* USB adapter registers */ #define ADP_USB3_CS_0 0x00#define ADP_USB3_CS_0_V BIT(30)
drivers/thunderbolt/tunnel.c +35 -0
@@ -296,6 +296,40 @@ static inline void tb_tunnel_changed(struct tb_tunnel *tunnel) tunnel->src_port, tunnel->dst_port); } +static int tb_pci_port_ltssm_state_detect (struct tb_port *port) +{ +ktime_t timeout =ktime_add_ms (ktime_get (),500 ); + +do { +int ret; + + ret =usb4_pci_port_ltssm_state (port); +if (ret <0 ) +return ret; +if (ret ==USB4_PCIE_LTSSM_DETECT ) +return 0 ; + +fsleep (50 ); + }while (ktime_before (ktime_get (), timeout)); + +return -ETIMEDOUT ; +} + +static int tb_pci_pre_activate (struct tb_tunnel *tunnel) +{ +struct tb_port *down = tunnel->src_port; +struct tb_port *up = tunnel->dst_port; +int ret; + + ret =tb_switch_is_usb4 (down->sw) ? +tb_pci_port_ltssm_state_detect (down) :0 ; +if (ret) +return ret; + +return tb_switch_is_usb4 (up->sw) ? +tb_pci_port_ltssm_state_detect (up) :0 ; +} +static int tb_pci_set_ext_encapsulation (struct tb_tunnel *tunnel,bool enable) {struct tb_port *port =tb_upstream_port (tunnel->dst_port->sw);
@@ -511,6 +545,7 @@ struct tb_tunnel *tb_tunnel_alloc_pci(struct tb *tb, struct tb_port *up,if (!tunnel)return NULL ; + tunnel->pre_activate = tb_pci_pre_activate; tunnel->activate = tb_pci_activate; tunnel->src_port = down; tunnel->dst_port = up;
drivers/thunderbolt/usb4.c +24 -0
@@ -3145,3 +3145,27 @@ int usb4_pci_port_set_ext_encapsulation(struct tb_port *port, bool enable)return tb_port_write (port, &val,TB_CFG_PORT , port->cap_adap +ADP_PCIE_CS_1 ,1 ); } + +/** +* usb4_pci_port_ltssm_state() - Read PCIe adapter LTSSM state +* @port: PCIe adapter +* +* Return: +* * LTSSM state of @port. +* * Negative errno - On failure. +*/ +int usb4_pci_port_ltssm_state (struct tb_port *port) +{ +u32 val; +int ret; + +if (!tb_port_is_pcie_down (port) && !tb_port_is_pcie_up (port)) +return -EINVAL ; + + ret =tb_port_read (port, &val,TB_CFG_PORT , + port->cap_adap +ADP_PCIE_CS_0 ,1 ); +if (ret) +return ret; + +return FIELD_GET (ADP_PCIE_CS_0_LTSSM_MASK , val); +}
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 160/1250 firmware: arm_scmi: Validate SENSOR_UPDATE payload size
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 32bc5496b48174dbca1f187f710955ee4d9527a1 ]
SENSOR_UPDATE carries one or more sensor readings after the fixed notification header. The parser derives the expected reading count from the sensor description, but it did not verify that the received payload contains those entries before parsing them.
Reject truncated update notifications before reading the variable array.
--- drivers/firmware/arm_scmi/sensors.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/firmware/arm_scmi/sensors.c +9 -1
@@ -1074,12 +1074,15 @@ scmi_sensor_fill_custom_report(const struct scmi_protocol_handle *ph,case SCMI_EVENT_SENSOR_UPDATE : {int i; +size_t expected_sz;struct scmi_sensor_info *s;const struct scmi_sensor_update_notify_payld *p = payld;struct scmi_sensor_update_report *r = report;struct sensors_info *sinfo = ph->get_priv (ph); -/* payld_sz is variable for this event */ +if (payld_sz <sizeof (*p)) +break ; + r->sensor_id =le32_to_cpu (p->sensor_id);if (r->sensor_id >= sinfo->num_sensors)break ;
@@ -1093,6 +1096,11 @@ scmi_sensor_fill_custom_report(const struct scmi_protocol_handle *ph,* readings defined for this sensor or 1 for scalar sensors. */ r->readings_count = s->num_axis ?:1 ; + expected_sz =sizeof (*p) + r->readings_count * +sizeof (p->readings[0 ]); +if (payld_sz < expected_sz) +break ; +for (i =0 ; i < r->readings_count; i++)scmi_parse_sensor_readings (&r->readings[i], &p->readings[i]);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 161/1250 firmware: arm_scmi: Validate BASE_ERROR_EVENT payload size
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 56e7e64cdd0e7209a58c8ec66028d63387402919 ]
BASE_ERROR_EVENT carries a variable number of message reports, with the count encoded in error_status. The notification parser used that count without checking whether the received payload contained all reported entries.
Reject truncated payloads before copying the report array.
--- drivers/firmware/arm_scmi/base.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/firmware/arm_scmi/base.c +13 -2
@@ -325,6 +325,8 @@ static void *scmi_base_fill_custom_report(const struct scmi_protocol_handle *ph, void *report, u32 *src_id) { int i; +u32 error_status; +size_t expected_sz;const struct scmi_base_error_notify_payld *p = payld;struct scmi_base_error_report *r = report;
@@ -338,10 +340,19 @@ static void *scmi_base_fill_custom_report(const struct scmi_protocol_handle *ph,if (evt_id !=SCMI_EVENT_BASE_ERROR_EVENT ||sizeof (*p) < payld_sz)return NULL ; + expected_sz = offsetof(typeof(*p), msg_reports); +if (payld_sz < expected_sz) +return NULL ; + r->timestamp = timestamp; r->agent_id =le32_to_cpu (p->agent_id); - r->fatal =IS_FATAL_ERROR (le32_to_cpu (p->error_status)); - r->cmd_count =ERROR_CMD_COUNT (le32_to_cpu (p->error_status)); + error_status =le32_to_cpu (p->error_status); + r->fatal =IS_FATAL_ERROR (error_status); + r->cmd_count =ERROR_CMD_COUNT (error_status); + expected_sz += r->cmd_count *sizeof (p->msg_reports[0 ]); +if (payld_sz < expected_sz) +return NULL ; +for (i =0 ; i < r->cmd_count; i++) r->reports[i] =le64_to_cpu (p->msg_reports[i]); *src_id =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 162/1250 thunderbolt: Increase timeout for Configuration Ready bit
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gil Fine <[email protected]>
[ Upstream commit ba2cc385110129d03cd0f18a1b5969a430b67a18 ]
After setting the Configuration Valid bit (ROUTER_CS_5.CV), the USB4 Connection Manager guide specifies a 500 ms timeout for the router to set the Configuration Ready bit (ROUTER_CS_6.CR). The current timeout is shorter than specified. While there, fix the kernel-doc typo.
Increase the timeout to match the CM guide recommendation.
--- drivers/thunderbolt/usb4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thunderbolt/usb4.c +2 -2
@@ -304,7 +304,7 @@ int usb4_switch_setup(struct tb_switch *sw)* Sets configuration valid bit for the router. Must be called before * any tunnels can be set through the router and after * usb4_switch_setup() has been called. Can be called to host and device -* routers (does nothing for the latter). +* routers (does nothing for the former). * * Return: %0 on success, negative errno otherwise. */
@@ -327,7 +327,7 @@ int usb4_switch_configuration_valid(struct tb_switch *sw)return ret;return tb_switch_wait_for_bit (sw,ROUTER_CS_6 ,ROUTER_CS_6_CR , -ROUTER_CS_6_CR ,50 ); +ROUTER_CS_6_CR ,500 ); }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 163/1250 wifi: mac80211: dont call ieee80211_handle_reconfig_failure when not needed
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miri Korenblit <[email protected]>
[ Upstream commit 7a8a3ff2815501f78f494808355ddf37e08647d0 ]
In case reconfiguration of NAN fails, we call ieee80211_handle_reconfig_failure, that marks all interfaces as not in the driver.
Then, at the error path of the reconfig, cfg80211_shutdown_all_interfaces is called to destroy all the interfaces.
If we have any other interface but the NAN one, for example a BSS station, then when its state (links, stations) will be removed, we won't tell the driver about this, because we will think that the interfaces are not in the driver, and then drivers might remain with dangling pointers to objects like stations and links (at least for iwlwifi this is the case).
ieee80211_handle_reconfig_failure is meant to be called after we cleaned up the state in the driver, there is no reason to call it for NAN reconfiguration failure.
Fix the code to just warn in such a case, as we do in other error paths in reconfig where it is too complicated to rewind.
--- net/mac80211/util.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
net/mac80211/util.c +1 -5
@@ -2055,11 +2055,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) }break ;case NL80211_IFTYPE_NAN : - res =ieee80211_reconfig_nan (sdata); -if (res <0 ) { -ieee80211_handle_reconfig_failure (local); -return res; - } +WARN_ON (ieee80211_reconfig_nan (sdata));break ;case NL80211_IFTYPE_AP_VLAN :case NL80211_IFTYPE_MONITOR :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 164/1250 thunderbolt: Verify Router Ready bit is set after router enumeration
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gil Fine <[email protected]>
[ Upstream commit 062023c4364ffdc72978ed2de1d1435e5d4eee43 ]
The USB4 Connection Manager guide specifies that after enumerating a router, the Connection Manager shall verify that the Router Ready bit (ROUTER_CS_6.RR) has been set to ensure hardware configuration has completed. Currently, this step is missing from the enumeration sequence.
Add this check to follow the Connection Manager guide more closely.
--- drivers/thunderbolt/tb_regs.h | 1 + drivers/thunderbolt/usb4.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/thunderbolt/tb_regs.h +1 -0
@@ -216,6 +216,7 @@ struct tb_regs_switch_header {#define ROUTER_CS_6_WOPS BIT(2)#define ROUTER_CS_6_WOUS BIT(3)#define ROUTER_CS_6_HCI BIT(18) +#define ROUTER_CS_6_RR BIT(24)#define ROUTER_CS_6_CR BIT(25)#define ROUTER_CS_7 0x07#define ROUTER_CS_9 0x09
drivers/thunderbolt/usb4.c +6 -1
@@ -294,7 +294,12 @@ int usb4_switch_setup(struct tb_switch *sw)/* TBT3 supported by the CM */ val &= ~ROUTER_CS_5_CNS ; -return tb_sw_write (sw, &val,TB_CFG_SWITCH ,ROUTER_CS_5 ,1 ); + ret =tb_sw_write (sw, &val,TB_CFG_SWITCH ,ROUTER_CS_5 ,1 ); +if (ret) +return ret; + +return tb_switch_wait_for_bit (sw,ROUTER_CS_6 ,ROUTER_CS_6_RR , +ROUTER_CS_6_RR ,500 ); }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 165/1250 bitfield: wire __bf_shf to __builtin_ctzll
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yury Norov <[email protected]>
[ Upstream commit 09472f591aa0b72c2dd6c693f48b2d6fea66c7ba ]
__bf_shf() is currently based on built-in ffsll. It's more straightforward to wire it to __builtin_ctzll, which makes it a pure rename.
Worth to notice that __builtin_ffsll() is buggy on GCC before 14.1:
int main() {
sizeof(struct {
int t : !(__builtin_ffsll(~0ULL) + 1 < 0);
});
} test.c: In function 'main':
test.c:3:21: error: bit-field 't' width not an integer constant
3 | int t : !(__builtin_ffsll(~0ULL) + 1 < 0);
| ^--- include/linux/bitfield.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/bitfield.h +1 -1
@@ -42,7 +42,7 @@* FIELD_MODIFY(REG_FIELD_C, ®, c); */ -#define __bf_shf (x) (__builtin_ffsll(x) - 1) +#define __bf_shf __builtin_ctzll#define __scalar_type_to_unsigned_cases (type) \ unsigned type: (unsigned type)0, \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 166/1250 nvme-core: align fabrics_q teardown with admin_q in nvme_free_ctrl
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maurizio Lombardi <[email protected]>
[ Upstream commit f702badaf7d31dc3dea6c66da92b5f35fadd89dc ]
Currently, the final reference for the fabrics admin queue (fabrics_q) is dropped inside nvme_remove_admin_tag_set(). However, the primary admin queue (admin_q) defers dropping its final reference until nvme_free_ctrl().
Move the blk_put_queue() call for fabrics_q from nvme_remove_admin_tag_set() to nvme_free_ctrl(). This aligns the lifecycle management of both admin queues, ensuring they are freed symmetrically when the controller is finally torn down.
--- drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/host/core.c +3 -3
@@ -4926,10 +4926,8 @@ void nvme_remove_admin_tag_set(struct nvme_ctrl *ctrl)*/ nvme_stop_keep_alive (ctrl);blk_mq_destroy_queue (ctrl->admin_q); -if (ctrl->ops->flags &NVME_F_FABRICS ) { +if (ctrl->fabrics_q)blk_mq_destroy_queue (ctrl->fabrics_q); -blk_put_queue (ctrl->fabrics_q); - }blk_mq_free_tag_set (ctrl->admin_tagset); }EXPORT_SYMBOL_GPL (nvme_remove_admin_tag_set);
@@ -5071,6 +5069,8 @@ static void nvme_free_ctrl(struct device *dev)if (ctrl->admin_q)blk_put_queue (ctrl->admin_q); +if (ctrl->fabrics_q) +blk_put_queue (ctrl->fabrics_q);if (!subsys || ctrl->instance != subsys->instance)ida_free (&nvme_instance_ida, ctrl->instance);nvme_free_cels (ctrl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 167/1250 PM: hibernate: call preallocate_image() after freeze prepare
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Leach <[email protected]>
[ Upstream commit 783c8109844503bd1c35dab41b6d5fd074a9f131 ]
Certain drivers release resources (pinned pages, etc.) into system memory during the prepare freeze PM op, making them swappable. Currently, hibernate_preallocate_memory() is called before prepare freeze, so those drivers have no opportunity to release resources first. If a driver is holding a large amount of unswappable system RAM, this can cause hibernate_preallocate_memory() to fail.
Move the call to hibernate_preallocate_memory() after prepare freeze.
According to the documentation for the prepare callback, devices should be left in a usable state, so storage drivers should still be able to service I/O requests. This allows drivers to release unswappable resources prior to preallocation, so they can be swapped out through hibernate_preallocate_memory()'s reclaim path.
Also remove shrink_shmem_memory() since hibernate_preallocate_memory() will have reclaimed enough memory for the hibernation image.
--- kernel/power/hibernate.c | 46 ++++++++-------------------------------- 1 file changed, 9 insertions(+), 37 deletions(-)
kernel/power/hibernate.c +9 -37
@@ -392,23 +392,6 @@ static int create_image(int platform_mode)return error; } -static void shrink_shmem_memory (void ) -{ -struct sysinfo info; -unsigned long nr_shmem_pages, nr_freed_pages; - -si_meminfo (&info); - nr_shmem_pages = info.sharedram;/* current page count used for shmem */ -/* -* The intent is to reclaim all shmem pages. Though shrink_all_memory() can -* only reclaim about half of them, it's enough for creating the hibernation -* image. -*/ - nr_freed_pages =shrink_all_memory (nr_shmem_pages); -pr_debug ("requested to reclaim %lu shmem pages, actually freed %lu pages\n" , - nr_shmem_pages, nr_freed_pages); -} -/** * hibernation_snapshot - Quiesce devices and create a hibernation image. * @platform_mode: If set, use platform driver to prepare for the transition.
@@ -425,14 +408,9 @@ int hibernation_snapshot(int platform_mode)if (error) goto Close; -/* Preallocate image memory before shutting down devices. */ - error =hibernate_preallocate_memory (); -if (error) - goto Close; - error =freeze_kernel_threads ();if (error) - goto Cleanup; + goto Close;if (hibernation_test (TEST_FREEZER )) {
@@ -445,19 +423,13 @@ int hibernation_snapshot(int platform_mode) } error =dpm_prepare (PMSG_FREEZE ); -if (error) { -dpm_complete (PMSG_RECOVER ); - goto Thaw; - } +if (error) + goto Complete; -/* -* Device drivers may move lots of data to shmem in dpm_prepare(). The shmem -* pages will use lots of system memory, causing hibernation image creation -* fail due to insufficient free memory. -* This call is to force flush the shmem pages to swap disk and reclaim -* the system memory so that image creation can succeed. -*/ -shrink_shmem_memory (); +/* Preallocate image memory before shutting down devices. */ + error =hibernate_preallocate_memory (); +if (error) + goto Complete;console_suspend_all ();pm_restrict_gfp_mask ();
@@ -492,10 +464,10 @@ int hibernation_snapshot(int platform_mode)platform_end (platform_mode);return error; + Complete: +dpm_complete (PMSG_RECOVER ); Thaw:thaw_kernel_threads (); - Cleanup: -swsusp_free (); goto Close; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 168/1250 net: usb: qmi_wwan: add MeiG SRM813Q
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Volckaert <[email protected]>
[ Upstream commit 9758c11fc6c138a79a28a5659feeaa3abde7aa6a ]
Add support for the Qualcomm Technology Snapdragon X35-based MeiG SRM813Q module.
The module can be put in different modes via AT commands to enable/disable GPS functionality:
MODEM - PPP mode(2dee:4d63): AT+SER=1,1
If#= 0: RMNET
If#= 1: DIAG/ADB
If#= 2: MODEM
If#= 3: AT
P: Vendor=2dee ProdID=4d63 Rev=05.15 S: Manufacturer=MEIG S: Product=LTE-A Module S: SerialNumber=1bd51f0e C: #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
NMEA mode(2dee:4d64): AT+SER=51,1
If#= 0: RMNET
If#= 1: DIAG/ADB
If#= 2: NMEA
If#= 3: AT
P: Vendor=2dee ProdID=4d64 Rev=05.15 S: Manufacturer=MEIG S: Product=LTE-A Module S: SerialNumber=1bd51f0e C: #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
--- drivers/net/usb/qmi_wwan.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/usb/qmi_wwan.c +2 -0
@@ -1453,6 +1453,8 @@ static const struct usb_device_id products[] = { {QMI_QUIRK_SET_DTR(0x1546, 0x1342, 4)}, /* u-blox LARA-L6 */ {QMI_QUIRK_SET_DTR(0x33f8, 0x0104, 4)}, /* Rolling RW101 RMNET */ {QMI_FIXED_INTF(0x2dee, 0x4d22, 5)}, /* MeiG Smart SRM825L */ + {QMI_QUIRK_SET_DTR(0x2dee, 0x4d63, 0)}, /* MeiG SRM813Q w/ Modem(PPP) */ + {QMI_QUIRK_SET_DTR(0x2dee, 0x4d64, 0)}, /* MeiG SRM813Q w/ NMEA *//* 4. Gobi 1000 devices */ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 169/1250 net: bridge: remove stale rcu_barrier() in br_multicast_dev_del()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 25ae123db10ba9ab890b56bcdb0a4363aee8529a ]
This rcu_barrier() came from a time call_rcu() calls were used in net/bridge/br_multicast.c.
Now kfree_rcu() is there, we can remove this problematic rcu_barrier() which causes extreme RTNL pressure in many syzbot reports.
INFO: task syz-executor:77945 is blocked on a mutex likely owned by task kworker/u1024:5:36537. task:kworker/u1024:5 state:D stack:24616 pid:36537 tgid:36537 ppid:2 task_flags:0x4208060 flags:0x00080000 last_sleep:612797637337 Workqueue: netns cleanup_net Call Trace: <TASK> [<ffffffff81914eaa>] context_switch+0xf2a/0x1730 kernel/sched/core.c:6483 [<ffffffff81201143>] __schedule+0x1133/0x43a0 kernel/sched/core.c:8411 [<ffffffff8120446b>] __schedule_loop kernel/sched/core.c:8514 [inline] [<ffffffff8120446b>] schedule+0xab/0x260 kernel/sched/core.c:8529 [<ffffffff8121a093>] schedule_timeout+0xc3/0x2b0 kernel/time/sleep_timeout.c:75 [<ffffffff81205347>] do_wait_for_common kernel/sched/completion.c:100 [inline] [<ffffffff81205347>] __wait_for_common kernel/sched/completion.c:121 [inline] [<ffffffff81205347>] wait_for_common kernel/sched/completion.c:132 [inline] [<ffffffff81205347>] wait_for_completion+0x2c7/0x5d0 kernel/sched/completion.c:153 [<ffffffff81b8f27f>] rcu_barrier+0x49f/0x620 kernel/rcu/tree.c:3888 [<ffffffff860091b3>] br_multicast_dev_del+0x303/0x350 net/bridge/br_multicast.c:4459 [<ffffffff85fb5dbc>] br_dev_uninit+0x1c/0x40 net/bridge/br_device.c:157 [<ffffffff8568058c>] unregister_netdevice_many_notify+0x1c1c/0x2300 net/core/dev.c:12599 [<ffffffff8562be43>] ops_exit_rtnl_list net/core/net_namespace.c:187 [inline] [<ffffffff8562be43>] ops_undo_list+0x3d3/0x940 net/core/net_namespace.c:248
--- net/bridge/br_multicast.c | 2 -- 1 file changed, 2 deletions(-)
net/bridge/br_multicast.c +0 -2
@@ -4456,8 +4456,6 @@ void br_multicast_dev_del(struct net_bridge *br)br_multicast_ctx_deinit (&br->multicast_ctx);br_multicast_gc (&deleted_head);cancel_work_sync (&br->mcast_gc_work); - -rcu_barrier (); }int br_multicast_set_router (struct net_bridge_mcast *brmctx,unsigned long val)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 170/1250 net/sched: sch_drr: make cl->quantum lockless
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a4d880b85089e12a5f2e8e2fee386310cec5b99a ]
cl->quantum does not need to be protected by RTNL or qdisc spinlock.
--- net/sched/sch_drr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/sched/sch_drr.c +4 -6
@@ -97,10 +97,8 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid, } } -sch_tree_lock (sch);if (tb[TCA_DRR_QUANTUM ]) - cl->quantum = quantum; -sch_tree_unlock (sch); +WRITE_ONCE (cl->quantum, quantum);return 0 ; }
@@ -251,7 +249,7 @@ static int drr_dump_class(struct Qdisc *sch, unsigned long arg, nest =nla_nest_start_noflag (skb,TCA_OPTIONS );if (nest ==NULL ) goto nla_put_failure; -if (nla_put_u32 (skb,TCA_DRR_QUANTUM , cl->quantum)) +if (nla_put_u32 (skb,TCA_DRR_QUANTUM ,READ_ONCE (cl->quantum))) goto nla_put_failure;return nla_nest_end (skb, nest);
@@ -362,7 +360,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch,if (!cl_is_active (cl)) {list_add_tail (&cl->alist, &q->active); -WRITE_ONCE (cl->deficit, cl->quantum); +WRITE_ONCE (cl->deficit,READ_ONCE (cl->quantum)); } sch->qstats.backlog += len;
@@ -403,7 +401,7 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch)return skb; } -WRITE_ONCE (cl->deficit, cl->deficit + cl->quantum); +WRITE_ONCE (cl->deficit, cl->deficit +READ_ONCE (cl->quantum));list_move_tail (&cl->alist, &q->active); } out:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 171/1250 net/rds: Dont sleep inside rds_ib_conn_path_shutdown
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Allison Henderson <[email protected]>
[ Upstream commit 16f48efaeb6991193fb7775c577f06f5b20b0c90 ]
New rds rdma self tests exposed a hang when tearing down the ib network configs. This is caused by the shutdown worker thread sleeping on the wait_event call, which blocks other work items in the queue. Fix this by changing wait_event to wait_event timeout, and looping until the wait check succeeds.
--- net/rds/ib_cm.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
net/rds/ib_cm.c +20 -5
@@ -1043,6 +1043,19 @@ int rds_ib_conn_path_connect(struct rds_conn_path *cp)return ret; } +static unsigned long rds_ib_conn_path_shutdown_check_wait (struct rds_conn_path *cp) +{ +struct rds_connection *conn = cp->cp_conn; +struct rds_ib_connection *ic = conn->c_transport_data; + +return (!ic->i_cm_id || + (rds_ib_ring_empty (&ic->i_recv_ring) && + (atomic_read (&ic->i_signaled_sends) ==0 ) && + (atomic_read (&ic->i_fastreg_inuse_count)) ==0 && + (atomic_read (&ic->i_fastreg_wrs) ==RDS_IB_DEFAULT_FR_WR ))) ?0 + :msecs_to_jiffies (1000 ); +} +/* * This is so careful about only cleaning up resources that were built up * so that it can be called at any point during startup. In fact it
@@ -1083,11 +1096,13 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)* sends to complete we're ensured that there will be no * more tx processing. */ -wait_event (rds_ib_ring_empty_wait, -rds_ib_ring_empty (&ic->i_recv_ring) && - (atomic_read (&ic->i_signaled_sends) ==0 ) && - (atomic_read (&ic->i_fastreg_inuse_count) ==0 ) && - (atomic_read (&ic->i_fastreg_wrs) ==RDS_IB_DEFAULT_FR_WR )); +while (!wait_event_timeout (rds_ib_ring_empty_wait, +rds_ib_conn_path_shutdown_check_wait (cp) ==0 , +msecs_to_jiffies (1000 ))) { +tasklet_schedule (&ic->i_send_tasklet); +tasklet_schedule (&ic->i_recv_tasklet); + } +tasklet_kill (&ic->i_send_tasklet);tasklet_kill (&ic->i_recv_tasklet);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 172/1250 net/mlx5: Switch vport HCA cap helpers to kvzalloc
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Moshe Shemesh <[email protected]>
[ Upstream commit 62af408fd772ba0194c007170f9e930ea71e01ea ]
mlx5_vport_set_other_func_cap() and mlx5_vport_get_vhca_id() allocate command buffers that embed the HCA capability union, exceeding 4KiB. Use kvzalloc/kvfree so the allocation can fall back to vmalloc when contiguous memory is scarce.
--- drivers/net/ethernet/mellanox/mlx5/core/vport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/vport.c +4 -4
@@ -1381,7 +1381,7 @@ int mlx5_vport_get_vhca_id(struct mlx5_core_dev *dev, u16 vport, u16 *vhca_id)if (mlx5_esw_vport_vhca_id (dev->priv.eswitch, vport, vhca_id))return 0 ; - query_ctx =kzalloc (query_out_sz,GFP_KERNEL ); + query_ctx =kvzalloc (query_out_sz,GFP_KERNEL );if (!query_ctx)return -ENOMEM ;
@@ -1393,7 +1393,7 @@ int mlx5_vport_get_vhca_id(struct mlx5_core_dev *dev, u16 vport, u16 *vhca_id) *vhca_id =MLX5_GET (cmd_hca_cap, hca_caps, vhca_id); out_free: -kfree (query_ctx); +kvfree (query_ctx);return err; }EXPORT_SYMBOL_GPL (mlx5_vport_get_vhca_id);
@@ -1408,7 +1408,7 @@ int mlx5_vport_set_other_func_cap(struct mlx5_core_dev *dev, const void *hca_capvoid *set_ctx;int ret; - set_ctx =kzalloc (set_sz,GFP_KERNEL ); + set_ctx =kvzalloc (set_sz,GFP_KERNEL );if (!set_ctx)return -ENOMEM ;
@@ -1437,6 +1437,6 @@ int mlx5_vport_set_other_func_cap(struct mlx5_core_dev *dev, const void *hca_capMLX5_SET (set_hca_cap_in, set_ctx, function_id, function_id); ret =mlx5_cmd_exec_in (dev, set_hca_cap, set_ctx); -kfree (set_ctx); +kvfree (set_ctx);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 173/1250 spi: dw-mmio: Add ACPI ID LECA0002 for LECARC SoCs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Lin <[email protected]>
[ Upstream commit 019947c495850461242fdcc0780258805595036c ]
This ID requires a custom initialization function dw_spi_hssi_no_dma_init() that sets dws->dws.ip to DW_HSSI_ID.
--- drivers/acpi/acpi_apd.c | 7 +++++++ drivers/spi/spi-dw-mmio.c | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-)
drivers/acpi/acpi_apd.c +7 -0
@@ -181,6 +181,12 @@ static const struct apd_device_desc hip08_spi_desc = { .setup = acpi_apd_setup, .fixed_clk_rate = 250000000, }; + +static const struct apd_device_desc leca_spi_desc = { + .setup = acpi_apd_setup, + .fixed_clk_rate =400000000 , +}; +#endif /* CONFIG_ARM64 */ #endif
@@ -251,6 +257,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = { { "HISI02A2", APD_ADDR(hip08_i2c_desc) }, { "HISI02A3", APD_ADDR(hip08_lite_i2c_desc) }, { "HISI0173", APD_ADDR(hip08_spi_desc) }, + { "LECA0002", APD_ADDR(leca_spi_desc) }, { "NXP0001", APD_ADDR(nxp_i2c_desc) }, #endif { }
drivers/spi/spi-dw-mmio.c +4 -3
@@ -228,8 +228,8 @@ static int dw_spi_hssi_init(struct platform_device *pdev,return 0 ; } -static int dw_spi_intel_init (struct platform_device *pdev, -struct dw_spi_mmio *dwsmmio) +static int dw_spi_hssi_no_dma_init (struct platform_device *pdev, +struct dw_spi_mmio *dwsmmio) { dwsmmio->dws.ip =DW_HSSI_ID ;
@@ -413,7 +413,7 @@ static const struct of_device_id dw_spi_mmio_of_match[] = { { .compatible = "amazon,alpine-dw-apb-ssi", .data = dw_spi_alpine_init}, { .compatible = "renesas,rzn1-spi", .data = dw_spi_pssi_init}, { .compatible = "snps,dwc-ssi-1.01a", .data = dw_spi_hssi_init}, - { .compatible = "intel,keembay-ssi", .data = dw_spi_intel_init}, + { .compatible = "intel,keembay-ssi", .data = dw_spi_hssi_no_dma_init}, { .compatible = "intel,mountevans-imc-ssi", .data = dw_spi_mountevans_imc_init,
@@ -428,6 +428,7 @@ MODULE_DEVICE_TABLE(of, dw_spi_mmio_of_match);#ifdef CONFIG_ACPI static const struct acpi_device_id dw_spi_mmio_acpi_match[] = { {"HISI0173" , (kernel_ulong_t )dw_spi_pssi_init}, + {"LECA0002" , (kernel_ulong_t )dw_spi_hssi_no_dma_init}, {}, };MODULE_DEVICE_TABLE (acpi, dw_spi_mmio_acpi_match);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 174/1250 befs: handle set_blocksize failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 7597d42a25332617a3dfe596758d780ec6c028d7 ]
befs uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting we will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
--- fs/befs/linuxvfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/befs/linuxvfs.c +2 -1
@@ -858,7 +858,8 @@ befs_fill_super(struct super_block *sb, struct fs_context *fc)*/ sb->s_magic =BEFS_SUPER_MAGIC ;/* Set real blocksize of fs */ -sb_set_blocksize (sb, (ulong ) befs_sb->block_size); +if (!sb_set_blocksize (sb, (ulong ) befs_sb->block_size)) + goto unacquire_priv_sbp; sb->s_op = &befs_sops; sb->s_export_op = &befs_export_operations; sb->s_time_min =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 175/1250 ntfs3: handle set_blocksize failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 24f7d1824b7581ae3daf9d443c5dfeabd89df6d8 ]
ntfs3 uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting we will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
--- fs/ntfs3/super.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ntfs3/super.c +6 -2
@@ -1143,7 +1143,10 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size, rec->total =cpu_to_le32 (sbi->record_size); ((struct ATTRIB *)Add2Ptr (rec, ao))->type =ATTR_END ; -sb_set_blocksize (sb,min_t (u32, sbi->cluster_size,PAGE_SIZE )); +if (!sb_set_blocksize (sb,min_t (u32, sbi->cluster_size,PAGE_SIZE ))) { + err = -EINVAL ; + goto out; + } sbi->block_mask = sb->s_blocksize -1 ; sbi->blocks_per_cluster = sbi->cluster_size >> sb->s_blocksize_bits;
@@ -1194,7 +1197,8 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,/* * Try alternative boot (last sector) */ -sb_set_blocksize (sb, block_size); +if (!sb_set_blocksize (sb, block_size)) +return -EINVAL ; hint ="Alternative boot" ; dev_size = dev_size0;/* restore original size. */ goto read_boot;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 176/1250 affs: handle set_blocksize failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 0861182af5983a39bd2a891966436c5679b74a45 ]
affs uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting we will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
--- fs/affs/affs.h | 5 ----- fs/affs/super.c | 6 ++++-- 2 files changed, 4 insertions(+), 7 deletions(-)
fs/affs/affs.h +0 -5
@@ -225,11 +225,6 @@ static inline bool affs_validblock(struct super_block *sb, int block) block < AFFS_SB(sb)->s_partition_size); } -static inline void -affs_set_blocksize (struct super_block *sb,int size) -{ -sb_set_blocksize (sb, size); -}static inline struct buffer_head *affs_bread (struct super_block *sb,int block) {
fs/affs/super.c +4 -2
@@ -357,7 +357,8 @@ static int affs_fill_super(struct super_block *sb, struct fs_context *fc) size =bdev_nr_sectors (sb->s_bdev);pr_debug ("initial blocksize=%d, #blocks=%d\n" ,512 , size); -affs_set_blocksize (sb,PAGE_SIZE ); +if (!sb_set_blocksize (sb,PAGE_SIZE )) +return -EINVAL ;/* Try to find root block. Its location depends on the block size. */ i =bdev_logical_block_size (sb->s_bdev);
@@ -373,7 +374,8 @@ static int affs_fill_super(struct super_block *sb, struct fs_context *fc)if (ctx->root_block <0 ) sbi->s_root_block = (ctx->reserved + size -1 ) /2 ;pr_debug ("setting blocksize to %d\n" , blocksize); -affs_set_blocksize (sb, blocksize); +if (!sb_set_blocksize (sb, blocksize)) +return -EINVAL ; sbi->s_partition_size = size;/* The root block location that was calculated above is not
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 177/1250 bfs: handle set_blocksize failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 2430e3380936df0b648af720cae624eef035a2d1 ]
bfs uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
--- fs/bfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/bfs/inode.c +2 -1
@@ -342,7 +342,8 @@ static int bfs_fill_super(struct super_block *s, struct fs_context *fc) s->s_time_min =0 ; s->s_time_max =U32_MAX ; -sb_set_blocksize (s,BFS_BSIZE ); +if (!sb_set_blocksize (s,BFS_BSIZE )) + goto out; sbh =sb_bread (s,0 );if (!sbh)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 178/1250 minix: handle set_blocksize failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 38a03dc2bc71e7e0746cdb9ef5e9947f72470c67 ]
minix uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting we will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
--- fs/minix/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/minix/inode.c +2 -1
@@ -272,7 +272,8 @@ static int minix_fill_super(struct super_block *s, struct fs_context *fc) sbi->s_namelen =60 ; sbi->s_version =MINIX_V3 ; sbi->s_mount_state =MINIX_VALID_FS ; -sb_set_blocksize (s, m3s->s_blocksize); +if (!sb_set_blocksize (s, m3s->s_blocksize)) + goto out; s->s_max_links =MINIX2_LINK_MAX ; }else goto out_no_fs;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 179/1250 qnx4: handle set_blocksize failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit c7d911ea1cc9a63b07e52f5e75b263be0615b289 ]
qnx4 uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
--- fs/qnx4/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/qnx4/inode.c +2 -1
@@ -202,7 +202,8 @@ static int qnx4_fill_super(struct super_block *s, struct fs_context *fc)return -ENOMEM ; s->s_fs_info = qs; -sb_set_blocksize (s,QNX4_BLOCK_SIZE ); +if (!sb_set_blocksize (s,QNX4_BLOCK_SIZE )) +return -EINVAL ; s->s_op = &qnx4_sops; s->s_magic =QNX4_SUPER_MAGIC ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 180/1250 jfs: handle set_blocksize failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 05107f5602751fcfd3d108c1f579eb45aabead52 ]
jfs uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting we will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
--- fs/jfs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jfs/super.c +2 -1
@@ -491,7 +491,8 @@ static int jfs_fill_super(struct super_block *sb, struct fs_context *fc)/* * Initialize blocksize to 4K. */ -sb_set_blocksize (sb,PSIZE ); +if (!sb_set_blocksize (sb,PSIZE )) + goto out_unload;/* * Set method vectors.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 181/1250 hpfs: handle set_blocksize failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit a405996f23e04942aad064ab8d50c55827482872 ]
hpfs uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
--- fs/hpfs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/hpfs/super.c +2 -1
@@ -522,7 +522,8 @@ static int hpfs_fill_super(struct super_block *s, struct fs_context *fc)hpfs_lock (s);/*sbi->sb_mounting = 1;*/ -sb_set_blocksize (s,512 ); +if (!sb_set_blocksize (s,512 )) + goto bail0; sbi->sb_fs_size =-1 ;if (!(bootblock =hpfs_map_sector (s,0 , &bh0,0 ))) goto bail1;if (!(superblock =hpfs_map_sector (s,16 , &bh1,1 ))) goto bail2;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 182/1250 omfs: handle set_blocksize failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 18c3d6fcb557f920c9143711497625e70153874c ]
omfs uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting we will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
--- fs/omfs/inode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/omfs/inode.c +4 -2
@@ -477,7 +477,8 @@ static int omfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_time_min =0 ; sb->s_time_max =U64_MAX /MSEC_PER_SEC ; -sb_set_blocksize (sb,0x200 ); +if (!sb_set_blocksize (sb,0x200 )) + goto end; bh =sb_bread (sb,0 );if (!bh)
@@ -529,7 +530,8 @@ static int omfs_fill_super(struct super_block *sb, struct fs_context *fc)* Use sys_blocksize as the fs block since it is smaller than a * page while the fs blocksize can be larger. */ -sb_set_blocksize (sb, sbi->s_sys_blocksize); +if (!sb_set_blocksize (sb, sbi->s_sys_blocksize)) + goto out_brelse_bh;/* * ...and the difference goes into a shift. sys_blocksize is always
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 183/1250 isofs: handle set_blocksize failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 25ef4c4d9f0e96fb89c0ae0d7127c3f12a31bc32 ]
isofs uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting we will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
--- fs/isofs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/isofs/inode.c +2 -1
@@ -818,7 +818,8 @@ static int isofs_fill_super(struct super_block *s, struct fs_context *fc)* entries. By forcing the blocksize in this way, we ensure * that we will never be required to do this. */ -sb_set_blocksize (s, orig_zonesize); +if (!sb_set_blocksize (s, orig_zonesize)) + goto out_freesbi; sbi->s_nls_iocharset =NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 184/1250 HID: bpf: Add Huion Inspiroy Frego M button quirk
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikhil Chatterjee <[email protected]>
[ Upstream commit 857e71cb0a538b1660743a4267a1e789575f7966 ]
The Huion Inspiroy Frego M pen report descriptor exposes the second side button as Secondary Tip Switch instead of Secondary Barrel Switch. This makes userspace see the control as the wrong pen button.
Add a HID-BPF report descriptor fixup for the Bluetooth 256c:8251 device and USB 256c:2012 L610 variant. The fixup matches the expected pen descriptor and rewrites the offending usage from Secondary Tip Switch to Secondary Barrel Switch.
Tested by building the HID-BPF object with:
make -C drivers/hid/bpf/progs Huion__Inspiroy-Frego-M.bpf.o
--- .../bpf/progs/Huion__Inspiroy-Frego-M.bpf.c | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 drivers/hid/bpf/progs/Huion__Inspiroy-Frego-M.bpf.c
drivers/hid/bpf/progs/Huion__Inspiroy-Frego-M.bpf.c new file +87 -0
@@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "vmlinux.h" +#include "hid_bpf.h" +#include "hid_bpf_helpers.h" +#include <bpf/bpf_tracing.h> + +/* +* Huion Inspiroy Frego M Pen Tablet +* Model L610 +* 256c:8251 (Bluetooth) +* 256c:2012 (USB) +*/ +#define VID_HUION 0x256C +#define PID_INSPIROY_FREGO_M 0x8251 +#define PID_L610 0x2012 + +#define PEN_RDESC_SIZE 125 +#define SECONDARY_SWITCH_OFFSET 17 + +HID_BPF_CONFIG ( +HID_DEVICE (BUS_BLUETOOTH ,HID_GROUP_GENERIC ,VID_HUION ,PID_INSPIROY_FREGO_M ), +HID_DEVICE (BUS_USB ,HID_GROUP_GENERIC ,VID_HUION ,PID_L610 ) +); + +/* +* The pen descriptor reports the second side button as Secondary Tip Switch +* instead of Secondary Barrel Switch. +* +* Relevant part of the original pen report descriptor: +* +* 0x09, 0x42, // Usage (Tip Switch) 12 +* 0x09, 0x44, // Usage (Barrel Switch) 14 +* 0x09, 0x43, // Usage (Secondary Tip Switch) 16 <- change to 0x5a +* 0x09, 0x3c, // Usage (Invert) 18 +* 0x09, 0x45, // Usage (Eraser) 20 +* 0x15, 0x00, // Logical Minimum (0) 22 +* 0x25, 0x01, // Logical Maximum (1) 24 +*/ +SEC (HID_BPF_RDESC_FIXUP) +int BPF_PROG(fix_secondary_barrel_rdesc, struct hid_bpf_ctx *hctx) +{ +__u8 *data =hid_bpf_get_data (hctx,0 /* offset */ ,HID_MAX_DESCRIPTOR_SIZE /* size */ ); + +if (!data) +return 0 ;/* EPERM check */ + +if (hctx->size !=PEN_RDESC_SIZE ) +return 0 ; + +if (data[0 ] !=0x05 || data[1 ] !=0x0d ||/* Usage Page (Digitizers) */ + data[2 ] !=0x09 || data[3 ] !=0x02 ||/* Usage (Pen) */ + data[16 ] !=0x09 || + data[SECONDARY_SWITCH_OFFSET ] !=0x43 )/* Secondary Tip Switch */ +return 0 ; + + data[SECONDARY_SWITCH_OFFSET ] =0x5a ; + +return 0 ; +} + +HID_BPF_OPS (fix_secondary_barrel) = { + .hid_rdesc_fixup = (void *)fix_secondary_barrel_rdesc, +}; + +SEC("syscall") +int probe (struct hid_bpf_probe_args *ctx) +{ + ctx->retval = ctx->rdesc_size !=PEN_RDESC_SIZE ; +if (ctx->retval) { + ctx->retval = -EINVAL ; +return 0 ; + } + +if (ctx->rdesc[0 ] !=0x05 || ctx->rdesc[1 ] !=0x0d ||/* Usage Page (Digitizers) */ + ctx->rdesc[2 ] !=0x09 || ctx->rdesc[3 ] !=0x02 ||/* Usage (Pen) */ + ctx->rdesc[16 ] !=0x09 || + ctx->rdesc[SECONDARY_SWITCH_OFFSET ] !=0x43 ) {/* Secondary Tip Switch */ + ctx->retval = -EINVAL ; +return 0 ; + } + + ctx->retval =0 ; + +return 0 ; +} + +char _license[] SEC("license") = "GPL";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 185/1250 drm/panel-edp: Add LG LP129WT232166 panel
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérôme de Bretagne <[email protected]>
[ Upstream commit 31ac8899d1a9284fb50bd42c409f224788220e27 ]
Add an entry for the eDP LG LP129WT232166 panel used in the Microsoft Surface Pro 9 5G.
edid-decode (hex):
00 ff ff ff ff ff ff 00 30 e4 b2 06 a1 25 10 00 00 1f 01 04 a5 1b 12 78 01 ef 70 a7 51 4c a8 26 0e 4f 53 00 00 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fd 00 18 78 f1 f1 48 01 0a 20 20 20 20 20 20 00 00 00 fe 00 4c 47 44 5f 4d 50 31 2e 30 5f 0a 20 20 00 00 00 fe 00 4c 50 31 32 39 57 54 32 33 32 31 36 36 01 23
70 13 79 00 00 03 01 14 56 16 01 88 3f 0b 4f 00 07 80 1f 00 7f 07 55 00 47 00 07 00 03 01 14 56 16 01 08 3f 0b 4f 00 07 80 1f 00 7f 07 2b 08 47 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2c 90
--- drivers/gpu/drm/panel/panel-edp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panel/panel-edp.c +1 -0
@@ -2087,6 +2087,7 @@ static const struct edp_panel_entry edp_panels[] = {EDP_PANEL_ENTRY ('L' ,'G' ,'D' ,0x0567 , &delay_200_500_e200_d200,"Unknown" ),EDP_PANEL_ENTRY ('L' ,'G' ,'D' ,0x05af , &delay_200_500_e200_d200,"Unknown" ),EDP_PANEL_ENTRY ('L' ,'G' ,'D' ,0x05f1 , &delay_200_500_e200_d200,"Unknown" ), +EDP_PANEL_ENTRY ('L' ,'G' ,'D' ,0x06b2 , &delay_200_500_e200_d200,"LP129WT232166" ),EDP_PANEL_ENTRY ('L' ,'G' ,'D' ,0x0778 , &delay_200_500_e200_d200,"134WT1" ), EDP_PANEL_ENTRY('L', 'G', 'D', 0x07fe, &delay_200_500_e200_d200, "LP116WHA-SPB1"),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 186/1250 usbip: vhci_hcd: fix NULL deref in status_show_vhci
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Wowk <[email protected]>
[ Upstream commit bc150783542ba2e7c1257d1299c6f3269bdba270 ]
platform_get_drvdata() can return NULL if a VHCI host controller's probe failed (e.g. due to USB bus number exhaustion). status_show_vhci() checked for a NULL pdev but not for a NULL hcd returned by platform_get_drvdata(). Passing NULL to hcd_to_vhci_hcd() does not return NULL - it returns a pointer offset of 0x260, causing a NULL pointer dereference when that value is subsequently dereferenced.
Add a NULL check on hcd before calling hcd_to_vhci_hcd(). Move status_show_not_ready() above status_show_vhci() to make it callable from the new error path without a forward declaration.
--- drivers/usb/usbip/vhci_sysfs.c | 52 +++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 23 deletions(-)
drivers/usb/usbip/vhci_sysfs.c +29 -23
@@ -59,6 +59,29 @@ static void port_show_vhci(char **out, int hub, int port, struct vhci_device *vd *out +=sprintf (*out,"\n" ); } +static ssize_t status_show_not_ready (int pdev_nr,char *out) +{ +char *s = out; +int i =0 ; + +for (i =0 ; i <VHCI_HC_PORTS ; i++) { + out +=sprintf (out,"hs %04u %03u " , + (pdev_nr *VHCI_PORTS ) + i, +VDEV_ST_NOTASSIGNED ); + out +=sprintf (out,"000 00000000 0000000000000000 0-0" ); + out +=sprintf (out,"\n" ); + } + +for (i =0 ; i <VHCI_HC_PORTS ; i++) { + out +=sprintf (out,"ss %04u %03u " , + (pdev_nr *VHCI_PORTS ) +VHCI_HC_PORTS + i, +VDEV_ST_NOTASSIGNED ); + out +=sprintf (out,"000 00000000 0000000000000000 0-0" ); + out +=sprintf (out,"\n" ); + } +return out - s; +} +/* Sysfs entry to show port status */ static ssize_t status_show_vhci (int pdev_nr,char *out) {
@@ -76,6 +99,12 @@ static ssize_t status_show_vhci(int pdev_nr, char *out) } hcd =platform_get_drvdata (pdev); + +if (!hcd) { +usbip_dbg_vhci_sysfs ("show status error (hcd is NULL)\n" ); +return status_show_not_ready (pdev_nr, out); + } + vhci_hcd =hcd_to_vhci_hcd (hcd); vhci = vhci_hcd->vhci;
@@ -104,29 +133,6 @@ static ssize_t status_show_vhci(int pdev_nr, char *out)return out - s; } -static ssize_t status_show_not_ready (int pdev_nr,char *out) -{ -char *s = out; -int i =0 ; - -for (i =0 ; i <VHCI_HC_PORTS ; i++) { - out +=sprintf (out,"hs %04u %03u " , - (pdev_nr *VHCI_PORTS ) + i, -VDEV_ST_NOTASSIGNED ); - out +=sprintf (out,"000 00000000 0000000000000000 0-0" ); - out +=sprintf (out,"\n" ); - } - -for (i =0 ; i <VHCI_HC_PORTS ; i++) { - out +=sprintf (out,"ss %04u %03u " , - (pdev_nr *VHCI_PORTS ) +VHCI_HC_PORTS + i, -VDEV_ST_NOTASSIGNED ); - out +=sprintf (out,"000 00000000 0000000000000000 0-0" ); - out +=sprintf (out,"\n" ); - } -return out - s; -} -static int status_name_to_id (const char *name) {char *c;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 187/1250 usb: core: hcd: fix possible deadlock in rh control transfers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
[ Upstream commit d5559f43d76b398392b26a15cbc16d731969cd1c ]
Quoted 1 line
From within the SCSI error handler memory allocations must not
trigger IO. Handling errors in UAS and the storage driver may involve resetting a device. The thread doing the reset itself relies on VM magic. However, that is insufficient, as resetting a device involves resuming it. Resumption as well as resetting involves conrol transfers to the parent of the device to be reset. That may be a root hub. Hence usbcore must heed the flags passed to usb_submit_urb() processing control transfers to root hubs.
The problem exist since the storage driver has been merged.
--- drivers/usb/core/hcd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/usb/core/hcd.c +8 -6
@@ -450,7 +450,8 @@ rh_string(int id, struct usb_hcd const *hcd, u8 *data, unsigned len)/* Root hub control transfers execute synchronously */ -static int rh_call_control (struct usb_hcd *hcd,struct urb *urb) +static int rh_call_control (struct usb_hcd *hcd, +struct urb *urb,gfp_t mem_flags) {struct usb_ctrlrequest *cmd;u16 typeReq, wValue, wIndex, wLength;
@@ -485,8 +486,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)* tbuf should be at least as big as the * USB hub descriptor. */ - tbuf_size =max_t (u16,sizeof (struct usb_hub_descriptor ), wLength); - tbuf =kzalloc (tbuf_size,GFP_KERNEL ); + tbuf_size =max_t (u16,sizeof (struct usb_hub_descriptor ), wLength); + tbuf =kzalloc (tbuf_size, mem_flags);if (!tbuf) { status = -ENOMEM ; goto err_alloc;
@@ -811,12 +812,13 @@ static int rh_queue_status (struct usb_hcd *hcd, struct urb *urb)return retval; } -static int rh_urb_enqueue (struct usb_hcd *hcd,struct urb *urb) +static int rh_urb_enqueue (struct usb_hcd *hcd, +struct urb *urb,gfp_t mem_flags) {if (usb_endpoint_xfer_int (&urb->ep->desc))return rh_queue_status (hcd, urb);if (usb_endpoint_xfer_control (&urb->ep->desc)) -return rh_call_control (hcd, urb); +return rh_call_control (hcd, urb, mem_flags);return -EINVAL ; }
@@ -1537,7 +1539,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)*/ if (is_root_hub (urb->dev)) { - status =rh_urb_enqueue (hcd, urb); + status =rh_urb_enqueue (hcd, urb, mem_flags); }else { status =map_urb_for_dma (hcd, urb, mem_flags);if (likely (status ==0 )) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 188/1250 usb: gadget: goku_udc: avoid NULL deref of dev->driver in INT_USBRESET log
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stepan Ionichev <[email protected]>
[ Upstream commit 5bf5e3fba9bc7dfd69701521dbe9809f8ccbdb02 ]
goku_irq() handles a number of bus events under a single ep0 path. It already guards the gadget driver suspend/resume callbacks against a NULL ->driver:
if (dev->gadget.speed != USB_SPEED_UNKNOWN
&& dev->driver
&& dev->driver->resume) {
spin_unlock(&dev->lock);
dev->driver->resume(&dev->gadget);
...
}but the very next branch unconditionally dereferences dev->driver when an INT_USBRESET arrives:
if (stat & INT_USBRESET) {
ACK(INT_USBRESET);
INFO(dev, "USB reset done, gadget %s\n",
dev->driver->driver.name);
}If the controller raises INT_USBRESET before any gadget driver has been bound (or after one has been unbound), dev->driver is NULL and the printk dereferences NULL.
smatch flags the inconsistency:
drivers/usb/gadget/udc/goku_udc.c:1618 goku_irq() error:
we previously assumed 'dev->driver' could be null (see line 1607)
Fall back to a placeholder when the gadget driver is not bound.
No functional change while a gadget driver is bound.
--- drivers/usb/gadget/udc/goku_udc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/goku_udc.c +2 -1
@@ -1616,7 +1616,8 @@ static irqreturn_t goku_irq(int irq, void *_dev)if (stat &INT_USBRESET ) {/* hub reset done */ ACK (INT_USBRESET );INFO (dev,"USB reset done, gadget %s\n" , - dev->driver->driver.name); + dev->driver ? dev->driver->driver.name : +"<not bound>" ); }// and INT_ERR on some endpoint's crc/bitstuff/... problem }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 189/1250 USB: cdc-acm: start bulk-IN polling when ALWAYS_POLL_CTRL is set
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Carey <[email protected]>
[ Upstream commit e5ab27ddd74e2d67a94c51c6f2ad87b1ff13912b ]
The INGENIC 17EF:6161 touchscreen composite device has a ~55-second watchdog that resets the USB device if the bulk-IN endpoint on the CDC data interface goes unread. The existing ALWAYS_POLL_CTRL quirk keeps the notification endpoint (ctrlurb / EP 0x82) polling continuously, but that alone is insufficient: the firmware monitors bulk-IN activity, not just notification-endpoint activity.
Add acm_submit_read_urbs() calls to the two ALWAYS_POLL_CTRL paths that already restart the ctrlurb:
1. acm_probe(): start bulk reads at probe time alongside the ctrlurb, so the watchdog is satisfied from first bind without requiring a userspace process to open /dev/ttyACMn.
2. acm_port_shutdown(): restart bulk reads after port close alongside the ctrlurb restart, so the watchdog keeps running when the last TTY user closes the port.
acm_read_bulk_callback() already resubmits each URB unconditionally on normal completion, so once submitted the reads remain active until an explicit kill (disconnect, suspend). acm_submit_read_urb() is a no-op for URBs that are already in flight (read_urbs_free bit clear), so the existing acm_port_activate() call remains correct and races are avoided.
Tested on Lenovo Yoga Book 9 14IAH10 (83KJ): without this patch the device resets every ~55 s when no TTY is open; with it the device remains stable indefinitely.
--- drivers/usb/class/cdc-acm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/class/cdc-acm.c +6 -0
@@ -797,6 +797,9 @@ static void acm_port_shutdown(struct tty_port *port) "ctrl polling restart failed after port close\n");/* port_shutdown() cleared DTR/RTS; restore them */ acm_set_control (acm,USB_CDC_CTRL_DTR |USB_CDC_CTRL_RTS ); +if (acm_submit_read_urbs (acm,GFP_KERNEL )) +dev_dbg (&acm->control->dev, +"read urb restart failed after port close\n" ); } }
@@ -1564,6 +1567,9 @@ static int acm_probe(struct usb_interface *intf,if (usb_submit_urb (acm->ctrlurb,GFP_KERNEL ))dev_warn (&intf->dev,"failed to start persistent ctrl polling\n" ); +if (acm_submit_read_urbs (acm,GFP_KERNEL )) +dev_warn (&intf->dev, +"failed to start persistent bulk read polling\n" ); }return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 190/1250 usb: gadget: aspeed_udc: avoid past-the-end iterator in dequeue
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maoyi Xie <[email protected]>
[ Upstream commit e2ffaac1884b921b8ec2b3a964c6a8b5d610bf4b ]
ast_udc_ep_dequeue() declares the loop cursor req outside the list_for_each_entry(). After the loop it tests &req->req != _req to decide whether the request was found. If the queue holds no match, req is past-the-end. It then aliases container_of(&ep->queue, struct ast_udc_request, queue) via offset cancellation. Whether that synthetic address equals _req depends on heap layout. The function can return 0 without dequeueing anything.
Default rc to -EINVAL and set it to 0 only inside the match branch. req is no longer read after the loop, so the past-the-end dereference goes away. No extra cursor variable or post-loop test is needed.
--- drivers/usb/gadget/udc/aspeed_udc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/aspeed_udc.c +2 -5
@@ -694,7 +694,7 @@ static int ast_udc_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)struct ast_udc_dev *udc = ep->udc;struct ast_udc_request *req;unsigned long flags; -int rc =0 ; +int rc = -EINVAL ;spin_lock_irqsave (&udc->lock, flags);
@@ -704,14 +704,11 @@ static int ast_udc_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)list_del_init (&req->queue);ast_udc_done (ep, req, -ESHUTDOWN ); _req->status = -ECONNRESET ; + rc =0 ;break ; } } -/* dequeue request not found */ -if (&req->req != _req) - rc = -EINVAL ; -spin_unlock_irqrestore (&udc->lock, flags);return rc;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 191/1250 serial: 8250: fix possible ISR soft lockup
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Felsch <[email protected]>
[ Upstream commit 0c6bf45e5a345cc3b9ffbeaf9083ecac3c2293eb ]
There are rare cases in which the host gets stuck in the ISR because it is flooded with messages during the startup phase.
The reason for the soft lockup in the ISR is the missing FIFO error IRQ (FIFOE) handling. Not handling it and reporting IRQ_HANDLED triggers the IRQ immediately again.
Fix this by adding a check for the FIFOE status and clearing the FIFO if no data is ready (DR).
This behavior was observed on an AM62L device which uses the OMAP 8250 driver. Fix it for all 8250 drivers, since the OMAP driver's special IRQ setup handling may trigger this behavior more frequently, but it is not ensured that other 8250 drivers aren't affected.
--- drivers/tty/serial/8250/8250_port.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/tty/serial/8250/8250_port.c +7 -0
@@ -1802,6 +1802,13 @@ void serial8250_handle_irq_locked(struct uart_port *port, unsigned int iir) status =serial_lsr_in (up); +/* +* Recover from no-data-ready and FIFO error condition to avoid getting +* stuck in the ISR. +*/ +if (!(status &UART_LSR_DR ) && (status &UART_LSR_FIFOE )) +serial8250_clear_and_reinit_fifos (up); +/* * If port is stopped and there are no error conditions in the * FIFO, then don't drain the FIFO, as this may lead to TTY buffer
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 192/1250 usb: host: add ARCH_AIROHA in XHCI MTK dependency
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Marangi <[email protected]>
[ Upstream commit ffeaf31f05d664581aa436d9cb92b4d1d8d301ce ]
Airoha SoC use the same register map and logic of the Mediatek xHCI driver, hence add it to the dependency list to permit compilation also on this ARCH.
--- drivers/usb/host/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/Kconfig +1 -1
@@ -71,7 +71,7 @@ config USB_XHCI_HISTB config USB_XHCI_MTK tristate "xHCI support for MediaTek SoCs" select MFD_SYSCON - depends on (MIPS && SOC_MT7621) || ARCH_MEDIATEK || COMPILE_TEST + depends on (MIPS && SOC_MT7621) || ARCH_MEDIATEK || ARCH_AIROHA || COMPILE_TEST help Say 'Y' to enable the support for the xHCI host controller found in MediaTek SoCs.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 193/1250 tty: serial: 8250: protect against NULL uart->port.dev in register
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stepan Ionichev <[email protected]>
[ Upstream commit 941c9f84c9b6310f7aaa1c8c785dcc634ee33050 ]
serial8250_register_8250_port() conditionally copies uart->port.dev from up->port.dev only when up->port.dev is non-NULL:
if (up->port.dev) {
uart->port.dev = up->port.dev;
...
}So if both the existing uart slot and up have a NULL ->dev, uart->port.dev remains NULL. The very next ACPI companion check then dereferences it unconditionally:
if (!has_acpi_companion(uart->port.dev)) {has_acpi_companion() reads dev->fwnode without a NULL guard (include/linux/acpi.h), so this NULL-derefs the kernel for the remaining no-dev case rather than just skipping the mctrl_gpio_init() initialisation as intended.
smatch flags the inconsistency:
drivers/tty/serial/8250/8250_core.c:767 serial8250_register_8250_port() error: 'uart->port.dev' could be null (see line 719)
Guard the call with a NULL check so register continues to work for callers that legitimately have no parent device (legacy non-OF/non-ACPI registrations).
No functional change for callers that pass a non-NULL ->dev.
--- drivers/tty/serial/8250/8250_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +1 -1
@@ -766,7 +766,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)* Only call mctrl_gpio_init(), if the device has no ACPI * companion device */ -if (!has_acpi_companion (uart->port.dev)) { +if (uart->port.dev && !has_acpi_companion (uart->port.dev)) {struct mctrl_gpios *gpios =mctrl_gpio_init (&uart->port,0 );if (IS_ERR (gpios)) { ret =PTR_ERR (gpios);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 194/1250 driver core: Avoid warning when removing a device while its supplier is unbinding
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herve Codina <[email protected]>
[ Upstream commit 36d74f17e03f7e60e1b08fbe16cfad6e69cc3aa9 ]
During driver removal, the following warning can appear:
WARNING: CPU: 1 PID: 139 at drivers/base/core.c:1497 __device_links_no_driver+0xcc/0xfc
...
Call trace:
__device_links_no_driver+0xcc/0xfc (P)
device_links_driver_cleanup+0xa8/0xf0
device_release_driver_internal+0x208/0x23c
device_links_unbind_consumers+0xe0/0x108
device_release_driver_internal+0xec/0x23c
device_links_unbind_consumers+0xe0/0x108
device_release_driver_internal+0xec/0x23c
device_links_unbind_consumers+0xe0/0x108
device_release_driver_internal+0xec/0x23c
driver_detach+0xa0/0x12c
bus_remove_driver+0x6c/0xbc
driver_unregister+0x30/0x60
pci_unregister_driver+0x20/0x9c
lan966x_pci_driver_exit+0x18/0xa90 [lan966x_pci]This warning is triggered when a consumer is removed because the links status of its supplier is not DL_DEV_DRIVER_BOUND and the link flag DL_FLAG_SYNC_STATE_ONLY is not set.
The topology in terms of consumers/suppliers used was the following (consumer ---> supplier):
i2c -----------> OIC ----> PCI device
| ^
| |
+---> pinctrl ---+When the PCI device is removed, the OIC (interrupt controller) has to be removed. In order to remove the OIC, pinctrl and i2c need to be removed and to remove pinctrl, i2c need to be removed. The removal order is:
1) i2c
2) pinctrl
3) OIC
4) PCI device
In details, the removal sequence is the following (with 0000:01:00.0 the PCI device):
driver_detach: call device_release_driver_internal(0000:01:00.0)...
device_links_busy(0000:01:00.0):
links->status = DL_DEV_UNBINDING
device_links_unbind_consumers(0000:01:00.0):
0000:01:00.0--oic link->status = DL_STATE_SUPPLIER_UNBIND
call device_release_driver_internal(oic)...
device_links_busy(oic):
links->status = DL_DEV_UNBINDING
device_links_unbind_consumers(oic):
oic--pinctrl link->status = DL_STATE_SUPPLIER_UNBIND
call device_release_driver_internal(pinctrl)...
device_links_busy(pinctrl):
links->status = DL_DEV_UNBINDING
device_links_unbind_consumers(pinctrl):
pinctrl--i2c link->status = DL_STATE_SUPPLIER_UNBIND
call device_release_driver_internal(i2c)...
device_links_busy(i2c): links->status = DL_DEV_UNBINDING
__device_links_no_driver(i2c)...
pinctrl--i2c link->status is DL_STATE_SUPPLIER_UNBIND
oic--i2c link->status is DL_STATE_ACTIVE
oic--i2c link->supplier->links.status is DL_DEV_UNBINDINGThe warning is triggered by the i2c removal because the OIC (supplier) links status is not DL_DEV_DRIVER_BOUND. Its links status is indeed set to DL_DEV_UNBINDING.
It is perfectly legit to have the links status set to DL_DEV_UNBINDING in that case. Indeed we had started to unbind the OIC which triggered the consumer unbinding and didn't finish yet when the i2c is unbound.
Avoid the warning when the supplier links status is set to DL_DEV_UNBINDING and thus support this removal sequence without any warnings.
--- drivers/base/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/core.c +2 -1
@@ -1500,7 +1500,8 @@ static void __device_links_no_driver(struct device *dev)if (link->supplier->links.status ==DL_DEV_DRIVER_BOUND ) {WRITE_ONCE (link->status,DL_STATE_AVAILABLE ); }else { -WARN_ON (!device_link_test (link,DL_FLAG_SYNC_STATE_ONLY )); +WARN_ON (link->supplier->links.status !=DL_DEV_UNBINDING && + !device_link_test (link,DL_FLAG_SYNC_STATE_ONLY ));WRITE_ONCE (link->status,DL_STATE_DORMANT ); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 195/1250 crypto: atmel-sha204a - remove sysfs group before hwrng
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
[ Upstream commit d58b4a09d7f06750a706b70d068f5a678dad8233 ]
atmel_sha204a_probe() registers the hwrng before creating the sysfs group. Mirror this order in atmel_sha204a_remove() by removing the sysfs group before unregistering the hwrng.
--- drivers/crypto/atmel-sha204a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/atmel-sha204a.c +1 -2
@@ -209,11 +209,10 @@ static void atmel_sha204a_remove(struct i2c_client *client) {struct atmel_i2c_client_priv *i2c_priv =i2c_get_clientdata (client); +sysfs_remove_group (&client->dev.kobj, &atmel_sha204a_groups);devm_hwrng_unregister (&client->dev, &i2c_priv->hwrng);atmel_i2c_flush_queue (); -sysfs_remove_group (&client->dev.kobj, &atmel_sha204a_groups); -kfree ((void *)i2c_priv->hwrng.priv); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 196/1250 char/nvram: Remove redundant nvram_mutex
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Venkat Rao Bagalkote <[email protected]>
[ Upstream commit e8c715f3a7dae43fabae261493a26474fec11863 ]
The global nvram_mutex in drivers/char/nvram.c is redundant and unused, and this triggers compiler warnings on some configurations.
All platform-specific nvram operations already provide their own internal synchronization, meaning the wrapper-level mutex does not provide any additional safety.
Remove the nvram_mutex definition along with all remaining lock/unlock users across PPC32, x86, and m68k code paths, and rely entirely on the per-architecture nvram implementations for locking.
--- drivers/char/nvram.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/char/nvram.c +3 -13
@@ -53,7 +53,6 @@#include <asm/nvram.h> #endif -static DEFINE_MUTEX (nvram_mutex);static DEFINE_SPINLOCK (nvram_state_lock);static int nvram_open_cnt;/* #times opened */ static int nvram_open_mode;/* special open modes */
@@ -310,11 +309,8 @@ static long nvram_misc_ioctl(struct file *file, unsigned int cmd,break ;#ifdef CONFIG_PPC32 case IOC_NVRAM_SYNC : -if (ppc_md.nvram_sync !=NULL ) { -mutex_lock (&nvram_mutex); +if (ppc_md.nvram_sync) ppc_md.nvram_sync (); -mutex_unlock (&nvram_mutex); - } ret =0 ;break ;#endif
@@ -324,11 +320,8 @@ static long nvram_misc_ioctl(struct file *file, unsigned int cmd,if (!capable (CAP_SYS_ADMIN ))return -EACCES ; -if (arch_nvram_ops.initialize !=NULL ) { -mutex_lock (&nvram_mutex); +if (arch_nvram_ops.initialize) ret = arch_nvram_ops.initialize (); -mutex_unlock (&nvram_mutex); - }break ;case NVRAM_SETCKS :/* just set checksum, contents unchanged (maybe useful after
@@ -336,11 +329,8 @@ static long nvram_misc_ioctl(struct file *file, unsigned int cmd,if (!capable (CAP_SYS_ADMIN ))return -EACCES ; -if (arch_nvram_ops.set_checksum !=NULL ) { -mutex_lock (&nvram_mutex); +if (arch_nvram_ops.set_checksum) ret = arch_nvram_ops.set_checksum (); -mutex_unlock (&nvram_mutex); - }break ;#endif /* CONFIG_X86 || CONFIG_M68K */ }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 197/1250 gpib: Suppress setting END on error from NI_USB dongle
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Penkler <[email protected]>
[ Upstream commit 7c19b47f5a1839817e5ddc5ba589224fcfb6255d ]
The NI USB adapter sets the END bit in the status word when an error occurs such as a read being interrupted by the setting of ATN. This happens for example when a device clear is received from the controller in charge during a read.
The common driver changes the error return to 0 whenever the END bit is set in order to avoid errors such as timeout or interrupt to be reported after the full message has actually been read. The behaviour of the NI USB adapter in setting the END bit on errors was causing actual errors (-EINTR, -ETIMEDOUT) not to be reported.
We avoid setting the END bit in the ni_usb_gpib driver when an error is reported in error_code of the status from the adaptor.
--- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gpib/ni_usb/ni_usb_gpib.c +1 -1
@@ -720,7 +720,7 @@ static int ni_usb_read(struct gpib_board *board, u8 *buffer, size_t length,break ; }ni_usb_soft_update_status (board, status.ibsta,0 ); -if (status.ibsta &END ) +if ((status.ibsta &END ) && (status.error_code ==NIUSB_NO_ERROR )) *end =1 ;else *end =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 198/1250 irqchip/gic-v5: Immediately exec priority drop following activate
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sascha Bischoff <[email protected]>
[ Upstream commit abf60331ebe9a9a7937a72aac7699c2907ab9307 ]
With GICv5 an interrupt of equal or lower priority cannot be signalled until there has been a priority drop. This is done via the GIC CDEOI system instruction. Once this has been executed, the hardware is able to signal the next interrupt if there is one.
As all interrupts are programmed to have the same priority, no new interrupts can be signalled until the priority drop has happened. This can cause issues when, for example, an interrupt remains active while a long running process takes place, such as when injecting a physical interrupt into a guest VM in software.
The GICv5 driver has so far done the priority drop as part of irq_eoi(), i.e., at the same time as deactivating the interrupt. This means that any long running process (or VM) could block incoming interrupts, effectively causing a denial of service for all other interrupts.
Rather than doing the EOI as part of irq_eoi() (which the name would suggest would be a good place for it), move it to happen immediately after acknowledging an interrupt in the main GICv5 interrupt handler. The deactivation of interrupts (GIC CDDI) remains implemented as part of irq_eoi(), which means that the same interrupt cannot be signalled a second time until deactivated by software.
--- drivers/irqchip/irq-gic-v5.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/irqchip/irq-gic-v5.c +8 -5
@@ -207,17 +207,13 @@ static void gicv5_hwirq_eoi(u32 hwirq_id, u8 hwirq_type)FIELD_PREP (GICV5_GIC_CDDI_TYPE_MASK , hwirq_type);gic_insn (cddi,CDDI ); - -gic_insn (0 ,CDEOI ); }static void gicv5_ppi_irq_eoi (struct irq_data *d) {/* Skip deactivate for forwarded PPI interrupts */ -if (irqd_is_forwarded_to_vcpu (d)) { -gic_insn (0 ,CDEOI ); +if (irqd_is_forwarded_to_vcpu (d))return ; - }gicv5_hwirq_eoi (d->hwirq,GICV5_HWIRQ_TYPE_PPI ); }
@@ -917,6 +913,13 @@ static void __exception_irq_entry gicv5_handle_irq(struct pt_regs *regs)*/ isb (); +/* +* Ensure that we can receive the next interrupts in the event that we +* have a long running handler or directly enter a guest by doing the +* priority drop immediately. +*/ +gic_insn (0 ,CDEOI ); + hwirq =FIELD_GET (GICV5_HWIRQ_INTID , ia);handle_irq_per_domain (hwirq);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 199/1250 pwm: mediatek: set mt7628 pwm45_fixup flag to false
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiji Yang <[email protected]>
[ Upstream commit 88c6c956fa310117638e41d4831b20074dfff2ba ]
According to the programing guide, mt7628 has generic register layout like most other hardware revisions. We should not set pwm45_fixup flag for it.
--- drivers/pwm/pwm-mediatek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-mediatek.c +1 -1
@@ -458,7 +458,7 @@ static const struct pwm_mediatek_of_data mt7623_pwm_data = {static const struct pwm_mediatek_of_data mt7628_pwm_data = { .num_pwms =4 , - .pwm45_fixup = true, + .pwm45_fixup = false, .chanreg_base =0x10 , .chanreg_width =0x40 , };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 200/1250 rcu-tasks: Fix possible boot-time tests failed for the call_rcu_tasks()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zqiang <[email protected]>
[ Upstream commit 42c5468f9cdc0c892fec3c0916b3ac5b670775af ]
The following scenarios will cause the call_rcu_tasks() boot-time tests failed:
CPU0 CPU1
rcu_init_tasks_generic() ->rcu_tasks_initiate_self_tests()
->call_rcu_tasks_trace(&tests[1].rh, test_rcu_tasks_callback)
->call_rcu_tasks_generic()
->havekthread = smp_load_acquire(&rtp->kthread_ptr)
"The havekthread is false"
....
rcu_tasks_kthread()
->smp_store_release(&rtp->kthread_ptr, current)
->rcu_tasks_one_gp()
->rcuwait_wait_event()
->rcu_tasks_need_gpcb()
->for (cpu = 0; cpu < dequeue_limit; cpu++)
->rcu_segcblist_n_cbs(&rtpcp->cblist) == 0
->schedule()
->raw_spin_trylock_rcu_node()
->needwake = (func == wakeme_after_rcu) ||
(rcu_segcblist_n_cbs(&rtpcp->cblist) == rcu_task_lazy_lim)
"the rcu_task_lazy_lim default value is 32, and the
func pointer is test_rcu_tasks_callback, lead to needwake
is false."
->if (havekthread && !needwake && !timer_pending(&rtpcp->lazy_timer))
"the havekthread is false, will not enter here."
....
"the needwake is false lead to rtp_irq_work can not queue,
even if the rtp->kthread_ptr already exists at this point."
->if (needwake && READ_ONCE(rtp->kthread_ptr))
->irq_work_queue(&rtpcp->rtp_irq_work)For the above scenarios, if the call_rcu_tasks() is not called again afterward, the rcu_tasks_kthread will not have a chance to be wakeup, the test_rcu_tasks_callback() will never be called, the boot-time tests failed can happen, this commit therefore check havekthread variable, if it's false and the rtpcp->cblist is empty, set needwake variable is true, if the rtp->kthread_ptr exist, the rtpcp->rtp_irq_work can be queued to wakeup rcu_tasks_kthread.
--- kernel/rcu/tasks.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/rcu/tasks.h +2 -1
@@ -377,7 +377,8 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func,// Queuing callbacks before initialization not yet supported. if (WARN_ON_ONCE (!rcu_segcblist_is_enabled (&rtpcp->cblist)))rcu_segcblist_init (&rtpcp->cblist); - needwake = (func == wakeme_after_rcu) || + needwake = (!havekthread &&rcu_segcblist_empty (&rtpcp->cblist)) || + (func == wakeme_after_rcu) || (rcu_segcblist_n_cbs (&rtpcp->cblist) == rcu_task_lazy_lim);if (havekthread && !needwake && !timer_pending (&rtpcp->lazy_timer)) {if (rtp->lazy_jiffies)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 201/1250 virt: acrn: Fix irqfd use-after-free during eventfd shutdown
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sicong Huang <[email protected]>
[ Upstream commit 666c7f9e07925aa0863348f960e09bb89f8f05a3 ]
acrn_irqfd_deassign() and the eventfd EPOLLHUP wakeup can race and free the same struct hsm_irqfd:
CPU0 CPU1
---- ----
eventfd_release()
wake_up_poll(EPOLLHUP)
hsm_irqfd_wakeup()
queue_work(&irqfd->shutdown)
acrn_irqfd_deassign()
hsm_irqfd_shutdown()
list_del_init()
eventfd_ctx_remove_wait_queue()
eventfd_ctx_put()
kfree(irqfd) hsm_irqfd_shutdown_work()
container_of(work, ..., shutdown)
irqfd->vm <-- use-after-free
The deassign path freed the irqfd while a shutdown work item was already queued by EPOLLHUP (or vice versa), so the work item could resurrect a dangling pointer through container_of().
Switch to the lifetime model used by KVM irqfds:
- Deassign/deinit only deactivate the irqfd: remove it from vm->irqfds under irqfds_lock and queue the cleanup work.
- hsm_irqfd_shutdown_work() becomes the sole owner that unhooks the eventfd waitqueue entry, drops the eventfd reference and frees the irqfd.
- A new HSM_IRQFD_FLAG_SHUTDOWN bit guarded by test_and_set_bit() ensures the cleanup work is queued at most once, no matter how many of {EPOLLHUP, deassign, deinit} fire concurrently. This is safe to call from the waitqueue callback, which runs with wqh->lock held and IRQs disabled and therefore cannot take irqfds_lock.
- acrn_irqfd_deassign() flushes vm->irqfd_wq before returning so the eventfd is fully detached on return. acrn_irqfd_deinit() deactivates every irqfd, flushes the workqueue and only then destroys it, so no path can queue_work() onto a torn-down workqueue.
- acrn_irqfd_assign() now installs the eventfd waitqueue entry and publishes the irqfd to vm->irqfds under irqfds_lock, so the irqfd is never visible to deassign/deinit before its waitqueue entry is in place, and any EPOLLHUP that fires in the assign window queues cleanup work that blocks on irqfds_lock until publication is done.
--- drivers/virt/acrn/irqfd.c | 71 ++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 27 deletions(-)
drivers/virt/acrn/irqfd.c +44 -27
@@ -16,6 +16,9 @@#include "acrn_drv.h" +/* Cleanup work has been queued; set via test_and_set_bit(). */ +#define HSM_IRQFD_FLAG_SHUTDOWN 0 +/** * struct hsm_irqfd - Properties of HSM irqfd * @vm: Associated VM pointer
@@ -25,6 +28,7 @@* @list: Entry within &acrn_vm.irqfds of irqfds of a VM * @pt: Structure for select/poll on the associated eventfd * @msi: MSI data +* @flags: Internal lifecycle flags (HSM_IRQFD_FLAG_*) */ struct hsm_irqfd {struct acrn_vm *vm;
@@ -34,6 +38,7 @@ struct hsm_irqfd {struct list_head list;poll_table pt;struct acrn_msi_entry msi; +unsigned long flags; };static void acrn_irqfd_inject (struct hsm_irqfd *irqfd)
@@ -44,30 +49,29 @@ static void acrn_irqfd_inject(struct hsm_irqfd *irqfd) irqfd->msi.msi_data); } -static void hsm_irqfd_shutdown (struct hsm_irqfd *irqfd) +/* Queue the cleanup work at most once. Safe from atomic context. */ +static void hsm_irqfd_queue_shutdown (struct hsm_irqfd *irqfd) { -u64 cnt; - -lockdep_assert_held (&irqfd->vm->irqfds_lock); - -/* remove from wait queue */ -list_del_init (&irqfd->list); -eventfd_ctx_remove_wait_queue (irqfd->eventfd, &irqfd->wait, &cnt); -eventfd_ctx_put (irqfd->eventfd); -kfree (irqfd); +if (!test_and_set_bit (HSM_IRQFD_FLAG_SHUTDOWN , &irqfd->flags)) +queue_work (irqfd->vm->irqfd_wq, &irqfd->shutdown); } +/* Sole owner of @irqfd: unhook waitqueue, drop eventfd ref, free. */ static void hsm_irqfd_shutdown_work (struct work_struct *work) { -struct hsm_irqfd *irqfd; -struct acrn_vm *vm; + struct hsm_irqfd *irqfd = container_of(work, struct hsm_irqfd, + shutdown); +struct acrn_vm *vm = irqfd->vm; +u64 cnt; - irqfd = container_of(work, struct hsm_irqfd, shutdown); - vm = irqfd->vm;mutex_lock (&vm->irqfds_lock);if (!list_empty (&irqfd->list)) -hsm_irqfd_shutdown (irqfd); +list_del_init (&irqfd->list);mutex_unlock (&vm->irqfds_lock); + +eventfd_ctx_remove_wait_queue (irqfd->eventfd, &irqfd->wait, &cnt); +eventfd_ctx_put (irqfd->eventfd); +kfree (irqfd); }/* Called with wqh->lock held and interrupts disabled */
@@ -76,17 +80,16 @@ static int hsm_irqfd_wakeup(wait_queue_entry_t *wait, unsigned int mode, {unsigned long poll_bits = (unsigned long )key;struct hsm_irqfd *irqfd; -struct acrn_vm *vm; irqfd = container_of(wait, struct hsm_irqfd, wait); - vm = irqfd->vm; +if (poll_bits &POLLIN )/* An event has been signaled, inject an interrupt */ acrn_irqfd_inject (irqfd);if (poll_bits &POLLHUP ) -/* Do shutdown work in thread to hold wqh->lock */ -queue_work (vm->irqfd_wq, &irqfd->shutdown); +/* Defer teardown to the cleanup work; can't sleep here. */ +hsm_irqfd_queue_shutdown (irqfd);return 0 ; }
@@ -142,6 +145,12 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args)init_waitqueue_func_entry (&irqfd->wait, hsm_irqfd_wakeup);init_poll_funcptr (&irqfd->pt, hsm_irqfd_poll_func); +/* +* Hold irqfds_lock across waitqueue install and list_add so the +* irqfd is not visible to deassign/deinit before its waitqueue +* entry is in place, and any racing EPOLLHUP cleanup work blocks +* on irqfds_lock until publication completes. +*/ mutex_lock (&vm->irqfds_lock);list_for_each_entry (tmp, &vm->irqfds, list) {if (irqfd->eventfd != tmp->eventfd)
@@ -150,14 +159,12 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args)mutex_unlock (&vm->irqfds_lock); goto fail; } -list_add_tail (&irqfd->list, &vm->irqfds); -mutex_unlock (&vm->irqfds_lock); -/* Check the pending event in this stage */ events =vfs_poll (fd_file (f), &irqfd->pt); - +list_add_tail (&irqfd->list, &vm->irqfds);if (events &EPOLLIN )acrn_irqfd_inject (irqfd); +mutex_unlock (&vm->irqfds_lock);return 0 ; fail:
@@ -180,13 +187,17 @@ static int acrn_irqfd_deassign(struct acrn_vm *vm,mutex_lock (&vm->irqfds_lock);list_for_each_entry_safe (irqfd, tmp, &vm->irqfds, list) {if (irqfd->eventfd == eventfd) { -hsm_irqfd_shutdown (irqfd); +list_del_init (&irqfd->list); +hsm_irqfd_queue_shutdown (irqfd);break ; } }mutex_unlock (&vm->irqfds_lock);eventfd_ctx_put (eventfd); +/* Wait for cleanup work to finish so the eventfd is fully detached. */ +flush_workqueue (vm->irqfd_wq); +return 0 ; }
@@ -219,9 +230,15 @@ void acrn_irqfd_deinit(struct acrn_vm *vm)struct hsm_irqfd *irqfd, *next;dev_dbg (acrn_dev.this_device,"VM %u irqfd deinit.\n" , vm->vmid); -destroy_workqueue (vm->irqfd_wq); +mutex_lock (&vm->irqfds_lock); -list_for_each_entry_safe (irqfd, next, &vm->irqfds, list) -hsm_irqfd_shutdown (irqfd); +list_for_each_entry_safe (irqfd, next, &vm->irqfds, list) { +list_del_init (&irqfd->list); +hsm_irqfd_queue_shutdown (irqfd); + }mutex_unlock (&vm->irqfds_lock); + +/* Drain all cleanup work before tearing the workqueue down. */ +flush_workqueue (vm->irqfd_wq); +destroy_workqueue (vm->irqfd_wq); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 202/1250 wifi: rtw89: pci: enable LTR based on pcie control register
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dian-Syuan Yang <[email protected]>
[ Upstream commit 779bbe1902f29d0ef131249ddd42a8dfbe21d0fb ]
Originally, driver always transmits LTR (Latency Tolerance Reporting) to pcie host, but it may cause pcie link down on some platforms because LTR is not supported. As a result, driver will check the control register of LTR setting to decide whether to enable LTR feature.
This applies to Wi-Fi 6 chips only. For Wi-Fi 7 chips, although the driver still issues LTR, the hardware has its own internal logic to determine whether to actually transmit it to pcie host.
--- drivers/net/wireless/realtek/rtw89/pci.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/pci.c +15 -1
@@ -3036,6 +3036,17 @@ static int rtw89_pci_mode_op(struct rtw89_dev *rtwdev)return 0 ; } +static bool rtw89_pci_dev_ltr_enabled (struct rtw89_dev *rtwdev) +{ +struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv; +struct pci_dev *pdev = rtwpci->pdev; +u16 cap; + +pcie_capability_read_word (pdev,PCI_EXP_DEVCTL2 , &cap); + +return !!(cap &PCI_EXP_DEVCTL2_LTR_EN ); +} +static int rtw89_pci_ops_deinit (struct rtw89_dev *rtwdev) {const struct rtw89_pci_info *info = rtwdev->pci_info;
@@ -3140,7 +3151,7 @@ int rtw89_pci_ltr_set(struct rtw89_dev *rtwdev, bool en) {u32 val; -if (!en) +if (!en || !rtw89_pci_dev_ltr_enabled (rtwdev))return 0 ; val =rtw89_read32 (rtwdev,R_AX_LTR_CTRL_0 );
@@ -3176,6 +3187,9 @@ int rtw89_pci_ltr_set_v1(struct rtw89_dev *rtwdev, bool en)u32 dec_ctrl;u32 val32; +if (!rtw89_pci_dev_ltr_enabled (rtwdev)) +return 0 ; + val32 =rtw89_read32 (rtwdev,R_AX_LTR_CTRL_0 );if (rtw89_pci_ltr_is_err_reg_val (val32))return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 203/1250 netlabel: fix IPv6 unlabeled address add error handling
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenguang Zhao <[email protected]>
[ Upstream commit 56872b930feee7ae07b9720ca950dd9fa65596ee ]
netlbl_unlhsh_add_addr6() always returned zero after netlbl_af6list_add(), masking failures such as duplicate IPv6 static label entries.
--- net/netlabel/netlabel_unlabeled.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netlabel/netlabel_unlabeled.c +1 -1
@@ -295,7 +295,7 @@ static int netlbl_unlhsh_add_addr6(struct netlbl_unlhsh_iface *iface,if (ret_val !=0 )kfree (entry); - return 0; + return ret_val; }#endif /* IPv6 */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 204/1250 RDMA/counter: Fix num_counters leak on bind_qp failure in alloc_and_bind()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Cui <[email protected]>
[ Upstream commit 4fbc8230009f5b1bcd13cc74c5a6a43ddba141fd ]
When __rdma_counter_bind_qp() fails in alloc_and_bind(), the error path jumps to err_mode which frees the counter without decrementing port_counter->num_counters. The only place that decrements is rdma_counter_free(), which is unreachable since the counter was never successfully bound.
This leak accumulates across repeated failures, permanently preventing the port from switching to AUTO mode (-EBUSY in __counter_set_mode()) and blocking the MANUAL→NONE auto-revert in rdma_counter_free(). When the mode was NONE before the call, the MANUAL mode set by __counter_set_mode() also leaks since the revert logic is never reached.
Add an err_bind label between the num_counters increment and the existing err_mode label. It decrements num_counters and mirrors the MANUAL→NONE revert from rdma_counter_free(), ensuring the port state is fully restored on bind failure.
--- drivers/infiniband/core/counters.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/infiniband/core/counters.c +9 -1
@@ -198,12 +198,20 @@ static struct rdma_counter *alloc_and_bind(struct ib_device *dev, u32 port, ret =__rdma_counter_bind_qp (counter, qp, port);if (ret) - goto err_mode; + goto err_bind;rdma_restrack_parent_name (&counter->res, &qp->res);rdma_restrack_add (&counter->res);return counter; +err_bind: +mutex_lock (&port_counter->lock); + port_counter->num_counters--; +if (!port_counter->num_counters && + port_counter->mode.mode ==RDMA_COUNTER_MODE_MANUAL ) +__counter_set_mode (port_counter,RDMA_COUNTER_MODE_NONE ,0 , + false); +mutex_unlock (&port_counter->lock); err_mode:rdma_free_hw_stats_struct (counter->stats); err_stats:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 205/1250 ALSA: seq: Remove arbitrary prioq insertion limit
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit 3fcc84f1f8d28cc1966b859cef33c858ff531766 ]
The sequencer priority queue insertion path uses a hardcoded traversal limit of 10000 entries. The value is intended to catch a corrupted list, but it also becomes a real limit for valid queues.
The event pool limit is per client, while a sequencer queue can be shared by multiple clients. A queue can therefore legitimately contain more than 10000 events. In that case, inserting an event that has to be placed past the arbitrary limit fails with -EINVAL.
Use the queue's own cell count as the traversal bound instead. This keeps the protection against inconsistent list accounting or cyclic lists without rejecting valid large queues.
--- sound/core/seq/seq_prioq.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
sound/core/seq/seq_prioq.c +8 -6
@@ -132,7 +132,7 @@ int snd_seq_prioq_cell_in(struct snd_seq_prioq * f, struct snd_seq_event_cell * cell) {struct snd_seq_event_cell *cur, *prev; -int count; +int remaining;int prior;if (snd_BUG_ON (!f || !cell))
@@ -162,10 +162,16 @@ int snd_seq_prioq_cell_in(struct snd_seq_prioq * f, prev =NULL ;/* previous cell */ cur = f->head;/* cursor */ - count =10000 ;/* FIXME: enough big, isn't it? */ + remaining = f->cells;while (cur !=NULL ) {/* compare timestamps */ int rel =compare_timestamp_rel (&cell->event, &cur->event); + +if (remaining-- <=0 ) { +pr_err ("ALSA: seq: inconsistent prioq cell count\n" ); +return -EINVAL ; + } +if (rel <0 )/* new cell has earlier schedule time, */ break ;
@@ -176,10 +182,6 @@ int snd_seq_prioq_cell_in(struct snd_seq_prioq * f,/* move cursor to next cell */ prev = cur; cur = cur->next; -if (! --count) { -pr_err ("ALSA: seq: cannot find a pointer.. infinite loop?\n" ); -return -EINVAL ; - } }/* insert it before cursor */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 206/1250 rds: filter RDS_INFO_* getsockopt by callers netns
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maoyi Xie <[email protected]>
[ Upstream commit c96a5209dda666004b8ee1ed7f0d493d09a4f200 ]
The RDS_INFO_* family of getsockopt(2) options reads several file-scope global lists that are not per-netns:
rds_sock_info / rds6_sock_info,
rds_sock_inc_info / rds6_sock_inc_info -> rds_sock_list
rds_tcp_tc_info / rds6_tcp_tc_info -> rds_tcp_tc_list
rds_conn_info / rds6_conn_info, rds_conn_message_info_cmn (for the *_SEND_MESSAGES and *_RETRANS_MESSAGES variants), rds_for_each_conn_info (for RDS_INFO_IB_CONNECTIONS)
-> rds_conn_hash[]
The handlers do not filter by the caller's network namespace. rds_info_getsockopt() has no netns or capable() check, and rds_create() has no capable() check, so AF_RDS is reachable from an unprivileged user namespace. As a result, an unprivileged caller in a fresh user_ns plus netns can read the bound address and sock inode of every RDS socket on the host, the peer address of incoming messages on every RDS socket on the host, the peer address and TCP sequence numbers of every rds-tcp connection on the host, and the peer address and RDS sequence numbers of every RDS connection on the host.
The rds-tcp transport is reachable from a non-initial netns (see rds_set_transport()), so a one-shot init_net gate at rds_info_getsockopt() would deny legitimate per-netns visibility to rds-tcp callers. Instead, filter at each handler by comparing the netns of the caller's socket to the netns of the list entry, or to rds_conn_net(conn) for connection paths. Only copy entries whose netns matches the caller. Counters (RDS_INFO_COUNTERS) are aggregate statistics and remain global.
Reproducer (KASAN VM, rds and rds_tcp loaded): an AF_RDS socket binds 127.0.0.1:4242 in init_net as root. A child process enters a fresh user_ns plus netns and opens AF_RDS there, then calls getsockopt(SOL_RDS, RDS_INFO_SOCKETS). Before this change, the child sees the init_net socket. After this change, the child sees zero entries.
Drop the rds_sock_count, rds_tcp_tc_count, and rds6_tcp_tc_count globals. v2 used them for the size precheck and lens->nr; v3 replaced the precheck with a per-ns count from a first pass over the list, so the globals have no remaining readers. The matching increments and decrements in rds_create()/rds_destroy_sock() and rds_tcp_set_callbacks()/rds_tcp_restore_callbacks() go away with them. Reported by the kernel test robot under clang W=1.
--- net/rds/af_rds.c | 59 ++++++++++++++++++++++++++++++++++------- net/rds/connection.c | 13 +++++++++ net/rds/tcp.c | 63 ++++++++++++++++++++++++++++---------------- 3 files changed, 104 insertions(+), 31 deletions(-)
net/rds/af_rds.c +50 -9
@@ -43,7 +43,6 @@/* this is just used for stats gathering :/ */ static DEFINE_SPINLOCK (rds_sock_lock); -static unsigned long rds_sock_count;static LIST_HEAD (rds_sock_list);DECLARE_WAIT_QUEUE_HEAD (rds_poll_waitq);
@@ -82,7 +81,6 @@ static int rds_release(struct socket *sock)spin_lock_bh (&rds_sock_lock);list_del_init (&rs->rs_item); - rds_sock_count--;spin_unlock_bh (&rds_sock_lock);rds_trans_put (rs->rs_transport);
@@ -694,7 +692,6 @@ static int __rds_create(struct socket *sock, struct sock *sk, int protocol)spin_lock_bh (&rds_sock_lock);list_add_tail (&rs->rs_item, &rds_sock_list); - rds_sock_count++;spin_unlock_bh (&rds_sock_lock);return 0 ;
@@ -735,6 +732,7 @@ static void rds_sock_inc_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + struct net *net = sock_net(sock->sk);struct rds_sock *rs;struct rds_incoming *inc;unsigned int total =0 ;
@@ -744,6 +742,9 @@ static void rds_sock_inc_info(struct socket *sock, unsigned int len,spin_lock_bh (&rds_sock_lock);list_for_each_entry (rs, &rds_sock_list, rs_item) { +/* Only show sockets in the caller's netns. */ +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ;/* This option only supports IPv4 sockets. */ if (!ipv6_addr_v4mapped (&rs->rs_bound_addr))continue ;
@@ -774,6 +775,7 @@ static void rds6_sock_inc_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + struct net *net = sock_net(sock->sk);struct rds_incoming *inc;unsigned int total =0 ;struct rds_sock *rs;
@@ -783,6 +785,9 @@ static void rds6_sock_inc_info(struct socket *sock, unsigned int len,spin_lock_bh (&rds_sock_lock);list_for_each_entry (rs, &rds_sock_list, rs_item) { +/* Only show sockets in the caller's netns. */ +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ;read_lock (&rs->rs_recv_lock);list_for_each_entry (inc, &rs->rs_recv_queue, i_item) {
@@ -806,7 +811,9 @@ static void rds_sock_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + struct net *net = sock_net(sock->sk);struct rds_info_socket sinfo; +unsigned int copied =0 ;unsigned int cnt =0 ;struct rds_sock *rs;
@@ -814,12 +821,24 @@ static void rds_sock_info(struct socket *sock, unsigned int len,spin_lock_bh (&rds_sock_lock); -if (len < rds_sock_count) { - cnt = rds_sock_count; - goto out; +/* First pass: count entries visible in the caller's netns. */ +list_for_each_entry (rs, &rds_sock_list, rs_item) { +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ; +if (!ipv6_addr_v4mapped (&rs->rs_bound_addr)) +continue ; + cnt++; } +if (len < cnt) + goto out; +list_for_each_entry (rs, &rds_sock_list, rs_item) { +if (copied >= cnt) +break ; +/* Only show sockets in the caller's netns. */ +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ;/* This option only supports IPv4 sockets. */ if (!ipv6_addr_v4mapped (&rs->rs_bound_addr))continue ;
@@ -832,8 +851,13 @@ static void rds_sock_info(struct socket *sock, unsigned int len, sinfo.inum =sock_i_ino (rds_rs_to_sk (rs));rds_info_copy (iter, &sinfo,sizeof (sinfo)); - cnt++; + copied++; } +/* A concurrent rds_bind() can change rs_bound_addr between the +* two passes without holding rds_sock_lock, so copied may be +* less than cnt. Report what was actually copied. +*/ + cnt = copied; out: lens->nr = cnt;
@@ -847,17 +871,32 @@ static void rds6_sock_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + struct net *net = sock_net(sock->sk);struct rds6_info_socket sinfo6; +unsigned int copied =0 ; +unsigned int cnt =0 ;struct rds_sock *rs; len /=sizeof (struct rds6_info_socket );spin_lock_bh (&rds_sock_lock); -if (len < rds_sock_count) +/* First pass: count entries visible in the caller's netns. */ +list_for_each_entry (rs, &rds_sock_list, rs_item) { +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ; + cnt++; + } + +if (len < cnt) goto out;list_for_each_entry (rs, &rds_sock_list, rs_item) { +if (copied >= cnt) +break ; +/* Only show sockets in the caller's netns. */ +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ; sinfo6.sndbuf =rds_sk_sndbuf (rs); sinfo6.rcvbuf =rds_sk_rcvbuf (rs); sinfo6.bound_addr = rs->rs_bound_addr;
@@ -867,10 +906,12 @@ static void rds6_sock_info(struct socket *sock, unsigned int len, sinfo6.inum =sock_i_ino (rds_rs_to_sk (rs));rds_info_copy (iter, &sinfo6,sizeof (sinfo6)); + copied++; } + cnt = copied; out: - lens->nr = rds_sock_count; + lens->nr = cnt; lens->each =sizeof (struct rds6_info_socket );spin_unlock_bh (&rds_sock_lock);
net/rds/connection.c +13 -0
@@ -541,6 +541,7 @@ static void rds_conn_message_info_cmn(struct socket *sock, unsigned int len,struct rds_info_lengths *lens, int want_send, bool isv6) { + struct net *net = sock_net(sock->sk);struct hlist_head *head;struct list_head *list;struct rds_connection *conn;
@@ -563,6 +564,9 @@ static void rds_conn_message_info_cmn(struct socket *sock, unsigned int len,struct rds_conn_path *cp;int npaths; +/* Only show connections in the caller's netns. */ +if (!net_eq (rds_conn_net (conn), net)) +continue ;if (!isv6 && conn->c_isv6)continue ;
@@ -661,6 +665,7 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len, u64 *buffer, size_t item_len) { +struct net *net =sock_net (sock->sk);struct hlist_head *head;struct rds_connection *conn;size_t i;
@@ -673,6 +678,9 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len,for (i =0 , head = rds_conn_hash; i <ARRAY_SIZE (rds_conn_hash); i++, head++) {hlist_for_each_entry_rcu (conn, head, c_hash_node) { +/* Only show connections in the caller's netns. */ +if (!net_eq (rds_conn_net (conn), net)) +continue ;/* Zero the per-item buffer before handing it to the * visitor so any field the visitor does not write -
@@ -706,6 +714,7 @@ static void rds_walk_conn_path_info(struct socket *sock, unsigned int len, u64 *buffer, size_t item_len) { +struct net *net =sock_net (sock->sk);struct hlist_head *head;struct rds_connection *conn;size_t i;
@@ -720,6 +729,10 @@ static void rds_walk_conn_path_info(struct socket *sock, unsigned int len,hlist_for_each_entry_rcu (conn, head, c_hash_node) {struct rds_conn_path *cp; +/* Only show connections in the caller's netns. */ +if (!net_eq (rds_conn_net (conn), net)) +continue ; +/* XXX We only copy the information from the first * path for now. The problem is that if there are * more than one underlying paths, we cannot report
net/rds/tcp.c +41 -22
136 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 207/1250 rds: annotate data-race around rs_seen_congestion
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 67636cab273ed0c0b0f2adab6c9369a471cb7966 ]
rs_seen_congestion is read in rds_poll() and written in rds_sendmsg() and rds_poll() without any lock. Use READ_ONCE()/WRITE_ONCE() to annotate these lockless accesses and silence KCSAN.
--- net/rds/af_rds.c | 4 ++-- net/rds/send.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
net/rds/af_rds.c +2 -2
@@ -217,7 +217,7 @@ static __poll_t rds_poll(struct file *file, struct socket *sock,poll_wait (file,sk_sleep (sk), wait); -if (rs->rs_seen_congestion) +if (READ_ONCE (rs->rs_seen_congestion))poll_wait (file, &rds_poll_waitq, wait);read_lock_irqsave (&rs->rs_recv_lock, flags);
@@ -245,7 +245,7 @@ static __poll_t rds_poll(struct file *file, struct socket *sock,/* clear state any time we wake a seen-congested socket */ if (mask) - rs->rs_seen_congestion =0 ; +WRITE_ONCE (rs->rs_seen_congestion,0 );return mask; }
net/rds/send.c +1 -1
@@ -1339,7 +1339,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len) ret =rds_cong_wait (conn->c_fcong, dport, nonblock, rs);if (ret) { - rs->rs_seen_congestion =1 ; +WRITE_ONCE (rs->rs_seen_congestion,1 ); goto out; } while (!rds_send_queue_rm(rs, conn, cpath, rm, rs->rs_bound_port,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 208/1250 s390/zcore: Removed unused variables
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit 0a2aa995c0a1d363b5f0803862e84834e3876ae2 ]
allmodconfig with clang W=1 points out unused global variables:
drivers/s390/char/zcore.c:49:23: error: variable
'zcore_reipl_file' set but not used [-Werror,-Wunused-but-set-global]drivers/s390/char/zcore.c:50:23: error: variable
'zcore_hsa_file' set but not used [-Werror,-Wunused-but-set-global]
Remove both of them, since there is no point in keeping them.
--- drivers/s390/char/zcore.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/s390/char/zcore.c +2 -6
@@ -47,8 +47,6 @@ struct ipib_info {static struct debug_info *zcore_dbf;static int hsa_available;static struct dentry *zcore_dir; -static struct dentry *zcore_reipl_file; -static struct dentry *zcore_hsa_file;static struct ipl_parameter_block *zcore_ipl_block;static unsigned long os_info_flags;
@@ -354,10 +352,8 @@ static int __init zcore_init(void) goto fail; zcore_dir =debugfs_create_dir ("zcore" ,NULL ); - zcore_reipl_file =debugfs_create_file ("reipl" ,S_IRUSR , zcore_dir, -NULL , &zcore_reipl_fops); - zcore_hsa_file =debugfs_create_file ("hsa" ,S_IRUSR |S_IWUSR , zcore_dir, -NULL , &zcore_hsa_fops); +debugfs_create_file ("reipl" ,S_IRUSR , zcore_dir,NULL , &zcore_reipl_fops); +debugfs_create_file ("hsa" ,S_IRUSR |S_IWUSR , zcore_dir,NULL , &zcore_hsa_fops);register_reboot_notifier (&zcore_reboot_notifier);atomic_notifier_chain_register (&panic_notifier_list, &zcore_on_panic_notifier);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 209/1250 clk: socfpga: agilex: implement l3_main_free_clk
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Ng Ho Yin <[email protected]>
[ Upstream commit 1e7f56205813a2c48cdb3e9a4b0a24f49fd9a548 ]
The AGILEX_L3_MAIN_FREE_CLK is defined in the dt-bindings header but was never implemented in the clock driver. Per the Agilex TRM, l3_main_free_clk has no divider or mux and is a fixed 1:1 derivative of noc_free_clk that clocks most of the interconnect datapath.
--- drivers/clk/socfpga/clk-agilex.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/socfpga/clk-agilex.c +2 -0
@@ -259,6 +259,8 @@ static const struct stratix10_perip_cnt_clock agilex_main_perip_cnt_clks[] = { 0, 0x3C, 0, 0, 0}, {AGILEX_NOC_FREE_CLK ,"noc_free_clk" ,NULL , noc_free_mux,ARRAY_SIZE (noc_free_mux), 0, 0x40, 0, 0, 0}, + { AGILEX_L3_MAIN_FREE_CLK, "l3_main_free_clk", "noc_free_clk", NULL, + 1, 0, 0, 1, 0, 0}, { AGILEX_L4_SYS_FREE_CLK, "l4_sys_free_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux), 0, 0, 4, 0x30, 1}, { AGILEX_EMAC_A_FREE_CLK, "emaca_free_clk", NULL, emaca_free_mux, ARRAY_SIZE(emaca_free_mux),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 210/1250 thermal/drivers/tegra/soctherma: Switch to devm cooling device registration
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Lezcano <[email protected]>
[ Upstream commit ee126267bc04bfb03816ae9d71ca24c5bf99e739 ]
Use devm_thermal_of_cooling_device_register() to simplify resource management and avoid manual cleanup in error paths.
As a side effect this change has the benefit of solving an existing issue. Before, the function tegra_soctherm_remove() only called debugfs_remove_recursive() and never called thermal_cooling_device_unregister() for any of the cooling devices registered here.
After the driver removal, the thermal framework's cdev list would still hold references to thermal_cooling_device objects whose devdata pointer (ts) pointed to memory already freed by the platform device's devm cleanup.
With this change, the cooling device is unregistered when the driver is removed, thus fixing the issue above.
--- drivers/thermal/tegra/soctherm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/thermal/tegra/soctherm.c +3 -3
@@ -1700,9 +1700,9 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev) stc->init = true; }else { - tcd =thermal_of_cooling_device_register (np_stcc, - (char *)name, ts, - &throt_cooling_ops); + tcd =devm_thermal_of_cooling_device_register (dev, np_stcc, + (char *)name, ts, + &throt_cooling_ops);if (IS_ERR_OR_NULL (tcd)) { dev_err(dev, "throttle-cfg: %s: failed to register cooling device\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 211/1250 wifi: iwlwifi: fix the access to CNVR TOP registers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit c73869c1df2a27dc3c928e94b42660124318f727 ]
For Dr and Sc, we need to wait until the TOP is ready to gets its registers read by the host.
--- drivers/net/wireless/intel/iwlwifi/iwl-io.c | 18 ++++++++++++- drivers/net/wireless/intel/iwlwifi/iwl-io.h | 4 ++- drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 7 ++++- .../intel/iwlwifi/pcie/gen1_2/trans.c | 26 ++++++++++++++++++- 4 files changed, 51 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-io.c +17 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2003-2014, 2018-2022, 2024-2025 Intel Corporation +* Copyright (C) 2003-2014, 2018-2022, 2024-2026 Intel Corporation * Copyright (C) 2015-2016 Intel Deutschland GmbH */ #include <linux/device.h>
@@ -168,6 +168,22 @@ int iwl_poll_prph_bit(struct iwl_trans *trans, u32 addr,return -ETIMEDOUT ; } +int iwl_poll_umac_prph_bits_no_grab (struct iwl_trans *trans,u32 addr, +u32 bits,u32 mask,int timeout) +{ +int t =0 ; + +do { +if ((iwl_read_umac_prph_no_grab (trans, addr) & mask) == + (bits & mask)) +return 0 ; +udelay (IWL_POLL_INTERVAL ); + t +=IWL_POLL_INTERVAL ; + }while (t < timeout); + +return -ETIMEDOUT ; +} +void iwl_set_bits_prph (struct iwl_trans *trans,u32 ofs,u32 mask) {if (iwl_trans_grab_nic_access (trans)) {
drivers/net/wireless/intel/iwlwifi/iwl-io.h +3 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright (C) 2018-2021, 2025 Intel Corporation +* Copyright (C) 2018-2021, 2025-2026 Intel Corporation */ #ifndef __iwl_io_h__#define __iwl_io_h__
@@ -51,6 +51,8 @@ static inline void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val)int iwl_poll_prph_bit (struct iwl_trans *trans,u32 addr,u32 bits,u32 mask,int timeout); +int iwl_poll_umac_prph_bits_no_grab (struct iwl_trans *trans,u32 addr, +u32 bits,u32 mask,int timeout);void iwl_set_bits_prph (struct iwl_trans *trans,u32 ofs,u32 mask);void iwl_set_bits_mask_prph (struct iwl_trans *trans,u32 ofs,u32 bits,u32 mask);
drivers/net/wireless/intel/iwlwifi/iwl-prph.h +6 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright (C) 2005-2014, 2018-2025 Intel Corporation +* Copyright (C) 2005-2014, 2018-2026 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016 Intel Deutschland GmbH */
@@ -411,6 +411,11 @@ enum {#define HPM_SECONDARY_DEVICE_STATE 0xa03404#define WFPM_MAC_OTP_CFG7_ADDR 0xa03338#define WFPM_MAC_OTP_CFG7_DATA 0xa0333c +#define WFPM_RSRCS_4PHS_REQ_STTS 0xa033f8 +#define WFPM_RSRCS_4PHS_ACK_STTS 0xa033fc + +#define RSRC_REQ_CNVR_TOP BIT(6) +#define RSRC_ACK_CNVR_TOP BIT(6)/* For UMAG_GEN_HW_STATUS reg check */
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c +25 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2007-2015, 2018-2024 Intel Corporation +* Copyright (C) 2007-2015, 2018-2024, 2026 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */
@@ -4000,6 +4000,30 @@ static void get_crf_id(struct iwl_trans *iwl_trans,else sd_reg_ver_addr =SD_REG_VER ; +/* wait until the device is ready to access the prph registers */ +if (iwl_trans->mac_cfg->device_family ==IWL_DEVICE_FAMILY_DR || + iwl_trans->mac_cfg->device_family ==IWL_DEVICE_FAMILY_SC ) { +u32 req =iwl_read_umac_prph_no_grab (iwl_trans, +WFPM_RSRCS_4PHS_REQ_STTS ); +int ret; + +if (!(req &RSRC_REQ_CNVR_TOP )) { +IWL_ERR (iwl_trans, +"WFPM_RSRCS_4PHS_REQ_STTS bit 6 is clear 0x%x\n" , + req); +return ; + } + + ret =iwl_poll_umac_prph_bits_no_grab (iwl_trans, +WFPM_RSRCS_4PHS_ACK_STTS , +RSRC_ACK_CNVR_TOP , +RSRC_ACK_CNVR_TOP , +50 *1000 ); +if (ret <0 ) +IWL_ERR (iwl_trans, +"WFPM_RSRCS_4PHS_ACK_STTS bit 6 is clear\n" ); + } +/* Enable access to peripheral registers */ val =iwl_read_umac_prph_no_grab (iwl_trans,WFPM_CTRL_REG ); val |=WFPM_AUX_CTL_AUX_IF_MAC_OWNER_MSK ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 212/1250 wifi: iwlwifi: mld: honor BSS_CHANGED_BEACON_ENABLED
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit a342c99cb70dde344723f6c802efd24e614f4fda ]
We should stick to mac80211's flow to start / stop beaconing. This allows to stop beaconing before we remove the BIGTK.
Note that the start and stop beaconing flows are not exactly symmetric. When we start beaconing, we just update the beacon template. We assume that mac80211 won't update the beacons, if we're not supposed to be sending it.
Also note that we now send the beacon template after the broadcast station was added to the firmware: the broadcast station is added in the start_ap() flow, while the beacon template is now added in the link_changed() flow which happens later. This is not what we did before this patch, but this sequence is supported by the firmware as well.
--- drivers/net/wireless/intel/iwlwifi/mld/ap.c | 25 +++++++++++++++---- drivers/net/wireless/intel/iwlwifi/mld/ap.h | 6 ++++- .../net/wireless/intel/iwlwifi/mld/mac80211.c | 8 +++++- 3 files changed, 32 insertions(+), 7 deletions(-)
drivers/net/wireless/intel/iwlwifi/mld/ap.c +20 -5
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2024 Intel Corporation +* Copyright (C) 2024, 2026 Intel Corporation */ #include <linux/crc32.h>
@@ -239,6 +239,25 @@ int iwl_mld_store_ap_early_key(struct iwl_mld *mld,return -ENOSPC ; } +void iwl_mld_stop_beacon (struct iwl_mld *mld,struct ieee80211_vif *vif, +struct ieee80211_bss_conf *link) +{ +struct iwl_mld_link *mld_link =iwl_mld_link_from_mac80211 (link); +struct iwl_mac_beacon_cmd cmd = {}; +int cmd_ver =iwl_fw_lookup_cmd_ver (mld->fw,BEACON_TEMPLATE_CMD ,14 ); + +if (WARN_ON (!mld_link)) +return ; + +if (cmd_ver <15 ) +return ; + +/* leave byte_cnt 0 */ + cmd.link_id =cpu_to_le32 (mld_link->fw_id); + +iwl_mld_send_cmd_pdu (mld,BEACON_TEMPLATE_CMD , &cmd); +} +static int iwl_mld_send_ap_early_keys (struct iwl_mld *mld,struct ieee80211_vif *vif,struct ieee80211_bss_conf *link)
@@ -276,10 +295,6 @@ int iwl_mld_start_ap_ibss(struct ieee80211_hw *hw,if (vif->type ==NL80211_IFTYPE_AP )iwl_mld_send_ap_tx_power_constraint_cmd (mld, vif, link); - ret =iwl_mld_update_beacon_template (mld, vif, link); -if (ret) -return ret; -/* the link should be already activated when assigning chan context, * and LINK_CONTEXT_MODIFY_EHT_PARAMS is deprecated */
drivers/net/wireless/intel/iwlwifi/mld/ap.h +5 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright (C) 2024 Intel Corporation +* Copyright (C) 2024, 2026 Intel Corporation */ #ifndef __iwl_ap_h__#define __iwl_ap_h__
@@ -14,6 +14,10 @@ int iwl_mld_update_beacon_template(struct iwl_mld *mld,struct ieee80211_vif *vif, struct ieee80211_bss_conf *link_conf); +void iwl_mld_stop_beacon (struct iwl_mld *mld, +struct ieee80211_vif *vif, +struct ieee80211_bss_conf *link_conf); +int iwl_mld_start_ap_ibss (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_bss_conf *link);
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +7 -1
@@ -1154,8 +1154,14 @@ iwl_mld_link_info_changed_ap_ibss(struct iwl_mld *mld,if (link_changes)iwl_mld_change_link_in_fw (mld, link, link_changes); -if (changes &BSS_CHANGED_BEACON ) +if (changes &BSS_CHANGED_BEACON ) { +WARN_ON (!link->enable_beacon);iwl_mld_update_beacon_template (mld, vif, link); + } + +/* Enabling beacons was already covered above */ +if ((changes &BSS_CHANGED_BEACON_ENABLED ) && !link->enable_beacon) +iwl_mld_stop_beacon (mld, vif, link); } static
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 213/1250 wifi: iwlwifi: pcie: fix ACPI DSM check
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 7b2b86fd7030abe8330f57ed1faf54ea214eb872 ]
The acpi_check_dsm() function expects a bitmap of function IDs to check for, not a single value. Evidently, on many platforms function 1 exists so checking for 2 succeeded, but it's wrong, we need to check correctly for function 2. Fix that.
--- drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c +1 -1
@@ -2044,7 +2044,7 @@ iwl_trans_pcie_call_prod_reset_dsm(struct pci_dev *pdev, u16 cmd, u16 value) 0xDD, 0x26, 0xB5, 0xFD);if (!acpi_check_dsm (ACPI_HANDLE (&pdev->dev), &dsm_guid,ACPI_DSM_REV , -DSM_INTERNAL_FUNC_PRODUCT_RESET )) +BIT (DSM_INTERNAL_FUNC_PRODUCT_RESET )))return ERR_PTR (-ENODEV ); return iwl_acpi_get_dsm_object(&pdev->dev, ACPI_DSM_REV,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 214/1250 wifi: iwlwifi: mld: call iwl_mld_free_ap_early_key() for AP only
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avraham Stern <[email protected]>
[ Upstream commit c35c44434329c6b3bd2c6c1e5add5ae10d933a4d ]
The driver supports intalling IGTK on a NAN device interface. When the IGTK is removed, iwl_mld_free_ap_early_key() is called which results in a warning since no links are attached to this interface. The iwl_mld_free_ap_early_key() function should be called for AP or IBSS interfaces only. Check the interface type before calling it.
--- drivers/net/wireless/intel/iwlwifi/mld/mac80211.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +3 -1
@@ -2164,7 +2164,9 @@ static void iwl_mld_set_key_remove(struct iwl_mld *mld, }/* if this key was stored to be added later to the FW - free it here */ -if (!(key->flags &IEEE80211_KEY_FLAG_PAIRWISE )) +if (!(key->flags &IEEE80211_KEY_FLAG_PAIRWISE ) && + (vif->type ==NL80211_IFTYPE_AP || + vif->type ==NL80211_IFTYPE_ADHOC ))iwl_mld_free_ap_early_key (mld, key, mld_vif);/* We already removed it */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 215/1250 wifi: iwlwifi: Transition to basic uAPSD with MAC_PM_POWER_TABLE API VER_3
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avinash Bhatt <[email protected]>
[ Upstream commit fc58bb9ecef04aa46f201fc421a16e670b5dc01f ]
uAPSD is transitioning to a certification-only feature. The new firmware API version 3 removes advanced uAPSD fields, keeping only basic parameters needed for certification testing.
Support the new VER_3 API in the MLD driver while maintaining backward compatibility with VER_1/2. The MVM driver continues using VER_2 only. Remove the obsolete PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION notification from the MLD driver
--- .../net/wireless/intel/iwlwifi/fw/api/power.h | 48 ++++- .../net/wireless/intel/iwlwifi/mld/iface.c | 18 -- .../net/wireless/intel/iwlwifi/mld/iface.h | 3 - drivers/net/wireless/intel/iwlwifi/mld/mld.c | 1 - .../net/wireless/intel/iwlwifi/mld/notif.c | 6 - .../net/wireless/intel/iwlwifi/mld/power.c | 177 ++++++++++++++++-- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 4 +- .../net/wireless/intel/iwlwifi/mvm/power.c | 14 +- 8 files changed, 214 insertions(+), 57 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/power.h +43 -5
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright (C) 2012-2014, 2018-2025 Intel Corporation +* Copyright (C) 2012-2014, 2018-2026 Intel Corporation * Copyright (C) 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2015-2017 Intel Deutschland GmbH */
@@ -85,12 +85,13 @@ struct iwl_ltr_config_cmd {* '1' PM could sleep over DTIM till listen Interval. * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all * access categories are both delivery and trigger enabled. +* (Not supported since version 3) * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and * PBW Snoozing enabled * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable. * @POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK: AP/GO's uAPSD misbehaving -* detection enablement +* detection enablement (Not supported since version 3) * @POWER_FLAGS_ENABLE_SMPS_MSK: SMPS is allowed for this vif */ enum iwl_power_flags {
@@ -175,9 +176,9 @@ struct iwl_device_power_cmd { } __packed;/** -* struct iwl_mac_power_cmd - New power command containing uAPSD support +* struct iwl_mac_power_cmd_v2 - power command V2 containing uAPSD support * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response) -* @id_and_color: MAC contex identifier, &enum iwl_ctxt_id_and_color +* @id_and_color: MAC context identifier, &enum iwl_ctxt_id_and_color * @flags: Power table command flags from POWER_FLAGS_* * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec. * Minimum allowed:- 3 * DTIM. Keep alive period must be
@@ -216,7 +217,7 @@ struct iwl_device_power_cmd {* @limited_ps_threshold: (unused) * @reserved: reserved (padding) */ -struct iwl_mac_power_cmd { +struct iwl_mac_power_cmd_v2 {/* CONTEXT_DESC_API_T_VER_1 */ __le32 id_and_color;
@@ -242,6 +243,43 @@ struct iwl_mac_power_cmd {u8 reserved; } __packed;/* CLIENT_PM_POWER_TABLE_S_VER_1, VER_2 */ +/** +* struct iwl_mac_power_cmd - power command +* MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response) +* @id_and_color: MAC context identifier, &enum iwl_ctxt_id_and_color +* @flags: Power table command flags from POWER_FLAGS_* +* @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec. +* Minimum allowed:- 3 * DTIM. Keep alive period must be +* set regardless of power scheme or current power state. +* FW use this value also when PM is disabled. +* @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to +* PSM transition - legacy PM +* @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to +* PSM transition - legacy PM +* @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled. +* Default: 80dbm +* @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag +* is set. For example, if it is required to skip over +* one DTIM, this value need to be set to 2 (DTIM periods). +* @qndp_tid: TID client shall use for uAPSD QNDP triggers +* @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for +* each corresponding AC. +* Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values. +*/ +struct iwl_mac_power_cmd { +/* CONTEXT_DESC_API_T_VER_1 */ +__le32 id_and_color; + +__le16 flags; +__le16 keep_alive_seconds; +__le32 rx_data_timeout; +__le32 tx_data_timeout; +u8 lprx_rssi_threshold; +u8 skip_dtim_periods; +u8 qndp_tid; +u8 uapsd_ac_flags; +} __packed;/* CLIENT_PM_POWER_TABLE_S_VER_3 */ +/* * struct iwl_uapsd_misbehaving_ap_notif - FW sends this notification when * associated AP is identified as improperly implementing uAPSD protocol.
drivers/net/wireless/intel/iwlwifi/mld/iface.c +0 -18
@@ -588,24 +588,6 @@ void iwl_mld_handle_probe_resp_data_notif(struct iwl_mld *mld,kfree_rcu (old_data, rcu_head); } -void iwl_mld_handle_uapsd_misbehaving_ap_notif (struct iwl_mld *mld, -struct iwl_rx_packet *pkt) -{ -struct iwl_uapsd_misbehaving_ap_notif *notif = (void *)pkt->data; -struct ieee80211_vif *vif; - -if (IWL_FW_CHECK (mld, notif->mac_id >=ARRAY_SIZE (mld->fw_id_to_vif), -"mac id is invalid: %d\n" , notif->mac_id)) -return ; - - vif =wiphy_dereference (mld->wiphy, mld->fw_id_to_vif[notif->mac_id]); - -if (WARN_ON (!vif) ||ieee80211_vif_is_mld (vif)) -return ; - -IWL_WARN (mld,"uapsd misbehaving AP: %pM\n" , vif->bss_conf.bssid); -} -void iwl_mld_handle_datapath_monitor_notif (struct iwl_mld *mld,struct iwl_rx_packet *pkt) {
drivers/net/wireless/intel/iwlwifi/mld/iface.h +0 -3
@@ -234,9 +234,6 @@ void iwl_mld_handle_probe_resp_data_notif(struct iwl_mld *mld,void iwl_mld_handle_datapath_monitor_notif (struct iwl_mld *mld,struct iwl_rx_packet *pkt); -void iwl_mld_handle_uapsd_misbehaving_ap_notif (struct iwl_mld *mld, -struct iwl_rx_packet *pkt); -void iwl_mld_reset_cca_40mhz_workaround (struct iwl_mld *mld,struct ieee80211_vif *vif);
drivers/net/wireless/intel/iwlwifi/mld/mld.c +0 -1
@@ -162,7 +162,6 @@ static const struct iwl_hcmd_names iwl_mld_legacy_names[] = {HCMD_NAME (PHY_CONFIGURATION_CMD ),HCMD_NAME (SCAN_OFFLOAD_UPDATE_PROFILES_CMD ),HCMD_NAME (POWER_TABLE_CMD ), -HCMD_NAME (PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION ),HCMD_NAME (BEACON_NOTIFICATION ),HCMD_NAME (BEACON_TEMPLATE_CMD ), HCMD_NAME(TX_ANT_CONFIGURATION_CMD),
drivers/net/wireless/intel/iwlwifi/mld/notif.c +0 -6
@@ -338,8 +338,6 @@ CMD_VERSIONS(emlsr_mode_notif, CMD_VER_ENTRY(2, iwl_esr_mode_notif)) CMD_VERSIONS(emlsr_trans_fail_notif, CMD_VER_ENTRY(1, iwl_esr_trans_fail_notif)) -CMD_VERSIONS(uapsd_misbehaving_ap_notif, - CMD_VER_ENTRY(1, iwl_uapsd_misbehaving_ap_notif)) CMD_VERSIONS(time_msmt_notif, CMD_VER_ENTRY(1, iwl_time_msmt_notify)) CMD_VERSIONS(time_sync_confirm_notif,
@@ -360,8 +358,6 @@ DEFINE_SIMPLE_CANCELLATION(scan_complete, iwl_umac_scan_complete, uid) DEFINE_SIMPLE_CANCELLATION(scan_start, iwl_umac_scan_start, uid)DEFINE_SIMPLE_CANCELLATION (probe_resp_data, iwl_probe_resp_data_notif, mac_id) -DEFINE_SIMPLE_CANCELLATION (uapsd_misbehaving_ap, iwl_uapsd_misbehaving_ap_notif, - mac_id) DEFINE_SIMPLE_CANCELLATION(ftm_resp, iwl_tof_range_rsp_ntfy, request_id)DEFINE_SIMPLE_CANCELLATION (beacon_filter, iwl_beacon_filter_notif, link_id)
@@ -452,8 +448,6 @@ const struct iwl_rx_handler iwl_mld_rx_handlers[] = { emlsr_mode_notif, RX_HANDLER_ASYNC) RX_HANDLER_NO_OBJECT(MAC_CONF_GROUP, EMLSR_TRANS_FAIL_NOTIF, emlsr_trans_fail_notif, RX_HANDLER_ASYNC) - RX_HANDLER_OF_VIF(LEGACY_GROUP, PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION, - uapsd_misbehaving_ap_notif)RX_HANDLER_NO_OBJECT (LEGACY_GROUP ,WNM_80211V_TIMING_MEASUREMENT_NOTIFICATION , time_msmt_notif,RX_HANDLER_SYNC )
drivers/net/wireless/intel/iwlwifi/mld/power.c +162 -15
221 lines not on this page · raw message
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +2 -2
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright (C) 2012-2014, 2018-2025 Intel Corporation +* Copyright (C) 2012-2014, 2018-2026 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */
@@ -477,7 +477,7 @@ struct iwl_mvm_vif {struct dentry *dbgfs_slink;struct iwl_dbgfs_pm dbgfs_pm;struct iwl_dbgfs_bf dbgfs_bf; -struct iwl_mac_power_cmd mac_pwr_cmd; +struct iwl_mac_power_cmd_v2 mac_pwr_cmd;int dbgfs_quota_min;bool ftm_unprotected;#endif
drivers/net/wireless/intel/iwlwifi/mvm/power.c +7 -7
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2012-2014, 2018-2019, 2021-2025 Intel Corporation +* Copyright (C) 2012-2014, 2018-2019, 2021-2026 Intel Corporation * Copyright (C) 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2015-2017 Intel Deutschland GmbH */
@@ -83,7 +83,7 @@ void iwl_mvm_beacon_filter_set_cqm_params(struct iwl_mvm *mvm, }static void iwl_mvm_power_log (struct iwl_mvm *mvm, -struct iwl_mac_power_cmd *cmd) +struct iwl_mac_power_cmd_v2 *cmd) { IWL_DEBUG_POWER(mvm, "Sending power table command on mac id 0x%X for power level %d, flags = 0x%X\n",
@@ -121,7 +121,7 @@ static void iwl_mvm_power_log(struct iwl_mvm *mvm,static void iwl_mvm_power_configure_uapsd (struct iwl_mvm *mvm,struct ieee80211_vif *vif, -struct iwl_mac_power_cmd *cmd) +struct iwl_mac_power_cmd_v2 *cmd) {struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif);enum ieee80211_ac_numbers ac;
@@ -296,7 +296,7 @@ static bool iwl_mvm_power_is_radar(struct ieee80211_bss_conf *link_conf)static void iwl_mvm_power_config_skip_dtim (struct iwl_mvm *mvm,struct ieee80211_vif *vif, -struct iwl_mac_power_cmd *cmd) +struct iwl_mac_power_cmd_v2 *cmd) {struct ieee80211_bss_conf *link_conf;unsigned int min_link_skip = ~0 ;
@@ -344,7 +344,7 @@ static void iwl_mvm_power_config_skip_dtim(struct iwl_mvm *mvm,static void iwl_mvm_power_build_cmd (struct iwl_mvm *mvm,struct ieee80211_vif *vif, -struct iwl_mac_power_cmd *cmd) +struct iwl_mac_power_cmd_v2 *cmd) {int dtimper, bi;int keep_alive;
@@ -466,7 +466,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,static int iwl_mvm_power_send_cmd (struct iwl_mvm *mvm,struct ieee80211_vif *vif) { -struct iwl_mac_power_cmd cmd = {}; +struct iwl_mac_power_cmd_v2 cmd = {};iwl_mvm_power_build_cmd (mvm, vif, &cmd);iwl_mvm_power_log (mvm, &cmd);
@@ -717,7 +717,7 @@ int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, int bufsz) {struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif); -struct iwl_mac_power_cmd cmd = {}; +struct iwl_mac_power_cmd_v2 cmd = {};int pos =0 ;mutex_lock (&mvm->mutex);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 216/1250 wifi: iwlwifi: pcie: add two LNL PCI IDs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 5f88b045d959f8a51757e0fde29d5d204da1176f ]
Add two PCI IDs for two WiFi-7 BE1735x Killer devices (these are CRFs) so they work when put into the LNL platform.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +2 -0
@@ -537,6 +537,8 @@ VISIBLE_IF_IWLWIFI_KUNIT const struct pci_device_id iwl_hw_card_ids[] = { {IWL_PCI_DEVICE(0xA840, 0x4314, iwl_bz_mac_cfg)}, {IWL_PCI_DEVICE(0xA840, 0x1775, iwl_bz_mac_cfg)}, {IWL_PCI_DEVICE(0xA840, 0x1776, iwl_bz_mac_cfg)}, + {IWL_PCI_DEVICE(0xA840, 0x1735, iwl_bz_mac_cfg)}, + {IWL_PCI_DEVICE(0xA840, 0x1736, iwl_bz_mac_cfg)}, {IWL_PCI_DEVICE(0x7740, PCI_ANY_ID, iwl_bz_mac_cfg)}, {IWL_PCI_DEVICE(0x4D40, PCI_ANY_ID, iwl_bz_mac_cfg)},
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 217/1250 wifi: iwlwifi: mld: disallow puncturing in US/CA for WH
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pagadala Yesu Anjaneyulu <[email protected]>
[ Upstream commit ce2edf7c3910cb3222d51c0a7457b7a71703a5b1 ]
FM continues to follow the BIOS/MCC policy, while WH sets DISALLOW_PUNCTURING for US/CA and clears it for other MCC values. Update the MCC handling accordingly.
--- drivers/net/wireless/intel/iwlwifi/mld/mcc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mld/mcc.c +11 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2024-2025 Intel Corporation +* Copyright (C) 2024-2026 Intel Corporation */ #include <net/cfg80211.h>
@@ -129,7 +129,7 @@ iwl_mld_get_regdomain(struct iwl_mld *mld, mld->mcc_src = resp->source_id; -/* FM is the earliest supported and later always do puncturing */ +/* FM follows BIOS/MCC policy, WH disallows puncturing only in US/CA. */ if (CSR_HW_RFID_TYPE (mld->trans->info.hw_rf_id) ==IWL_CFG_RF_TYPE_FM ) {if (!iwl_puncturing_is_allowed_in_bios (mld->bios_enable_puncturing,le16_to_cpu (resp->mcc)))
@@ -137,6 +137,15 @@ iwl_mld_get_regdomain(struct iwl_mld *mld,else __clear_bit (IEEE80211_HW_DISALLOW_PUNCTURING , mld->hw->flags); + }else if (CSR_HW_RFID_TYPE (mld->trans->info.hw_rf_id) == +IWL_CFG_RF_TYPE_WH ) { +u16 mcc =le16_to_cpu (resp->mcc); + +if (mcc ==IWL_MCC_US || mcc ==IWL_MCC_CANADA ) +ieee80211_hw_set (mld->hw,DISALLOW_PUNCTURING ); +else +__clear_bit (IEEE80211_HW_DISALLOW_PUNCTURING , + mld->hw->flags); } out:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 218/1250 wifi: iwlwifi: mld: purge async notifications upon nic error
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miri Korenblit <[email protected]>
[ Upstream commit a40ad60a47f7c904b75a9ff83b39edebf3961c85 ]
This fixes a kernel panic in reconfig failure:
1. we have a BSS connection
2. we have a NAN connection
3. FW error occurs
4. reconfig restores the BSS connection
5. however, restoring the NAN connection fails due to a FW error.
6. erroneously, ieee80211_handle_reconfig_failure is called and marks all interfaces as not-in-driver (will be fixed in a different patch).
7. mac80211 frees the links of the BSS connection but doesn't tell the driver about that, as it thinks that this vif is not in the driver.
8. in ieee80211_stop_device, *ALL* wiphy works are getting flushed (erroneously?)
9. Therefore, async_handlers_wk is being executed, processing the statistics notification that was received after we restored the BSS connection.
10. the notification handler dereferences fw_id_to_bss_conf[id], which is now a dangling pointer, as mac80211 already freed this link in (7).
11. On the first access to one of the links fields, we panic.
While this can and should be fixed by removing the call to ieee80211_handle_reconfig_failure in (6), it is also not a good idea to carry and maybe handle notifications from a dead FW.
We do purge the notifications when we stop the FW, but in reconfig failure we stop the FW too late, after the notifications are processed. In addition, async_handlers_wk can always be scheduled before the reconfig work.
Purge the notifications immediately when transport notifies about a nic error.
--- drivers/net/wireless/intel/iwlwifi/mld/mld.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/intel/iwlwifi/mld/mld.c +9 -0
@@ -670,6 +670,15 @@ iwl_mld_nic_error(struct iwl_op_mode *op_mode,if (type !=IWL_ERR_TYPE_RESET_HS_TIMEOUT && mld->fw_status.running) mld->fw_status.in_hw_restart = true; + +/* FW is dead. We don't want to process its notifications. +* Right, we cancel them also in iwl_mld_stop_fw, but +* iwl_mld_async_handlers_wk might be executed before +* ieee80211_restart_work. +* In addition, in case of an error during recovery, +* iwl_mld_stop_fw might be too late. +*/ +iwl_mld_cancel_async_notifications (mld); } static void iwl_mld_dump_error(struct iwl_op_mode *op_mode,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 219/1250 wifi: iwlwifi: mld: keep healthy link on EMLSR missed beacon exit
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avinash Bhatt <[email protected]>
[ Upstream commit 4b6d725ff01cb92becda6e805143e331fdf1d73e ]
When EMLSR exits due to beacon loss on the current link, the driver should keep the link that is still receiving beacons. The previous code always called get_primary_link(), keeping the primary link regardless of which link is actually losing beacons. If the primary link is the one losing beacons, the driver exits EMLSR onto the degraded link and the connection is lost eventually.
When both links lose beacons, keep the primary link. When only the current link loses beacons -- whether due to signal loss or a BSS parameter change -- keep the other link.
--- drivers/net/wireless/intel/iwlwifi/mld/link.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mld/link.c +11 -6
@@ -600,15 +600,20 @@ void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld,* OR more than IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH_BSS_PARAM_CHANGED * on current link and the link's bss_param_ch_count has changed on * the other link's beacon. +* +* When both links lose beacons, keep the primary (symmetric failure). +* When only the current link is sick, keep the other link. */ -if ((missed_bcon >=IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH_2_LINKS && - scnd_lnk_bcn_lost >=IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH_2_LINKS ) || - missed_bcon >=IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH || - (bss_param_ch_cnt_link_id != link_id && - missed_bcon >= -IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH_BSS_PARAM_CHANGED )) { +if (missed_bcon >=IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH_2_LINKS && + scnd_lnk_bcn_lost >=IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH_2_LINKS ) {iwl_mld_exit_emlsr (mld, vif,IWL_MLD_EMLSR_EXIT_MISSED_BEACON ,iwl_mld_get_primary_link (vif)); + }else if (missed_bcon >=IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH || + (bss_param_ch_cnt_link_id != link_id && + missed_bcon >= +IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH_BSS_PARAM_CHANGED )) { +iwl_mld_exit_emlsr (mld, vif,IWL_MLD_EMLSR_EXIT_MISSED_BEACON , +iwl_mld_get_other_link (vif, link_id)); } }EXPORT_SYMBOL_IF_IWLWIFI_KUNIT (iwl_mld_handle_missed_beacon_notif);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 220/1250 powercap: intel_rapl: Fix memory leak in rapl_add_package_cpuslocked()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumeet Pawnikar <[email protected]>
[ Upstream commit bfc7d93bc5e12288e5dc6bb54260f68cdf5a5c47 ]
When topology_physical_package_id()/topology_logical_die_id() returns a negative value, rapl_add_package_cpuslocked() returns ERR_PTR(-EINVAL) directly without freeing the rapl_package structure that was just allocated by kzalloc_obj(), leaking memory on every failed package addition.
Use the existing err_free_package label so that the allocation is released on the error path.
--- drivers/powercap/intel_rapl_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/powercap/intel_rapl_common.c +2 -1
@@ -2216,7 +2216,8 @@ struct rapl_package *rapl_add_package_cpuslocked(int id, struct rapl_if_priv *pr topology_physical_package_id(id) : topology_logical_die_id(id);if ((int )(rp->id) <0 ) {pr_err ("topology_logical_(package/die)_id() returned a negative value" ); -return ERR_PTR (-EINVAL ); + ret = -EINVAL ; + goto err_free_package; } rp->lead_cpu = id;if (!rapl_msrs_are_pkg_scope () &&topology_max_dies_per_package () >1 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 221/1250 genirq/manage: Make NMI cleanup RT safe
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
[ Upstream commit 3ba92f6a28203e30d0b2c7d75b59f48d5ff9fbcc ]
Eventually blocking functions cannot be invoked with interrupts disabled and a raw spin lock held. Restructure the code so this happens outside of the descriptor lock held region.
--- kernel/irq/manage.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-)
kernel/irq/manage.c +21 -16
@@ -1987,24 +1987,30 @@ const void *free_irq(unsigned int irq, void *dev_id) }EXPORT_SYMBOL (free_irq); -/* This function must be called with desc->lock held */ static const void *__cleanup_nmi (unsigned int irq,struct irq_desc *desc) { +struct irqaction *action =NULL ;const char *devname =NULL ; - desc->istate &= ~IRQS_NMI ; + scoped_guard(raw_spinlock_irqsave, &desc->lock) { +irq_nmi_teardown (desc); -if (!WARN_ON (desc->action ==NULL )) { -irq_pm_remove_action (desc, desc->action); - devname = desc->action->name; -unregister_handler_proc (irq, desc->action); + desc->istate &= ~IRQS_NMI ; -kfree (desc->action); +if (!WARN_ON (desc->action ==NULL )) { + action = desc->action; +irq_pm_remove_action (desc, action); + devname = action->name; + } desc->action =NULL ; + +irq_settings_clr_disable_unlazy (desc); +irq_shutdown_and_deactivate (desc); } -irq_settings_clr_disable_unlazy (desc); -irq_shutdown_and_deactivate (desc); +if (action) +unregister_handler_proc (irq, action); +kfree (action);irq_release_resources (desc);
@@ -2028,8 +2034,6 @@ const void *free_nmi(unsigned int irq, void *dev_id)if (WARN_ON (desc->depth ==0 ))disable_nmi_nosync (irq); -guard (raw_spinlock_irqsave)(&desc->lock); -irq_nmi_teardown (desc);return __cleanup_nmi (irq, desc); }
@@ -2279,13 +2283,14 @@ int request_nmi(unsigned int irq, irq_handler_t handler,/* Setup NMI state */ desc->istate |=IRQS_NMI ; retval =irq_nmi_setup (desc); -if (retval) { -__cleanup_nmi (irq, desc); -return -EINVAL ; - } -return 0 ; } +if (retval) { +__cleanup_nmi (irq, desc); +return -EINVAL ; + } +return 0 ; + err_irq_setup:irq_chip_pm_put (&desc->irq_data); err_out:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 222/1250 drm/panel: simple: Add AM-1280800W8TZQW-T00H
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dario Binacchi <[email protected]>
[ Upstream commit 6acb810ebc5d8dea5c250326c14dc44e32dc8e92 ]
Add Ampire, AM-1280800W8TZQW-T00H 10.1" TFT LCD panel timings.
--- drivers/gpu/drm/panel/panel-simple.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/panel/panel-simple.c +28 -0
@@ -820,6 +820,31 @@ static const struct panel_desc ampire_am_1280800n3tzqw_t00h = { .connector_type = DRM_MODE_CONNECTOR_LVDS, }; +static const struct drm_display_mode ampire_am_1280800w8tzqw_t00h_mode = { + .clock =72400 , + .hdisplay =1280 , + .hsync_start =1280 +40 , + .hsync_end =1280 +40 +80 , + .htotal =1280 +40 +80 +40 , + .vdisplay =800 , + .vsync_start =800 +10 , + .vsync_end =800 +10 +18 , + .vtotal =800 +10 +18 +10 , +}; + +static const struct panel_desc ampire_am_1280800w8tzqw_t00h = { + .modes = &ire_am_1280800w8tzqw_t00h_mode, + .num_modes =1 , + .bpc =8 , + .size = { + .width =217 , + .height =136 , + }, + .bus_flags =DRM_BUS_FLAG_DE_HIGH , + .bus_format =MEDIA_BUS_FMT_RGB888_1X7X4_SPWG , + .connector_type =DRM_MODE_CONNECTOR_LVDS , +}; +static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode = { .clock =9000 , .hdisplay =480 ,
@@ -4965,6 +4990,9 @@ static const struct of_device_id platform_of_match[] = { { .compatible = "ampire,am-1280800n3tzqw-t00h", .data = &ire_am_1280800n3tzqw_t00h, + }, { + .compatible = "ampire,am-1280800w8tzqw-t00h", + .data = &ire_am_1280800w8tzqw_t00h, }, { .compatible = "ampire,am-480272h3tmqw-t01h", .data = &ire_am_480272h3tmqw_t01h,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 223/1250 mips: cps: Assemble jr.hb with an R2 ISA level
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit e5d64f868e484da06f5c141c18c32c01c269625e ]
A MIPS allmodconfig built with LLVM can select CPU_MIPS32_R1 together with MIPS_MT_SMP. In that configuration clang invokes the integrated assembler with -march=mips32, and the MIPS MT path in cps-vec.S fails to assemble two jr.hb instructions:
arch/mips/kernel/cps-vec.S:376:2: error: instruction requires a CPU feature not currently enabled
arch/mips/kernel/cps-vec.S:490:4: error: instruction requires a CPU feature not currently enabled
The earlier jr.hb in the same file is already assembled inside a .set MIPS_ISA_LEVEL_RAW scope. The two failing sites are reached after popping back to the file's base ISA level, so LLVM correctly rejects them for an R1 target.
Wrap those jr.hb instructions in the same ISA-level push/pop used by the working site. This keeps the MT code unchanged while making the required R2 hazard-branch encoding explicit to the assembler.
--- arch/mips/kernel/cps-vec.S | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/kernel/cps-vec.S +6 -0
@@ -373,8 +373,11 @@ LEAF(mips_cps_boot_vpes) .set pop PTR_LA t1, 1f + .set push + .set MIPS_ISA_LEVEL_RAW jr.hb t1 nop + .set pop 1: mfc0 t1, CP0_MVPCONTROL ori t1, t1, MVPCONTROL_VPC mtc0 t1, CP0_MVPCONTROL
@@ -487,8 +490,11 @@ LEAF(mips_cps_boot_vpes) li t0, TCHALT_H mtc0 t0, CP0_TCHALT PTR_LA t0, 1f + .set push + .set MIPS_ISA_LEVEL_RAW 1: jr.hb t0 nop + .set pop 2:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 224/1250 iio: adc: qcom-spmi-iadc: balance enable_irq_wake() on driver unbind
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stepan Ionichev <[email protected]>
[ Upstream commit 929fec2964f71d4b1ac664ee963d8226c5cf01c6 ]
iadc_probe() calls enable_irq_wake() after a successful devm_request_irq(), but the driver has no remove callback or matching disable_irq_wake(), so the wake reference count on the IRQ is leaked on module unload or driver unbind.
Check the IRQ request error first, then register a devm action that calls disable_irq_wake() so the wake reference is released in the same scope as the enable. While here, drop the inverted "if (!ret) ... else return ret" in favour of the standard "if (ret) return ret;" pattern.
--- drivers/iio/adc/qcom-spmi-iadc.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/iio/adc/qcom-spmi-iadc.c +15 -3
@@ -481,6 +481,11 @@ static const struct iio_chan_spec iadc_channels[] = { }, }; +static void iadc_disable_irq_wake (void *data) +{ +disable_irq_wake ((unsigned long )data); +} +static int iadc_probe (struct platform_device *pdev) {struct device_node *node = pdev->dev.of_node;
@@ -538,9 +543,16 @@ static int iadc_probe(struct platform_device *pdev)if (!iadc->poll_eoc) { ret =devm_request_irq (dev, irq_eoc, iadc_isr,0 ,"spmi-iadc" , iadc); -if (!ret) -enable_irq_wake (irq_eoc); -else +if (ret) +return ret; + + ret =enable_irq_wake (irq_eoc); +if (ret) +return ret; + + ret =devm_add_action_or_reset (dev, iadc_disable_irq_wake, + (void *)(unsigned long )irq_eoc); +if (ret)return ret; }else { ret =devm_device_init_wakeup (iadc->dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 225/1250 irqchip/gic-v4: Dont advertise VLPIs if no ITS is probed
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mostafa Saleh <[email protected]>
[ Upstream commit e61654fbc3bc5d07ec9fafe29f33e19b2b5d0fd5 ]
When accidentally setting “kvm-arm.vgic_v4_enable=1” on a system that has no MSI controller device tree node and GICv4, it results a panic as “gic_domain” is NULL and the kernel attempts to access it.
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000028
Mem abort info:
ESR = 0x0000000096000006
CPU: 1 UID: 0 PID: 295 Comm: lkvm-static Not tainted 7.1.0-rc4-ge3f15ad3970e #5 PREEMPT
Hardware name: linux,dummy-virt (DT)
pstate: 81402005 (Nzcv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
pc : __irq_domain_instantiate+0x1d4/0x578
lr : __irq_domain_instantiate+0x1cc/0x578Set vLPI support to false at init time if the host has no ITS, so it propagates properly to kvm_vgic_global_state.has_gicv4.
--- drivers/irqchip/irq-gic-v3-its.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-gic-v3-its.c +1 -0
@@ -5853,6 +5853,7 @@ int __init its_init(struct fwnode_handle *handle, struct rdists *rdists,its_acpi_probe ();if (list_empty (&its_nodes)) { + rdists->has_vlpis = false;pr_warn ("ITS: No ITS available, not enabling LPIs\n" );return -ENXIO ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 226/1250 ALSA: usb-audio: Add quirk for Novation Mininova
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Küchler <[email protected]>
[ Upstream commit b2e9d2cbbb71b00faf3e27fb741a27b9ad455edd ]
Add a device-specific quirk for the Novation Mininova synthesizer (USB ID 1235:001e) to enable proper recognition and functionality as a MIDI device.
--- sound/usb/quirks-table.h | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/usb/quirks-table.h +8 -0
@@ -2131,6 +2131,14 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, +{ +USB_DEVICE (0x1235 ,0x001e ), + QUIRK_DRIVER_INFO { +/* .vendor_name = "Novation", */ +/* .product_name = "Mininova", */ + QUIRK_DATA_RAW_BYTES(0) + } +}, {USB_DEVICE_VENDOR_SPEC (0x1235 ,0x4661 ), QUIRK_DRIVER_INFO {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 227/1250 net: hsr: require valid EOT supervision TLV
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luka Gejak <[email protected]>
[ Upstream commit 46d111a3ef3b5972804dcdce0833767143a12192 ]
Supervision frames are only valid if terminated with a zero-length EOT TLV. The current check fails to reject non-EOT entries as the terminal TLV, potentially allowing malformed supervision traffic.
Fix this by strictly requiring the terminal TLV to be HSR_TLV_EOT with a length of zero.
--- net/hsr/hsr_forward.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/hsr/hsr_forward.c +1 -1
@@ -110,7 +110,7 @@ static bool is_supervision_frame(struct hsr_priv *hsr, struct sk_buff *skb) }/* end of tlvs must follow at the end */ -if (hsr_sup_tlv->HSR_TLV_type ==HSR_TLV_EOT && +if (hsr_sup_tlv->HSR_TLV_type !=HSR_TLV_EOT || hsr_sup_tlv->HSR_TLV_length !=0 )return false;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 228/1250 ipv6: addrconf: fix temp address generation after prefix deprecation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit e20d8922aa8fe441d291364c96c2179a005b79ea ]
When a router temporarily deprecates an IPv6 prefix (either by sending a Router Advertisement with Preferred Lifetime = 0 or by letting the lifetime expire) and later restores it, the kernel permanently loses its ability to generate temporary privacy addresses (RFC 8981) for that prefix.
This happens because the address worker attempts to generate a replacement temporary address when the current one nears expiration. As the base prefix is deprecated already, the generation fails after marking the temporary address as already having spawned a replacement (ifp->regen_count++).
When the router eventually restores the prefix, the temporary address becomes active again. However, once it naturally expires, the address worker sees this temporary address already tried to generate one and skips the regeneration.
Fix the issue by resetting the regen_count check of the latest temp address generated for the prefix updated by the incoming RA.
--- net/ipv6/addrconf.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/ipv6/addrconf.c +9 -1
@@ -1180,6 +1180,7 @@ ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg,ipv6_link_dev_addr (idev, ifa);if (ifa->flags&IFA_F_TEMPORARY ) { +/* manage_tempaddrs() relies on addresses being added to the head */ list_add (&ifa->tmp_list, &idev->tempaddr_list);in6_ifa_hold (ifa); }
@@ -2610,8 +2611,10 @@ static void manage_tempaddrs(struct inet6_dev *idev, __u32 valid_lft, __u32 prefered_lft, bool create, unsigned long now) { - u32 flags; + u32 orig_prefered_lft = prefered_lft;struct inet6_ifaddr *ift; +bool reset_done = false; +u32 flags;read_lock_bh (&idev->lock);/* update all temporary addresses in the list */
@@ -2646,6 +2649,11 @@ static void manage_tempaddrs(struct inet6_dev *idev, prefered_lft = max_prefered;spin_lock (&ift->lock); +/* the first match is the most recent temp address */ +if (!reset_done && orig_prefered_lft >0 ) { + ift->regen_count =0 ; + reset_done = true; + } flags = ift->flags; ift->valid_lft = valid_lft; ift->prefered_lft = prefered_lft;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 229/1250 net: napi: Skip last poll when arming gro timer in busy poll
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Karsten <[email protected]>
[ Upstream commit 7599c13dbe7a2dc49e33f4c6581c6f1287d9410e ]
Skip the extra call to napi->poll(), if the gro timer is armed at the end of busy polling. This removes the need for having a separate __busy_poll_stop() routine and its code is moved directly into the relevant places in busy_poll_stop(). Remove obsolete comment about ndo_busy_poll_stop().
This is a follow-up to commit 58e2330bd455 ("net: napi: Avoid gro timer misfiring at end of busypoll"), which has deferred arming the gro timer to the end of __busy_poll_stop() to eliminate a race condition between a short timer and long poll that could leave the queue stuck with interrupts disabled and no timer armed.
--- net/core/dev.c | 62 ++++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 35 deletions(-)
net/core/dev.c +27 -35
@@ -6791,22 +6791,6 @@ static void skb_defer_free_flush(void)#if defined(CONFIG_NET_RX_BUSY_POLL ) -static void __busy_poll_stop (struct napi_struct *napi,unsigned long timeout) -{ -if (!timeout) { -gro_normal_list (&napi->gro); -__napi_schedule (napi); -return ; - } - -/* Flush too old packets. If HZ < 1000, flush all packets */ -gro_flush_normal (&napi->gro,HZ >=1000 ); - -clear_bit (NAPI_STATE_SCHED , &napi->state); -hrtimer_start (&napi->timer,ns_to_ktime (timeout), -HRTIMER_MODE_REL_PINNED ); -} -enum {NAPI_F_PREFER_BUSY_POLL =1 , NAPI_F_END_ON_RESCHED = 2,
@@ -6822,8 +6806,8 @@ static void busy_poll_stop(struct napi_struct *napi, void *have_poll_lock,/* Busy polling means there is a high chance device driver hard irq * could not grab NAPI_STATE_SCHED, and that NAPI_STATE_MISSED was * set in napi_schedule_prep(). -* Since we are about to call napi->poll() once more, we can safely -* clear NAPI_STATE_MISSED. +* Since we either call napi->poll() once more or start the timer, +* we can safely clear NAPI_STATE_MISSED. * * Note: x86 could use a single "lock and ..." instruction * to perform these two clear_bit()
@@ -6836,27 +6820,35 @@ static void busy_poll_stop(struct napi_struct *napi, void *have_poll_lock,if (flags &NAPI_F_PREFER_BUSY_POLL ) { napi->defer_hard_irqs_count =napi_get_defer_hard_irqs (napi); -if (napi->defer_hard_irqs_count) { -/* A short enough gro flush timeout and long enough -* poll can result in timer firing too early. -* Timer will be armed later if necessary. -*/ +if (napi->defer_hard_irqs_count) timeout =napi_get_gro_flush_timeout (napi); + } +if (timeout) { +netpoll_poll_unlock (have_poll_lock); + +/* Drain aged GRO packets before clearing SCHED since the NAPI +* won't run again until after the timer fires. When HZ < 1000, +* GRO age comparison is too coarse, so flush everything. +*/ +gro_flush_normal (&napi->gro,HZ >=1000 ); + +clear_bit (NAPI_STATE_SCHED , &napi->state); +hrtimer_start (&napi->timer,ns_to_ktime (timeout), +HRTIMER_MODE_REL_PINNED ); + }else { +/* Use driver poll to re-enable device interrupts. */ + rc = napi->poll (napi, budget); +/* Unless rc == budget we no longer own the NAPI instance, +* IRQ may fire on another CPU, poll this NAPI, and enter GRO. +*/ +trace_napi_poll (napi, rc, budget); +netpoll_poll_unlock (have_poll_lock); +if (rc == budget) { +gro_normal_list (&napi->gro); +__napi_schedule (napi); } } -/* All we really want here is to re-enable device interrupts. -* Ideally, a new ndo_busy_poll_stop() could avoid another round. -*/ - rc = napi->poll (napi, budget); -/* We can't gro_normal_list() here, because napi->poll() might have -* rearmed the napi (napi_complete_done()) in which case it could -* already be running on another CPU. -*/ -trace_napi_poll (napi, rc, budget); -netpoll_poll_unlock (have_poll_lock); -if (rc == budget) -__busy_poll_stop (napi, timeout);bpf_net_ctx_clear (bpf_net_ctx);local_bh_enable (); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 230/1250 net: thunderx: fix PTP device ref leak in nicvf_probe()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
[ Upstream commit 2bcf59eefb9f00a2b1d426b639ee49c305a80695 ]
cavium_ptp_get() acquires a reference to the PTP PCI device through pci_get_device(). If any initialization step fails after cavium_ptp_get(), the PTP PCI device reference is leaked. Add a common error path to release the PTP reference before returning from probe failures.
--- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/cavium/thunder/nicvf_main.c +6 -2
@@ -2104,8 +2104,10 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } err =pci_enable_device (pdev); -if (err) -return dev_err_probe (dev, err,"Failed to enable PCI device\n" ); +if (err) { + err =dev_err_probe (dev, err,"Failed to enable PCI device\n" ); + goto err_put_ptp; + } err =pci_request_regions (pdev,DRV_NAME );if (err) {
@@ -2259,6 +2261,8 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pci_release_regions (pdev); err_disable_device:pci_disable_device (pdev); +err_put_ptp: +cavium_ptp_put (ptp_clock);return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 231/1250 ALSA: hda: cs35l41: imply SERIAL_MULTI_INSTANTIATE
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johny Lin <[email protected]>
[ Upstream commit 72d8bf668954678bfae8f7296b4b1c01990bcdc2 ]
Use a weak reverse selection to suggest the config SERIAL_MULTI_INSTANTIATE just like cs35l56 did.
--- sound/hda/codecs/side-codecs/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
sound/hda/codecs/side-codecs/Kconfig +2 -0
@@ -27,6 +27,7 @@ config SND_HDA_SCODEC_CS35L41_I2C depends on ACPI depends on EFI depends on SND_SOC + imply SERIAL_MULTI_INSTANTIATE select SND_SOC_CS35L41_LIB select SND_HDA_SCODEC_CS35L41 select SND_SOC_CS_AMP_LIB
@@ -43,6 +44,7 @@ config SND_HDA_SCODEC_CS35L41_SPI depends on ACPI depends on EFI depends on SND_SOC + imply SERIAL_MULTI_INSTANTIATE select SND_SOC_CS35L41_LIB select SND_HDA_SCODEC_CS35L41 select SND_SOC_CS_AMP_LIB
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 232/1250 drm/dp: Add DSC virtual DPCD quirk for Realtek MST branch device
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
[ Upstream commit bff2da7aa0020eb72e42d63868dc5adaa0fb85d3 ]
The ASUS DC301 USB-C dock containing a Realtek MST branch device supports the DSC decompression functionality on each of the dock's downstream connectors, even though there is no discoverable peer-to-peer virtual device in the MST topology (which the DP Standard requires/suggests to control the DSC functionality on a per-DFP basis). Add the DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD quirk for this branch device as well to enable the DSC decompression functionality on all DFP connectors of the dock, similarly to how this is done for dock's containing older Synaptics branch devices.
--- drivers/gpu/drm/display/drm_dp_helper.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/display/drm_dp_helper.c +2 -0
@@ -2537,6 +2537,8 @@ static const struct dpcd_quirk dpcd_quirk_list[] = { { OUI(0x00, 0x00, 0x00), DEVICE_ID('C', 'H', '7', '5', '1', '1'), false, BIT(DP_DPCD_QUIRK_NO_SINK_COUNT) },/* Synaptics DP1.4 MST hubs can support DSC without virtual DPCD */ { OUI(0x90, 0xCC, 0x24), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) }, +/* Realtek DP1.4 MST hubs can support DSC without virtual DPCD */ + { OUI(0x00, 0xe0, 0x4c), DEVICE_ID('D', 'p', '1', '.', '4', 0), true, BIT(DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) },/* Synaptics DP1.4 MST hubs require DSC for some modes on which it applies HBLANK expansion. */ { OUI(0x90, 0xCC, 0x24), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_HBLANK_EXPANSION_REQUIRES_DSC) }, /* MediaTek panels (at least in U3224KBA) require DSC for modes with a short HBLANK on UHBR links. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 233/1250 drm/amd/pm/si: Fix updating clock limits from power states
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Klarenbeek <[email protected]>
[ Upstream commit e6c5d36756e7d4d260e2365fc4d01226f1973152 ]
VBIOS can contain conflicting values between:
- the maximum allowed clocks and voltages on AC or DC
- the clocks and voltages in power states on AC or DC
Update maximum clock (and voltage) limits for both AC/DC and take the highest value from the VBIOS limits and the performance/battery power states. Previously this was only done for AC, but is also needed for DC.
This commit fixes the behaviour on some laptop GPUs, where the VBIOS limit was set to the lowest possible clock frequency, so the GPU was stuck on the lowest possible power level on battery.
Some affected GPUs are:
FirePro W4170M (Dell Precision M2800)
Radeon HD 8790M (Dell Latitude E6540)
and possibly other laptop GPUs.
--- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 29 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +24 -5
@@ -7238,6 +7238,7 @@ static void si_parse_pplib_clock_info(struct amdgpu_device *adev,struct evergreen_power_info *eg_pi =evergreen_get_pi (adev);struct si_power_info *si_pi =si_get_pi (adev);struct si_ps *ps =si_get_ps (rps); +struct amdgpu_clock_and_voltage_limits *limits;u16 leakage_voltage;struct rv7xx_pl *pl = &ps->performance_levels[index];int ret;
@@ -7297,12 +7298,30 @@ static void si_parse_pplib_clock_info(struct amdgpu_device *adev, si_pi->mvdd_bootup_value = mvdd; } +/* +* Update maximum allowed clock limits. +* VBIOS can contain conflicting values between: +* - the maximum allowed clocks and voltages on AC or DC +* - the clocks and voltages in power states on AC or DC +*/ if ((rps->class &ATOM_PPLIB_CLASSIFICATION_UI_MASK ) == -ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE ) { - adev->pm.dpm.dyn_state.max_clock_voltage_on_ac.sclk = pl->sclk; - adev->pm.dpm.dyn_state.max_clock_voltage_on_ac.mclk = pl->mclk; - adev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddc = pl->vddc; - adev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddci = pl->vddci; +ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE ) + limits = &adev->pm.dpm.dyn_state.max_clock_voltage_on_ac; +else if ((rps->class &ATOM_PPLIB_CLASSIFICATION_UI_MASK ) == +ATOM_PPLIB_CLASSIFICATION_UI_BATTERY ) + limits = &adev->pm.dpm.dyn_state.max_clock_voltage_on_dc; +else + limits =NULL ; + +if (limits) { +if (pl->sclk > limits->sclk) + limits->sclk = pl->sclk; +if (pl->mclk > limits->mclk) + limits->mclk = pl->mclk; +if (pl->vddc > limits->vddc) + limits->vddc = pl->vddc; +if (pl->vddci > limits->vddci) + limits->vddci = pl->vddci; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 234/1250 drm/amd/display: Initialize dsc_caps to 0
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Lipski <[email protected]>
[ Upstream commit d18ecfee5187e3b2dbff7e67dda8b2f54ff5231c ]
[Why&How]
If we don't do that we make DSC decisions based on random inputs, which might result in disallowing DSC when the monitor and HW support it.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -7183,7 +7183,7 @@ create_stream_for_sink(struct drm_connector *connector,int preferred_refresh =0 ;enum color_transfer_func tf =TRANSFER_FUNC_UNKNOWN ;#if defined(CONFIG_DRM_AMD_DC_FP ) -struct dsc_dec_dpcd_caps dsc_caps; +struct dsc_dec_dpcd_caps dsc_caps = {0 };#endif struct dc_link *link =NULL ;struct dc_sink *sink =NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 235/1250 ACPICA: Fix condition check in acpi_ps_parse_loop()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 8de27e2d83c0d07ae9443c6304575b0609394bfd ]
Fix condition check for AML_ELSE_OP in acpi_ps_parse_loop() to prevent out-of-bounds access.
--- drivers/acpi/acpica/psloop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/acpi/acpica/psloop.c +4 -1
@@ -425,7 +425,10 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)ACPI_ERROR ((AE_INFO ,"Skipping While/If block" )); -if (*walk_state->aml ==AML_ELSE_OP ) { +if ((walk_state->aml < + parser_state->aml_end) + && (*walk_state->aml == +AML_ELSE_OP )) {ACPI_ERROR ((AE_INFO ,"Skipping Else block" )); walk_state->parser_state.aml =
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 236/1250 ACPICA: Fix use-after-free in acpi_ds_terminate_control_method()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 945e87267cfd90937b3c637f87324cbb56998b72 ]
Fix use-after-free issue in acpi_ds_terminate_control_method() by clearing references to method locals and arguments.
--- drivers/acpi/acpica/dsmethod.c | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/acpi/acpica/dsmethod.c +43 -0
@@ -705,6 +705,8 @@ void acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, struct acpi_walk_state *walk_state) { + u32 i; +struct acpi_namespace_node *ref_node;ACPI_FUNCTION_TRACE_PTR (ds_terminate_control_method, walk_state);
@@ -715,6 +717,47 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, }if (walk_state) { +/* +* Check if the return value is a ref_of reference to a method local +* or argument. If so, clear the reference to avoid use-after-free +* when the walk state is deleted. +*/ +if (walk_state->return_desc && + (walk_state->return_desc->common.type == +ACPI_TYPE_LOCAL_REFERENCE ) + && (walk_state->return_desc->reference.class == +ACPI_REFCLASS_REFOF )) { + ref_node = walk_state->return_desc->reference.object; +if (ref_node) { + +/* Check against method locals */ +for (i =0 ; i <ACPI_METHOD_NUM_LOCALS ; i++) { +if (ref_node == + &walk_state->local_variables[i]) { +acpi_ut_remove_reference + (walk_state->return_desc); + walk_state->return_desc =NULL ; +break ; + } + } + +/* Check against method arguments if not already cleared */ +if (walk_state->return_desc) { +for (i =0 ; i <ACPI_METHOD_NUM_ARGS ; + i++) { +if (ref_node == + &walk_state->arguments[i]) { +acpi_ut_remove_reference + (walk_state-> + return_desc); + walk_state-> + return_desc =NULL ; +break ; + } + } + } + } + }/* Delete all arguments and locals */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 237/1250 ACPICA: add boundary checks in acpi_ps_get_next_field()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit e15aa60de0256d63df2331bf5a4bc4dd287504cd ]
Add boundary checks in acpi_ps_get_next_field() to prevent out-of-bounds access.
--- drivers/acpi/acpica/psargs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/acpi/acpica/psargs.c +17 -0
@@ -474,6 +474,10 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_stateASL_CV_CAPTURE_COMMENTS_ONLY (parser_state); aml = parser_state->aml; +if (aml >= parser_state->aml_end) { +return_PTR (NULL ); + } +/* Determine field type */ switch (ACPI_GET8 (parser_state->aml)) {
@@ -522,6 +526,11 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* Get the 4-character name */ +if ((parser_state->aml +ACPI_NAMESEG_SIZE ) > + parser_state->aml_end) { +acpi_ps_free_op (field); +return_PTR (NULL ); + }ACPI_MOVE_32_TO_32 (&name, parser_state->aml);acpi_ps_set_name (field, name); parser_state->aml +=ACPI_NAMESEG_SIZE ;
@@ -567,6 +576,10 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* Get the two bytes (Type/Attribute) */ +if ((parser_state->aml +2 ) > parser_state->aml_end) { +acpi_ps_free_op (field); +return_PTR (NULL ); + } access_type =ACPI_GET8 (parser_state->aml); parser_state->aml++; access_attribute =ACPI_GET8 (parser_state->aml);
@@ -578,6 +591,10 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* This opcode has a third byte, access_length */ if (opcode ==AML_INT_EXTACCESSFIELD_OP ) { +if (parser_state->aml >= parser_state->aml_end) { +acpi_ps_free_op (field); +return_PTR (NULL ); + } access_length =ACPI_GET8 (parser_state->aml); parser_state->aml++;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 238/1250 ACPICA: validate byte_count in acpi_ps_get_next_package_length()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit d49c6ee08365a8596f639da46eb7e71752b0cd42 ]
Validate package length reading in acpi_ps_get_next_package_length().
--- drivers/acpi/acpica/psargs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/acpi/acpica/psargs.c +17 -0
@@ -48,6 +48,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)u32 package_length =0 ;u32 byte_count;u8 byte_zero_mask =0x3F ;/* Default [0:5] */ +u32 remaining;ACPI_FUNCTION_TRACE (ps_get_next_package_length);
@@ -55,7 +56,23 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)* Byte 0 bits [6:7] contain the number of additional bytes * used to encode the package length, either 0,1,2, or 3 */ + +/* Check if we have at least one byte to read */ + remaining = (u32 )ACPI_PTR_DIFF (parser_state->aml_end, aml); +if (remaining ==0 ) { +return_UINT32 (0 ); + } + byte_count = (aml[0 ] >>6 ); + +/* Validate byte_count and ensure we have enough bytes to read */ +if (byte_count >= remaining) { + +/* Clamp to available bytes and advance to end */ + parser_state->aml = parser_state->aml_end; +return_UINT32 (0 ); + } + parser_state->aml += ((acpi_size )byte_count +1 );/* Get bytes 3, 2, 1 as needed */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 239/1250 ACPICA: Prevent adding invalid references
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 6e8c55e13a5e3a9f38921d62924f18ceba3330eb ]
Prevent adding references for local, argument, and debug objects in acpi_ut_copy_simple_object().
--- drivers/acpi/acpica/utcopy.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/acpi/acpica/utcopy.c +9 -1
@@ -731,7 +731,15 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,break ; } -acpi_ut_add_reference (source_desc->reference.object); +/* +* Local/Arg/Debug references do not have a valid Object pointer +* that can be referenced +*/ +if ((source_desc->reference.class !=ACPI_REFCLASS_LOCAL ) && + (source_desc->reference.class !=ACPI_REFCLASS_ARG ) && + (source_desc->reference.class !=ACPI_REFCLASS_DEBUG )) { +acpi_ut_add_reference (source_desc->reference.object); + }break ;case ACPI_TYPE_REGION :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 240/1250 ACPICA: Fix integer overflow in acpi_ex_opcode_3A_1T_1R() (mid_op)
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 0e2021f49e64b3c8a9aa880d0c62a218bfe147ce ]
Add overflow check for Index + Length to prevent integer overflow when calculating the truncation length. This prevents negative size parameter being passed to memcpy().
--- drivers/acpi/acpica/exoparg3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/exoparg3.c +1 -1
@@ -152,7 +152,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)/* Truncate request if larger than the actual String/Buffer */ - else if ((index + length) > operand[0]->string.length) { + else if ((index + length) > operand[0]->string.length || (index + length) < index) { /* Check for overflow */ length = (acpi_size )operand[0 ]->string.length - (acpi_size )index;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 241/1250 ACPICA: Improve argument parsing in acpi_ps_get_next_simple_arg()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 27d27e75ecb752a0b4da848c440bb3a88396ecba ]
Improve argument parsing in acpi_ps_get_next_simple_arg() to handle remaining AML data safely.
--- drivers/acpi/acpica/psargs.c | 78 +++++++++++++++++++++++++++++++----- 1 file changed, 68 insertions(+), 10 deletions(-)
drivers/acpi/acpica/psargs.c +68 -10
@@ -384,6 +384,8 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,u32 length;u16 opcode;u8 *aml = parser_state->aml; +u32 remaining = (u32 )ACPI_PTR_DIFF (parser_state->aml_end, aml); +u64 partial_value;ACPI_FUNCTION_TRACE_U32 (ps_get_next_simple_arg, arg_type);
@@ -393,8 +395,13 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,/* Get 1 byte from the AML stream */ opcode =AML_BYTE_OP ; - arg->common.value.integer = (u64) *aml; - length =1 ; +if (remaining >=1 ) { + arg->common.value.integer = (u64)*aml; + length =1 ; + }else { + arg->common.value.integer =0 ; + length =0 ; + }break ;case ARGP_WORDDATA :
@@ -402,8 +409,19 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,/* Get 2 bytes from the AML stream */ opcode =AML_WORD_OP ; -ACPI_MOVE_16_TO_64 (&arg->common.value.integer, aml); - length =2 ; +if (remaining >=2 ) { +ACPI_MOVE_16_TO_64 (&arg->common.value.integer, aml); + length =2 ; + }else { + arg->common.value.integer =0 ; + length =0 ; +if (remaining >0 ) { + partial_value =0 ; +memcpy (&partial_value, aml, remaining); + arg->common.value.integer = partial_value; + length = remaining; + } + }break ;case ARGP_DWORDDATA :
@@ -411,8 +429,19 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,/* Get 4 bytes from the AML stream */ opcode =AML_DWORD_OP ; -ACPI_MOVE_32_TO_64 (&arg->common.value.integer, aml); - length =4 ; +if (remaining >=4 ) { +ACPI_MOVE_32_TO_64 (&arg->common.value.integer, aml); + length =4 ; + }else { + arg->common.value.integer =0 ; + length =0 ; +if (remaining >0 ) { + partial_value =0 ; +memcpy (&partial_value, aml, remaining); + arg->common.value.integer = partial_value; + length = remaining; + } + }break ;case ARGP_QWORDDATA :
@@ -420,8 +449,19 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,/* Get 8 bytes from the AML stream */ opcode =AML_QWORD_OP ; -ACPI_MOVE_64_TO_64 (&arg->common.value.integer, aml); - length =8 ; +if (remaining >=8 ) { +ACPI_MOVE_64_TO_64 (&arg->common.value.integer, aml); + length =8 ; + }else { + arg->common.value.integer =0 ; + length =0 ; +if (remaining >0 ) { + partial_value =0 ; +memcpy (&partial_value, aml, remaining); + arg->common.value.integer = partial_value; + length = remaining; + } + }break ;case ARGP_CHARLIST :
@@ -434,10 +474,28 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,/* Find the null terminator */ length =0 ; -while (aml[length]) { +while ((length < remaining) && aml[length]) { + length++; + } +if (length < remaining) { + +/* Account for the terminating null */ length++; + }else { +/* +* No terminator found - add null at buffer boundary +* and report a warning +*/ +ACPI_WARNING ((AE_INFO , +"Invalid AML string: no null terminator, truncating at offset %u" , + (u32)(aml - parser_state->aml))); + +/* Add null terminator at the boundary */ +if (remaining >0 ) { + aml[remaining -1 ] =0 ; + length = remaining; + } } - length++;break ;case ARGP_NAME :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 242/1250 ACPICA: validate handler object type in two places
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit c5296da2d516707862f8a2dbb4b515f777e5294f ]
ACPICA: validate handler object type in acpi_ev_has_default_handler() and acpi_ev_find_region_handler().
--- drivers/acpi/acpica/evhandler.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/acpi/acpica/evhandler.c +11 -0
@@ -130,6 +130,14 @@ acpi_ev_has_default_handler(struct acpi_namespace_node *node,/* Walk the linked list of handlers for this object */ while (handler_obj) { + +/* Validate handler object type before accessing fields */ + +if (handler_obj->common.type != +ACPI_TYPE_LOCAL_ADDRESS_HANDLER ) { +break ; + } +if (handler_obj->address_space.space_id == space_id) {if (handler_obj->address_space.handler_flags &ACPI_ADDR_HANDLER_DEFAULT_INSTALLED ) {
@@ -292,6 +300,9 @@ union acpi_operand_object *acpi_ev_find_region_handler(acpi_adr_space_type/* Walk the handler list for this device */ while (handler_obj) { +if (handler_obj->common.type !=ACPI_TYPE_LOCAL_ADDRESS_HANDLER ) { +break ; + }/* Same space_id indicates a handler is installed */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 243/1250 ACPICA: Add package limit checks in parser functions
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit d27d48a528e437aed690f977e69a6fe73fe82ab5 ]
Add package limit checks in parser functions to prevent out-of-bounds access.
--- drivers/acpi/acpica/nsxfname.c | 4 ++++ drivers/acpi/acpica/psargs.c | 4 ++++ drivers/acpi/acpica/psloop.c | 25 +++++++++++++++++++++++++ drivers/acpi/acpica/psparse.c | 8 ++++++++ 4 files changed, 41 insertions(+)
drivers/acpi/acpica/nsxfname.c +4 -0
@@ -512,6 +512,10 @@ acpi_status acpi_install_method(u8 *buffer) parser_state.aml +=acpi_ps_get_opcode_size (opcode); parser_state.pkg_end =acpi_ps_get_next_package_end (&parser_state); +if ((parser_state.pkg_end > parser_state.aml_end) || + (parser_state.pkg_end < parser_state.aml)) { +return (AE_AML_PACKAGE_LIMIT ); + } path =acpi_ps_get_next_namestring (&parser_state); method_flags = *parser_state.aml++;
drivers/acpi/acpica/psargs.c +4 -0
@@ -867,6 +867,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, parser_state->pkg_end =acpi_ps_get_next_package_end (parser_state); +if ((parser_state->pkg_end > parser_state->aml_end) + || (parser_state->pkg_end < parser_state->aml)) { +return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT ); + }break ;case ARGP_FIELDLIST :
drivers/acpi/acpica/psloop.c +25 -0
@@ -361,6 +361,13 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) walk_state->parser_state.aml =acpi_ps_get_next_package_end (&walk_state->parser_state); +if ((walk_state->parser_state.aml > + walk_state->parser_state.aml_end) + || (walk_state->parser_state.aml < + walk_state->aml)) { +return_ACPI_STATUS + (AE_AML_PACKAGE_LIMIT ); + } walk_state->aml = walk_state->parser_state.aml; }
@@ -421,6 +428,14 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) parser_state->aml =acpi_ps_get_next_package_end (parser_state); +if ((parser_state->aml > + parser_state->aml_end) + || (parser_state->aml < + walk_state->control_state-> + control.aml_predicate_start)) { +return_ACPI_STATUS + (AE_AML_PACKAGE_LIMIT ); + } walk_state->aml = parser_state->aml; ACPI_ERROR((AE_INFO,
@@ -436,6 +451,16 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) walk_state->parser_state.aml =acpi_ps_get_next_package_end (parser_state); +if ((walk_state->parser_state. + aml > + walk_state->parser_state. + aml_end) + || (walk_state-> + parser_state.aml < + walk_state->aml)) { +return_ACPI_STATUS + (AE_AML_PACKAGE_LIMIT ); + } walk_state->aml = parser_state->aml; }
drivers/acpi/acpica/psparse.c +8 -0
@@ -300,6 +300,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, {struct acpi_parse_state *parser_state = &walk_state->parser_state;acpi_status status =AE_CTRL_PENDING ; +u8 *aml;ACPI_FUNCTION_TRACE_PTR (ps_next_parse_state, op);
@@ -344,7 +345,14 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,* Predicate of an IF was true, and we are at the matching ELSE. * Just close out this package */ + aml = parser_state->aml; + parser_state->aml =acpi_ps_get_next_package_end (parser_state); +if ((parser_state->aml > parser_state->aml_end) || + (parser_state->aml < aml)) { + status =AE_AML_PACKAGE_LIMIT ; +break ; + } status =AE_CTRL_PENDING ;break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 244/1250 ACPICA: Add validation for node in acpi_ns_build_normalized_path()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 96b2b616870e46e2bc04efec03879683a0036e66 ]
Add validation for node in acpi_ns_build_normalized_path() to prevent use-after-free vulnerabilities.
--- drivers/acpi/acpica/nsnames.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/acpi/acpica/nsnames.c +6 -0
@@ -222,6 +222,12 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, goto build_trailing_null; } +/* Validate the Node to avoid use-after-free vulnerabilities */ + +if (ACPI_GET_DESCRIPTOR_TYPE (node) !=ACPI_DESC_TYPE_NAMED ) { + goto build_trailing_null; + } + next_node = node;while (next_node && next_node != acpi_gbl_root_node) {if (next_node != node) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 245/1250 ACPICA: Enhance OEM ID and Table ID validation in acpi_ex_load_table_op()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 485829e6999b7909f50761a1c708660304edc945 ]
Enhance OEM ID and Table ID validation in acpi_ex_load_table_op() to prevent buffer overflows.
--- drivers/acpi/acpica/exconfig.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/acpi/acpica/exconfig.c +24 -2
@@ -90,6 +90,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,union acpi_operand_object *return_obj;union acpi_operand_object *ddb_handle;u32 table_index; +char oem_id[ACPI_OEM_ID_SIZE +1 ]; +char oem_table_id[ACPI_OEM_TABLE_ID_SIZE +1 ];ACPI_FUNCTION_TRACE (ex_load_table_op);
@@ -102,12 +104,32 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, *return_desc = return_obj; +/* +* Validate OEM ID and OEM Table ID string lengths. +* acpi_tb_find_table expects strings that can safely read +* ACPI_OEM_ID_SIZE and ACPI_OEM_TABLE_ID_SIZE bytes. +*/ +if ((operand[1 ]->string.length >ACPI_OEM_ID_SIZE ) || + (operand[2 ]->string.length >ACPI_OEM_TABLE_ID_SIZE )) { +return_ACPI_STATUS (AE_AML_STRING_LIMIT ); + } + +/* +* Copy OEM strings to local buffers with guaranteed null-termination. +* This prevents heap-buffer-overflow when acpi_tb_find_table reads +* ACPI_OEM_ID_SIZE/ACPI_OEM_TABLE_ID_SIZE bytes. +*/ +memcpy (oem_id, operand[1 ]->string.pointer, operand[1 ]->string.length); + oem_id[operand[1 ]->string.length] =0 ; +memcpy (oem_table_id, operand[2 ]->string.pointer, + operand[2 ]->string.length); + oem_table_id[operand[2 ]->string.length] =0 ; +/* Find the ACPI table in the RSDT/XSDT */ acpi_ex_exit_interpreter (); status =acpi_tb_find_table (operand[0 ]->string.pointer, - operand[1 ]->string.pointer, - operand[2 ]->string.pointer, &table_index); + oem_id, oem_table_id, &table_index);acpi_ex_enter_interpreter ();if (ACPI_FAILURE (status)) {if (status !=AE_NOT_FOUND ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 246/1250 ACPICA: Fix NULL pointer dereference in acpi_ns_custom_package()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit f8d14b7bb0063bbbd86c0e4d73edb8cea7b362bc ]
acpi_ns_custom_package() unconditionally dereferences the first element of the package to read the _BIX version number, without checking for NULL:
if ((*Elements)->Common.Type != ACPI_TYPE_INTEGER)
When firmware returns a _BIX package whose first element is an unresolvable reference, ACPICA evaluates that entry to NULL. acpi_ns_remove_null_elements() does not strip NULL entries for ACPI_PTYPE_CUSTOM packages (fixed-position format would break if elements were shifted), so acpi_ns_custom_package() sees the NULL and causes a crash.
Add a NULL check for the first element (version field) before dereferencing it. The caller then receives AE_AML_OPERAND_TYPE instead of crashing.
--- drivers/acpi/acpica/nsprepkg.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/acpica/nsprepkg.c +7 -0
@@ -631,6 +631,13 @@ acpi_ns_custom_package(struct acpi_evaluate_info *info,/* Get version number, must be Integer */ +if (!(*elements)) { +ACPI_WARN_PREDEFINED ((AE_INFO , info->full_pathname, + info->node_flags, +"Return Package has a NULL version element" )); +return_ACPI_STATUS (AE_AML_OPERAND_TYPE ); + } +if ((*elements)->common.type !=ACPI_TYPE_INTEGER ) { ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 247/1250 ACPICA: Enhance buffer validation in acpi_ut_walk_aml_resources()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit b2e21fe8c3361c3d0d57ee56d359bea9b51fda3d ]
Enhance buffer validation in acpi_ut_walk_aml_resources() to prevent buffer overflows.
--- drivers/acpi/acpica/utresrc.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/acpi/acpica/utresrc.c +30 -0
@@ -165,6 +165,28 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,/* Walk the byte list, abort on any invalid descriptor type or length */ while (aml < end_aml) { +/* +* Validate that the remaining buffer space can hold enough +* bytes to safely access fields during validation. +* For large resource descriptors (bit 7 set), we need enough +* bytes to access the Type field in serial_bus resources. +* Small resource descriptors only need sizeof(struct aml_resource_end_tag). +*/ +if ((acpi_size)(end_aml - aml) < +sizeof (struct aml_resource_end_tag )) { +return_ACPI_STATUS (AE_AML_BUFFER_LENGTH ); + } + +/* +* For large resource descriptors, ensure enough space for +* the header plus serial_bus Type field access. +*/ +if ((ACPI_GET8 (aml) &ACPI_RESOURCE_NAME_LARGE ) && + ((acpi_size)(end_aml - aml) < + ACPI_OFFSET(struct aml_resource_common_serialbus, + type) +1 )) { +return_ACPI_STATUS (AE_AML_BUFFER_LENGTH ); + }/* Validate the Resource Type and Resource Length */
@@ -182,6 +204,14 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, length =acpi_ut_get_descriptor_length (aml); +/* +* Validate that the descriptor length doesn't exceed the +* remaining buffer size to prevent reading beyond the end. +*/ +if (length > (acpi_size)(end_aml - aml)) { +return_ACPI_STATUS (AE_AML_BUFFER_LENGTH ); + } +/* Invoke the user function */ if (user_function) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 248/1250 ACPICA: add boundary checks in two places
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit bdc35754012906dbf094be104b103ca3adfef6f7 ]
Add boundary checks in acpi_ps_get_next_namestring() and acpi_ps_peek_opcode() to prevent out-of-bounds access.
--- drivers/acpi/acpica/psargs.c | 18 +++++++++++++++++- drivers/acpi/acpica/psparse.c | 6 ++++++ 2 files changed, 23 insertions(+), 1 deletion(-)
drivers/acpi/acpica/psargs.c +17 -1
@@ -148,10 +148,16 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)/* Point past any namestring prefix characters (backslash or carat) */ -while (ACPI_IS_ROOT_PREFIX (*end) ||ACPI_IS_PARENT_PREFIX (*end)) { +while (end < parser_state->aml_end && + (ACPI_IS_ROOT_PREFIX (*end) ||ACPI_IS_PARENT_PREFIX (*end))) { end++; } +if (end >= parser_state->aml_end) { + parser_state->aml = parser_state->aml_end; +return_PTR (NULL ); + } +/* Decode the path prefix character */ switch (*end) {
@@ -176,6 +182,11 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)/* Multiple name segments, 4 chars each, count in next byte */ +if ((end +1 ) >= parser_state->aml_end) { + parser_state->aml = parser_state->aml_end; +return_PTR (NULL ); + } + end +=2 + (*(end +1 ) *ACPI_NAMESEG_SIZE );break ;
@@ -187,6 +198,11 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)break ; } +if (end > parser_state->aml_end) { + parser_state->aml = parser_state->aml_end; +return_PTR (NULL ); + } + parser_state->aml = end;return_PTR ((char *)start); }
drivers/acpi/acpica/psparse.c +6 -0
@@ -70,6 +70,9 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)u16 opcode; aml = parser_state->aml; +if (aml >= parser_state->aml_end) { +return (0xFFFF ); + } opcode = (u16 )ACPI_GET8 (aml);if (opcode ==AML_EXTENDED_PREFIX ) {
@@ -77,6 +80,9 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)/* Extended opcode, get the second opcode byte */ aml++; +if (aml >= parser_state->aml_end) { +return (0xFFFF ); + } opcode = (u16) ((opcode <<8 ) |ACPI_GET8 (aml)); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 249/1250 hfs: rework hfsplus_readdir() logic
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viacheslav Dubeyko <[email protected]>
[ Upstream commit 7fde7e806657fbe0d33f489521b488eed94f9b39 ]
The xfstests' test-case generic/637 fails with error:
FSTYP -- hfs
PLATFORM -- Linux/x86_64 kvm-xfstests 6.15.0-rc4-xfstests-g00b827f0cffa #1 SMP PREEMPT_DYNAMIC Fri May 25 MKFS_OPTIONS -- /dev/vdcMOUNT_OPTIONS -- /dev/vdc /vdc
QA output created by 637
entries 7 and 8 have duplicate d_off 8
Found unlinked files in open dir (see xfstests-dev/results//generic/637.full for details)
Likewise HFS+, currently, HFS has very complicated and fragile logic of rd->file->f_pos correction in hfs_delete_cat(). This patch removes this logic and it stores the current pos into hfs_readdir_data. Finally, if rd->pos == ctx->pos then hfs_readdir() tries to find the position in b-tree's node by means of hfs_cat_key. This position is used to re-start the folder's content traversal.
sudo ./check generic/637
FSTYP -- hfs PLATFORM -- Linux/x86_64 hfsplus-testing-0001 7.1.0-rc1+ #55 SMP PREEMPT_DYNAMIC Tue May 19 15:18:02 PDT 2026 MKFS_OPTIONS -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
generic/637 32s ... 31s
Ran: generic/637
Passed all 1 tests
--- fs/hfs/catalog.c | 9 --------- fs/hfs/dir.c | 28 +++++++++++----------------- fs/hfs/hfs.h | 3 +-- fs/hfs/hfs_fs.h | 2 -- fs/hfs/inode.c | 4 ---- 5 files changed, 12 insertions(+), 34 deletions(-)
fs/hfs/catalog.c +0 -9
@@ -340,7 +340,6 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str) {struct super_block *sb;struct hfs_find_data fd; -struct hfs_readdir_data *rd;int res, type;hfs_dbg ("name %s, cnid %u\n" , str ? str->name :NULL , cnid);
@@ -366,14 +365,6 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str) } } -/* we only need to take spinlock for exclusion with ->release() */ -spin_lock (&HFS_I (dir)->open_dir_lock); -list_for_each_entry (rd, &HFS_I (dir)->open_dir_list, list) { -if (fd.tree->keycmp (fd.search_key, (void *)&rd->key) <0 ) - rd->file->f_pos--; - } -spin_unlock (&HFS_I (dir)->open_dir_lock); - res =hfs_brec_remove (&fd);if (res) goto out;
fs/hfs/dir.c +11 -17
@@ -97,7 +97,15 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx) }if (ctx->pos >= inode->i_size) goto out; - err =hfs_brec_goto (&fd, ctx->pos -1 ); + rd = file->private_data; +if (rd && rd->pos == ctx->pos) { +memcpy (fd.search_key, &rd->key,sizeof (struct hfs_cat_key )); + err =hfs_brec_find (&fd); +if (err == -ENOENT ) + err =hfs_brec_goto (&fd,1 ); + }else { + err =hfs_brec_goto (&fd, ctx->pos -1 ); + }if (err) goto out;
@@ -146,7 +154,6 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx)if (err) goto out; } - rd = file->private_data;if (!rd) { rd =kmalloc (sizeof (struct hfs_readdir_data ),GFP_KERNEL );if (!rd) {
@@ -154,15 +161,8 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx) goto out; } file->private_data = rd; - rd->file = file; -spin_lock (&HFS_I (inode)->open_dir_lock); -list_add (&rd->list, &HFS_I (inode)->open_dir_list); -spin_unlock (&HFS_I (inode)->open_dir_lock); } -/* -* Can be done after the list insertion; exclusion with -* hfs_delete_cat() is provided by directory lock. -*/ + rd->pos = ctx->pos;memcpy (&rd->key, &fd.key->cat,sizeof (struct hfs_cat_key )); out:hfs_find_exit (&fd);
@@ -171,13 +171,7 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx)static int hfs_dir_release (struct inode *inode,struct file *file) { -struct hfs_readdir_data *rd = file->private_data; -if (rd) { -spin_lock (&HFS_I (inode)->open_dir_lock); -list_del (&rd->list); -spin_unlock (&HFS_I (inode)->open_dir_lock); -kfree (rd); - } +kfree (file->private_data);return 0 ; }
fs/hfs/hfs.h +1 -2
@@ -281,8 +281,7 @@ struct hfs_mdb {/*======== Data structures kept in memory ========*/ struct hfs_readdir_data { -struct list_head list; -struct file *file; +loff_t pos;struct hfs_cat_key key; };
fs/hfs/hfs_fs.h +0 -2
@@ -37,8 +37,6 @@ struct hfs_inode_info {struct hfs_cat_key cat_key; -struct list_head open_dir_list; -spinlock_t open_dir_lock;struct inode *rsrc_inode;struct mutex extents_lock;
fs/hfs/inode.c +0 -4
@@ -192,8 +192,6 @@ struct inode *hfs_new_inode(struct inode *dir, const struct qstr *name, umode_treturn NULL ;mutex_init (&HFS_I (inode)->extents_lock); -INIT_LIST_HEAD (&HFS_I (inode)->open_dir_list); -spin_lock_init (&HFS_I (inode)->open_dir_lock);hfs_cat_build_key (sb, (btree_key *)&HFS_I (inode)->cat_key, dir->i_ino, name); next_id =atomic64_inc_return (&HFS_SB (sb)->next_id);BUG_ON (next_id >U32_MAX );
@@ -334,8 +332,6 @@ static int hfs_read_inode(struct inode *inode, void *data)HFS_I (inode)->flags =0 ;HFS_I (inode)->rsrc_inode =NULL ;mutex_init (&HFS_I (inode)->extents_lock); -INIT_LIST_HEAD (&HFS_I (inode)->open_dir_list); -spin_lock_init (&HFS_I (inode)->open_dir_lock);/* Initialize the inode */ inode->i_uid = hsb->s_uid;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 250/1250 net: sfp: add quirk for OEM 2.5G optical modules
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Qisen <[email protected]>
[ Upstream commit 5af067bf8a64dac896f120a98fe2ca656df92562 ]
Some OEM-branded SFP modules are incorrectly detected as 1000Base-X and fail to establish link on 2.5G-capable ports.
These modules do not properly advertise 2500Base-X capability in their EEPROM and require forcing the correct SerDes mode.
Add sfp_quirk_2500basex for:
- OEM SFP-2.5G-LH03-B
- OEM SFP-2.5G-LH20-A
Both modules report:
Vendor name: OEM
Vendor PN: SFP-2.5G-LH03-B / SFP-2.5G-LH20-A
Tested on OpenWrt with successful 2.5G link establishment.
--- drivers/net/phy/sfp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/sfp.c +2 -0
@@ -583,6 +583,8 @@ static const struct sfp_quirk sfp_quirks[] = {SFP_QUIRK_S ("OEM" ,"SFP-2.5G-T" , sfp_quirk_oem_2_5g),SFP_QUIRK_S ("OEM" ,"SFP-2.5G-BX10-D" , sfp_quirk_2500basex),SFP_QUIRK_S ("OEM" ,"SFP-2.5G-BX10-U" , sfp_quirk_2500basex), +SFP_QUIRK_S ("OEM" ,"SFP-2.5G-LH03-B" , sfp_quirk_2500basex), +SFP_QUIRK_S ("OEM" ,"SFP-2.5G-LH20-A" , sfp_quirk_2500basex),SFP_QUIRK_F ("OEM" ,"RTSFP-10" , sfp_fixup_rollball_cc),SFP_QUIRK_F ("OEM" ,"RTSFP-10G" , sfp_fixup_rollball_cc), SFP_QUIRK_F("Turris", "RTSFP-2.5G", sfp_fixup_rollball),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 251/1250 pinctrl: renesas: rzv2m: Use -ENOTSUPP instead of -EOPNOTSUPP
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
[ Upstream commit 01f94d53947df35ba77cdb3992a4e3ef9d9dc1ad ]
The pinctrl and GPIO core code make exceptions for the -ENOTSUPP error code. One such example is gpio_set_config_with_argument_optional(), which returns success when gpio_set_config_with_argument() returns -ENOTSUPP, but reports failure for all other error codes.
Returning -EOPNOTSUPP from the pinctrl driver on the unsupported pinctrl operation may lead to boot failures when pinctrl drivers implements struct gpio_chip::set_config, the system uses GPIO hogs, and the struct gpio_chip::set_config implementation returns -EOPNOTSUPP for the unsupported operations.
Currently, the driver does not implement struct gpio_chip::set_config(). To avoid future failures, return -ENOTSUPP from rzv2m_pinctrl_pinconf_set().
rzv2m_pinctrl_pinconf_group_get() is used when dumping pinctrl configuration. pinconf_generic_dump_one(), which calls it, makes exceptions for the -EINVAL and -ENOTSUPP error codes. The documentation for struct pinconf_ops::pin_config_group_get states that it "should return -ENOTSUPP and -EINVAL using the same rules as pin_config_get()". The documentation for struct pinconf_ops::pin_config_get states:
"get the config of a certain pin, if the requested config is not available on this controller this should return -ENOTSUPP and if it is available but disabled it should return -EINVAL".
Return -ENOTSUPP for the unsupported pinctrl operation.
--- drivers/pinctrl/renesas/pinctrl-rzv2m.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/renesas/pinctrl-rzv2m.c +2 -2
@@ -661,7 +661,7 @@ static int rzv2m_pinctrl_pinconf_set(struct pinctrl_dev *pctldev, }default : -return -EOPNOTSUPP ; +return -ENOTSUPP ; } }
@@ -710,7 +710,7 @@ static int rzv2m_pinctrl_pinconf_group_get(struct pinctrl_dev *pctldev,/* Check config matches previous pins */ if (i && prev_config != *config) -return -EOPNOTSUPP ; +return -ENOTSUPP ; prev_config = *config; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 252/1250 host1x: bus: Fix missing ops null check in error teardown
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: shayderrr <[email protected]>
[ Upstream commit 71d25f668bc5c0f36ea843462e12307dea45aaa3 ]
In host1x_device_init(), the error teardown paths do not check client->ops before dereferencing it, unlike the forward init paths which correctly guard with 'client->ops &&'. This can result in a NULL pointer dereference if client->ops is NULL.
Fix by adding the missing client->ops check in both the teardown and teardown_late labels.
--- drivers/gpu/host1x/bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/host1x/bus.c +2 -2
@@ -221,7 +221,7 @@ int host1x_device_init(struct host1x_device *device) teardown:list_for_each_entry_continue_reverse (client, &device->clients, list) -if (client->ops->exit) +if (client->ops && client->ops->exit) client->ops->exit (client);/* reset client to end of list for late teardown */
@@ -229,7 +229,7 @@ int host1x_device_init(struct host1x_device *device) teardown_late:list_for_each_entry_continue_reverse (client, &device->clients, list) -if (client->ops->late_exit) +if (client->ops && client->ops->late_exit) client->ops->late_exit (client);mutex_unlock (&device->clients_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 253/1250 scripts: modpost: detect and report truncated buf_printf() output
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Courbot <[email protected]>
[ Upstream commit d7231d8cb262b1e350c00271bf53d54414b4f3b1 ]
buf_printf() uses a fixed-size stack buffer. vsnprintf() returns the number of bytes that *would* have been written to that buffer, which can be larger than the size of said buffer if the formatted string is too long.
The problem is that whenever this happens buf_printf() currently passes this length, unchecked, to buf_write(), which silently reads past the stack buffer and copies invalid data into the output buffer.
Fix this by detecting vsnprintf() failures and truncations before appending to the output buffer, and report a fatal error instead of producing corrupt symbol names.
--- scripts/mod/modpost.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
scripts/mod/modpost.c +10 -1
@@ -1679,8 +1679,17 @@ void __attribute__((format(printf, 2, 3))) buf_printf(struct buffer *buf,va_start (ap, fmt); len =vsnprintf (tmp,SZ , fmt, ap); -buf_write (buf, tmp, len);va_end (ap); + +if (len <0 ) { +perror ("vsnprintf failed" ); +exit (1 ); + } +if (len >=SZ ) +fatal ("buf_printf output truncated for string %s: %d bytes needed, %d available\n" , + tmp, len +1 ,SZ ); + +buf_write (buf, tmp, len); }void buf_write (struct buffer *buf,const char *s,int len)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 254/1250 drm/nouveau/gsp: add SEC2 to GA100 chip table
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
[ Upstream commit 604d0efb17cc0dd197e089134736ac2698d5fca7 ]
The booter-load and booter-unload firmware run on the SEC2 falcon. During tu102_gsp_oneinit(), the booter constructor needs device->sec2 to access the SEC2 falcon.
Without the .sec2 entry, device->sec2 is NULL and this dereference crashes during GSP-RM boot.
--- drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +1 -0
@@ -2529,6 +2529,7 @@ nv170_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .ce = { 0x000003ff, ga100_ce_new }, .fifo = { 0x00000001, ga100_fifo_new }, + .sec2 = { 0x00000001, tu102_sec2_new }, }; static const struct nvkm_device_chip
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 255/1250 x86/topology: Add missing struct declaration and attribute dependency
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Neri <[email protected]>
[ Upstream commit bdf5eb306c4d07a3bfdd4e2ab8f2acc7ff824940 ]
The prototypes for get_topology_cpu_type_name() and get_topology_cpu_type() take a pointer to struct cpuinfo_x86, but asm/topology.h neither includes nor forward-declares the structure. Including asm/topology.h, directly or indirectly, without including asm/processor.h triggers a warning:
./arch/x86/include/asm/topology.h:159:47: error: ‘struct cpuinfo_x86’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
159 | const char *get_topology_cpu_type_name(struct cpuinfo_x86 *c);
| ^~~~~~~~~~~
Since only a pointer is needed, add a forward declaration of struct cpuinfo_x86.
Additionally, sysctl_sched_itmt_enabled is declared in asm/topology.h with the __read_mostly attribute, but the header does not include linux/cache.h. This causes a build failure when including asm/topology.h but not linux/ cache.h:
./arch/x86/include/asm/topology.h:264:27: error: expected ‘=’, ‘,’,
‘;’, ‘asm’ or ‘__attribute__’ before ‘sysctl_sched_itmt_enabled’
264 | extern bool __read_mostly sysctl_sched_itmt_enabled;
| ^~~~~~~~~~~~~~~~~~~~~~~~~Include the required header.
--- arch/x86/include/asm/topology.h | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/include/asm/topology.h +3 -0
@@ -156,6 +156,8 @@ extern unsigned int __max_threads_per_core;extern unsigned int __num_threads_per_package;extern unsigned int __num_cores_per_package; +struct cpuinfo_x86 ; +const char *get_topology_cpu_type_name (struct cpuinfo_x86 *c);enum x86_topology_cpu_type get_topology_cpu_type (struct cpuinfo_x86 *c);
@@ -259,6 +261,7 @@ extern bool x86_topology_update;#ifdef CONFIG_SCHED_MC_PRIO #include <asm/percpu.h> +#include <linux/cache.h> DECLARE_PER_CPU_READ_MOSTLY (int, sched_core_priority);extern bool __read_mostly sysctl_sched_itmt_enabled;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 256/1250 ASoC: Intel: catpt: Complete coredump handling
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 7e5d59f407bc39d43b350cc45f7880647429eb5d ]
An exception may occur during the firmware booting procedure. In such case the firmware sends COREDUMP_REQUESTS and expects the driver to dump relevant information and finish with the COREDUMP_RELEASE write.
To distinguish such situation from generic timeout, always signal fw_ready completion when a coredump request is received and translate it to -EREMOTEIO in catpt_boot_firmware().
The "FW READY" print makes the success clearly visible even when the event-traces are not enabled.
--- sound/soc/intel/catpt/ipc.c | 8 ++++++++ sound/soc/intel/catpt/loader.c | 3 +++ sound/soc/intel/catpt/registers.h | 12 ++++++++++++ 3 files changed, 23 insertions(+)
sound/soc/intel/catpt/ipc.c +8 -0
@@ -205,6 +205,7 @@ static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header)memcpy_fromio (&config, cdev->lpe_ba + off,sizeof (config));trace_catpt_ipc_payload ((u8 *)&config,sizeof (config)); +dev_dbg (cdev->dev,"FW READY 0x%08x\n" , header);catpt_ipc_arm (ipc, &config);complete (&cdev->fw_ready);return ;
@@ -215,6 +216,13 @@ static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header)dev_err (cdev->dev,"ADSP device coredump received\n" ); ipc->ready = false;catpt_coredump (cdev); + +if (catpt_readl_dram (cdev,COREDUMP ) ==CATPT_COREDUMP_REQUEST ) { +dev_dbg (cdev->dev,"releasing firmware from the coredump state\n" ); +catpt_writel_dram (cdev,COREDUMP ,CATPT_COREDUMP_RELEASE ); + } + +complete (&cdev->fw_ready);/* TODO: attempt recovery */ break ;
sound/soc/intel/catpt/loader.c +3 -0
@@ -626,6 +626,9 @@ int catpt_boot_firmware(struct catpt_dev *cdev, bool restore)if (!ret) {dev_err (cdev->dev,"firmware ready timeout\n" );return -ETIMEDOUT ; +/* Wake up does not mean FW is ready, an exception could occur. */ + }else if (!cdev->ipc.ready) { +return -EREMOTEIO ; }/* update sram pg & clock once done booting */
sound/soc/intel/catpt/registers.h +12 -0
@@ -124,6 +124,11 @@#define CATPT_SSCR2_DEFAULT 0x0#define CATPT_SSPSP2_DEFAULT 0x0 +/* Coredump register and its states */ +#define CATPT_DRAM_COREDUMP 0x1F4 +#define CATPT_COREDUMP_REQUEST UINT_MAX +#define CATPT_COREDUMP_RELEASE 0 +/* Physically the same block, access address differs between host and dsp */ #define CATPT_DSP_DRAM_OFFSET 0x400000#define catpt_to_host_offset (offset) ((offset) & ~(CATPT_DSP_DRAM_OFFSET))
@@ -137,6 +142,8 @@/* registry I/O helpers */ +#define catpt_dram_addr (cdev) \ + ((cdev)->lpe_ba + (cdev)->spec->host_dram_offset)#define catpt_shim_addr (cdev) \ ((cdev)->lpe_ba + (cdev)->spec->host_shim_offset)#define catpt_dma_addr (cdev, dma) \
@@ -151,6 +158,11 @@#define catpt_writel_ssp (cdev, ssp, reg, val) \ writel(val, catpt_ssp_addr(cdev, ssp) + (reg)) +#define catpt_readl_dram (cdev, reg) \ + readl(catpt_dram_addr(cdev) + CATPT_DRAM_##reg) +#define catpt_writel_dram (cdev, reg, val) \ + writel(val, catpt_dram_addr(cdev) + CATPT_DRAM_##reg) +#define catpt_readl_shim (cdev, reg) \ readl(catpt_shim_addr(cdev) + CATPT_SHIM_##reg)#define catpt_writel_shim (cdev, reg, val) \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 257/1250 drm/nouveau/bios: skip the IFR header if present
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
[ Upstream commit 4beeac5d2015df1017732ce4c57d634f557dd304 ]
The GPU's ROM may begin with an Init-from-ROM (IFR) header that precedes the PCI Expansion ROM images (VBIOS). When present, the PROM shadow method must parse this header to determine the offset where the PCI ROM images actually begin, and adjust all subsequent reads accordingly.
On most GPUs this is not needed because either the PRAMIN shadow method (which reads from VRAM via the display engine) succeeds first, or the IFR microcode has already applied the ROM offset so that PROM reads transparently skip the header. However, on GA100 neither of these
applies: GA100 has no display engine (so PRAMIN is unavailable), and the IFR offset is not applied to PROM reads on this GPU.
--- .../drm/nouveau/nvkm/subdev/bios/shadowrom.c | 110 ++++++++++++++++-- 1 file changed, 101 insertions(+), 9 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.c +101 -9
@@ -24,34 +24,126 @@#include <subdev/pci.h> +#define NV_PBUS_IFR_FMT_FIXED0_SIGNATURE_VALUE 0x4947564E/* "NVGI" */ +#define NV_ROM_DIRECTORY_IDENTIFIER 0x44524652/* "RFRD" */ + +struct priv { +struct nvkm_device *device; +u32 pci_rom_offset; +}; +static u32 nvbios_prom_read (void *data,u32 offset,u32 length,struct nvkm_bios *bios) { -struct nvkm_device *device = data; +struct priv *priv = data; +struct nvkm_device *device = priv->device;u32 i; -if (offset + length <=0x00100000 ) { -for (i = offset; i < offset + length; i +=4 ) - *(u32 *)&bios->data[i] =nvkm_rd32 (device,0x300000 + i); -return length; - } -return 0 ; + +/* Make sure we don't try to read past the end of data[] */ +if (offset + length > bios->size) +return 0 ; + +/* Make sure the read falls within the 1MB PROM window */ +if (offset + priv->pci_rom_offset + length >0x00100000 ) +return 0 ; + +for (i = offset; i < offset + length; i +=4 ) + *(u32 *)&bios->data[i] =nvkm_rd32 (device,0x300000 + priv->pci_rom_offset + i); +return length; }static void nvbios_prom_fini (void *data) { -struct nvkm_device *device = data; +struct priv *priv = data; +struct nvkm_device *device = priv->device; +nvkm_pci_rom_shadow (device->pci, true); + +kfree (data); }static void *nvbios_prom_init (struct nvkm_bios *bios,const char *name) {struct nvkm_device *device = bios->subdev.device; +struct priv *priv; +u32 fixed0; + +/* There is no PROM on NV4x iGPUs */ if (device->card_type ==NV_40 && device->chipset >=0x4c )return ERR_PTR (-ENODEV ); + + priv =kzalloc_obj (*priv); +if (!priv) +return ERR_PTR (-ENOMEM ); + +/* Disable the PCI ROM shadow so that we can read PROM. */ nvkm_pci_rom_shadow (device->pci, false); -return device; + +/* +* Check for an IFR header. If present, parse it to find the actual PCI ROM header. +* +* The IFR header is documented in Documentation/gpu/nova/core/vbios.rst +*/ + fixed0 =nvkm_rd32 (device,0x300000 ); +if (fixed0 ==NV_PBUS_IFR_FMT_FIXED0_SIGNATURE_VALUE ) { +u32 fixed1 =nvkm_rd32 (device,0x300004 ); +u8 version = (fixed1 >>8 ) &0xff ; +u32 fixed2, data_size, offset, signature; + +switch (version) { +case 1 : +case 2 : + data_size = (fixed1 >>16 ) &0x7fff ; + priv->pci_rom_offset =nvkm_rd32 (device,0x300000 + data_size +4 ); +break ; +case 3 : + fixed2 =nvkm_rd32 (device,0x300008 ); + data_size = fixed2 &0x000fffff ; + +/* ROM directory offset */ + offset =nvkm_rd32 (device,0x300000 + data_size) +4096 ; + + signature =nvkm_rd32 (device,0x300000 + offset); +if (signature !=NV_ROM_DIRECTORY_IDENTIFIER ) { +nvkm_error (&bios->subdev,"could not find IFR ROM directory\n" ); + goto fail; + } + + priv->pci_rom_offset =nvkm_rd32 (device,0x300000 + offset +8 ); + +break ; +default : +nvkm_error (&bios->subdev,"unsupported IFR header version %u\n" , + version); + goto fail; + } + +/* Double-check that the offset is valid */ +if (priv->pci_rom_offset >=0x00100000 ) { +nvkm_error (&bios->subdev, +"PCI ROM offset of 0x%x is too large\n" , priv->pci_rom_offset); + goto fail; + } + +/* If there is an IFR header, there must also be a PCI ROM header. */ + signature =nvkm_rd32 (device,0x300000 + priv->pci_rom_offset) &0xffff ; +if (signature !=0xaa55 ) { +nvkm_error (&bios->subdev, +"could not find PCI ROM signature at offset 0x%x\n" , + priv->pci_rom_offset); + goto fail; + } + } + + priv->device = device; +return priv; + +fail: +nvkm_pci_rom_shadow (device->pci, true); +kfree (priv); +return ERR_PTR (-ENODEV ); } const struct nvbios_source
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 258/1250 libbpf: Add __NR_bpf definition for LoongArch
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
[ Upstream commit a4a5d4ee061240a1d39053db0a87f841d43277c0 ]
LoongArch uses the generic syscall table, where __NR_bpf is defined as 280 in include/uapi/asm-generic/unistd.h.
To align with other architectures, add the __NR_bpf definition for LoongArch to avoid a potential compilation failure: "error __NR_bpf not defined. libbpf does not support your arch."
This is a follow up patch of:
commit b0c47807d31d ("bpf: Add sparc support to tools and samples.") commit bad1926dd2f6 ("bpf, s390: fix build for libbpf and selftest suite") commit ca31ca8247e2 ("tools/bpf: fix perf build error with uClibc (seen on ARC)") commit e32cb12ff52a ("bpf, mips: Fix build errors about __NR_bpf undeclared")
--- tools/build/feature/test-bpf.c | 2 ++ tools/lib/bpf/bpf.c | 2 ++ 2 files changed, 4 insertions(+)
tools/build/feature/test-bpf.c +2 -0
@@ -20,6 +20,8 @@# define __NR_bpf 6319# elif defined(__mips__) && defined(_ABI64)# define __NR_bpf 5315 +# elif defined(__loongarch__) +# define __NR_bpf 280# else # error __NR_bpf not defined. libbpf does not support your arch.# endif
tools/lib/bpf/bpf.c +2 -0
@@ -59,6 +59,8 @@# define __NR_bpf 6319# elif defined(__mips__) && defined(_ABI64)# define __NR_bpf 5315 +# elif defined(__loongarch__) +# define __NR_bpf 280# else # error __NR_bpf not defined. libbpf does not support your arch.# endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 259/1250 soc/tegra: fuse: Register nvmem lookups at probe
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kartik Rajput <[email protected]>
[ Upstream commit 8a3571618c2e3f339b5b6fee5841143face58a2b ]
Register nvmem lookups in tegra_fuse_probe(), after the nvmem device has been registered, since they can only be used after the nvmem device is registered.
--- drivers/soc/tegra/fuse/fuse-tegra.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/soc/tegra/fuse/fuse-tegra.c +5 -9
@@ -182,10 +182,6 @@ static int tegra_fuse_probe(struct platform_device *pdev) } fuse->soc->init (fuse); - - err =tegra_fuse_add_lookups (fuse); -if (err) -return dev_err_probe (&pdev->dev, err,"failed to add FUSE lookups\n" ); } fuse->clk =devm_clk_get_optional (&pdev->dev,"fuse" );
@@ -231,6 +227,10 @@ static int tegra_fuse_probe(struct platform_device *pdev)return err; } + err =tegra_fuse_add_lookups (fuse); +if (err) +return dev_err_probe (&pdev->dev, err,"failed to add FUSE lookups\n" ); + fuse->rst =devm_reset_control_get_optional (&pdev->dev,"fuse" );if (IS_ERR (fuse->rst))return dev_err_probe (&pdev->dev,PTR_ERR (fuse->rst),"failed to get FUSE reset\n" );
@@ -473,7 +473,7 @@ static int __init tegra_init_fuse(void)const struct of_device_id *match;struct device_node *np;struct resource regs; -int err; +int err =0 ;tegra_init_apbmisc ();
@@ -566,10 +566,6 @@ static int __init tegra_init_fuse(void)tegra_fuse_print_sku_info (&tegra_sku_info); - err =tegra_fuse_add_lookups (fuse); -if (err) -pr_err ("failed to add FUSE lookups\n" ); -return err; }early_initcall (tegra_init_fuse);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 260/1250 soundwire: dmi-quirks: Disable ghost Realtek devices
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit 4dab2b904414fac53535c4e4cdad808132f4cdc2 ]
Many systems ship with a Realtek audio codec in the ACPI that doesn't physically exist in the system. This confuses the newer function topology system that creates the soundcard, as it builds the card based on the ACPI information.
Whilst we are working with the laptop vendors to try and stop this happening there are quite a few systems where this has shipped. Add a quirk to disable this "ghost" device.
Currently this patch should cover:
- Asus UX5406AA
- Lenovo Yoga Pro 9i (83SF)
- Lenovo Yoga Slim 7 Ultra (83QK)
--- drivers/soundwire/dmi-quirks.c | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/soundwire/dmi-quirks.c +35 -0
@@ -90,6 +90,19 @@ static const struct adr_remap intel_rooks_county[] = { {} }; +/* +* Many platforms have ghost realtek devices in the ACPI that don't physically +* exist, remove those devices. +*/ +static const struct adr_remap ghost_realtek[] = { +/* rt722 on link3 */ + { +0x000330025d072201ull , +0x0000000000000000ull + }, + {} +}; +static const struct dmi_system_id adr_remap_quirk_table[] = {/* TGL devices */ {
@@ -164,6 +177,28 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { }, .driver_data = (void *)hp_omen_16, }, +/* PTL devices */ + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUS"), + DMI_MATCH(DMI_BOARD_NAME, "UX5406AA"), + }, + .driver_data = (void *)ghost_realtek, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83QK"), + }, + .driver_data = (void *)ghost_realtek, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83SF"), + }, + .driver_data = (void *)ghost_realtek, + }, {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 261/1250 gfs2: page poisoning fix
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit 4982e58669b11c43644efb5fb7435975848b716e ]
Processes can write to the last page of a file using mmap, and when the file size is not a multiple of the page size, this can be used to write beyond the end of the file. This is sometimes referred to as page poisoning, and it is not a problem in itself because the data beyond eof will be ignored. However, we currently fail to clear out any space beyond the end of the file that we skip over when the file size is increased, so that "poison" can end up getting exposed. Fix that.
Fixes xfstest generic/363.
--- fs/gfs2/bmap.c | 19 +++++++++++++++++++ fs/gfs2/bmap.h | 1 + fs/gfs2/file.c | 10 ++++++++++ 3 files changed, 30 insertions(+)
fs/gfs2/bmap.c +19 -0
@@ -1321,6 +1321,19 @@ static int gfs2_block_zero_range(struct inode *inode, loff_t from, loff_t length &gfs2_iomap_write_ops, NULL); } +int gfs2_clear_beyond_eof (struct inode *inode,loff_t end) +{ +loff_t isize =i_size_read (inode); +unsigned int len = isize & ~PAGE_MASK ; + +if (!len || isize >= end) +return 0 ; + len =PAGE_SIZE - len; +if (end - isize < len) + len = end - isize; +return gfs2_block_zero_range (inode, isize, len); +} +#define GFS2_JTRUNC_REVOKES 8192/**
@@ -2096,6 +2109,12 @@ static int do_grow(struct inode *inode, u64 size) unstuff =1 ; } +if (!unstuff) { + error =gfs2_clear_beyond_eof (inode, size); +if (error) + goto do_grow_qunlock; + } + error = gfs2_trans_begin(sdp, RES_DINODE + RES_STATFS + RES_RG_BIT + (unstuff && gfs2_is_jdata(ip) ? RES_JDATA : 0) +
fs/gfs2/bmap.h +1 -0
@@ -58,6 +58,7 @@ int gfs2_get_extent(struct inode *inode, u64 lblock, u64 *dblock, unsigned int *extlen);int gfs2_alloc_extent (struct inode *inode,u64 lblock,u64 *dblock,unsigned *extlen,bool *new); +int gfs2_clear_beyond_eof (struct inode *inode,loff_t end);int gfs2_setattr_size (struct inode *inode,u64 size);int gfs2_truncatei_resume (struct gfs2_inode *ip);int gfs2_file_dealloc (struct gfs2_inode *ip);
fs/gfs2/file.c +10 -0
@@ -1057,6 +1057,10 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb, goto out_unlock; } + ret =gfs2_clear_beyond_eof (inode, iocb->ki_pos); +if (ret) + goto out_unlock; +pagefault_disable (); ret =iomap_file_buffered_write (iocb, from, &gfs2_iomap_ops, &gfs2_iomap_write_ops,NULL );
@@ -1266,6 +1270,12 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t next = (next +1 ) << sdp->sd_sb.sb_bsize_shift; +if (!(mode &FALLOC_FL_KEEP_SIZE )) { + error =gfs2_clear_beyond_eof (inode, offset + len); +if (error) +return error; + } + offset &= bsize_mask; len = next - offset;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 262/1250 soundwire: only handle alert events when the peripheral is attached
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
[ Upstream commit 38cd651ebce7065a81c7e950d9e2ea1572304605 ]
It doesn't make sense to handle an alert event when the peripheral is not attached. The slave->status could be SDW_SLAVE_ATTACHED or SDW_SLAVE_ALERT when it is attached on the bus.
--- drivers/soundwire/bus.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/soundwire/bus.c +4 -0
@@ -1989,6 +1989,10 @@ int sdw_handle_slave_status(struct sdw_bus *bus,break ;case SDW_SLAVE_ALERT : +if (slave->status !=SDW_SLAVE_ATTACHED && + slave->status !=SDW_SLAVE_ALERT ) +continue ; + ret =sdw_handle_slave_alerts (slave);if (ret <0 ) dev_err(&slave->dev,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 263/1250 mmc: davinci: fix mmc_add_host order in probe
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Osama Abdelkader <[email protected]>
[ Upstream commit d04e0151d316edbdb4f0397a9b92a1936e4a1421 ]
mmc_add_host() makes the host visible to the MMC core. Register the interrupt handlers and advertise MMC_CAP_SDIO_IRQ before that, so the core cannot start using the host before IRQ handling is set up.
--- drivers/mmc/host/davinci_mmc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/mmc/host/davinci_mmc.c +5 -7
@@ -1294,14 +1294,10 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) goto cpu_freq_fail; } - ret =mmc_add_host (mmc); -if (ret <0 ) - goto mmc_add_host_fail; - ret =devm_request_irq (&pdev->dev, irq, mmc_davinci_irq,0 ,mmc_hostname (mmc), host);if (ret) - goto request_irq_fail; + goto mmc_add_host_fail;if (host->sdio_irq >=0 ) { ret = devm_request_irq(&pdev->dev, host->sdio_irq,
@@ -1311,6 +1307,10 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) mmc->caps |=MMC_CAP_SDIO_IRQ ; } + ret =mmc_add_host (mmc); +if (ret <0 ) + goto mmc_add_host_fail; +rename_region (mem,mmc_hostname (mmc));if (mmc->caps &MMC_CAP_8_BIT_DATA )
@@ -1324,8 +1324,6 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)return 0 ; -request_irq_fail: -mmc_remove_host (mmc); mmc_add_host_fail:mmc_davinci_cpufreq_deregister (host); cpu_freq_fail:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 264/1250 ARM: tegra: tf600t: Invert accelerometer calibration matrix
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Svyatoslav Ryhel <[email protected]>
[ Upstream commit 774bc2764647cfd6b65727cfa978d809f11df392 ]
IMU calibration matrix used in the device tree is inverted when testing on the device which results in wrong screen orientation. Invert it to match the matrix dumped from the device.
--- arch/arm/boot/dts/nvidia/tegra30-asus-tf600t.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/nvidia/tegra30-asus-tf600t.dts +3 -3
@@ -1040,9 +1040,9 @@ imu@69 { vdd-supply = <&vdd_3v3_sys>; vddio-supply = <&vdd_1v8_vio>; - mount-matrix = "0", "-1", "0", - "-1", "0", "0", - "0", "0", "-1"; + mount-matrix = "0", "1", "0", + "1", "0", "0", + "0", "0", "1"; /* External I2C interface */ i2c-gate {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 265/1250 mmc: renesas_sdhi: Add OF entry for RZ/G2N SoC
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 5ce500d31a1625d8fe7ede950201b8df076bdd48 ]
The RZ/G2N (R8A774B1) SoC was previously handled via the generic "renesas,rcar-gen3-sdhi" fallback compatible string. However, because the SDHI IP on RZ/G2N is identical with the R-Car M3-N (R8A77965), it requires the specific quirks and configuration defined in of_r8a77965_compatible rather than the generic Gen3 data.
Add the explicit "renesas,sdhi-r8a774b1" match entry to map it correctly. Note that the DT binding file renesas,sdhi.yaml does not need an update as the entry for this SoC is already present.
--- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/renesas_sdhi_internal_dmac.c +1 -0
@@ -279,6 +279,7 @@ static const struct renesas_sdhi_of_data_with_quirks of_rza2_compatible = {static const struct of_device_id renesas_sdhi_internal_dmac_of_match[] = { { .compatible ="renesas,sdhi-r7s9210" , .data = &of_rza2_compatible, }, { .compatible ="renesas,sdhi-mmc-r8a77470" , .data = &of_rcar_gen3_compatible, }, + { .compatible ="renesas,sdhi-r8a774b1" , .data = &of_r8a77965_compatible, }, { .compatible ="renesas,sdhi-r8a774e1" , .data = &of_r8a7795_compatible, }, { .compatible ="renesas,sdhi-r8a7795" , .data = &of_r8a7795_compatible, }, { .compatible ="renesas,sdhi-r8a77961" , .data = &of_r8a77961_compatible, },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 266/1250 ARM: tegra: p880: Lower CPU thermal limit
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ion Agorria <[email protected]>
[ Upstream commit ece4229e457de4ceeec80890c5c760f0c858eeea ]
Lower the CPU thermal limit for the LG P880, since its chassis has less thermal dissipation capability than the P895.
--- arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts +13 -0
@@ -486,4 +486,17 @@ sound { nvidia,int-mic-en-gpios = <&gpio TEGRA_GPIO(I, 6) GPIO_ACTIVE_HIGH>; }; + + thermal-zones { + cpu-thermal { + trips { + cpu-alert { + /* throttle at 60C until temperature drops to 59.8C */ + temperature = <60000>; + hysteresis = <200>; + type = "passive"; + }; + }; + }; + }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 267/1250 tracing: Disable KCOV instrumentation for trace_irqsoff.o
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 01046072880b654dbadf71be2f645aad4a7b5d87 ]
When KCOV runs its boot selftest with whole-kernel instrumentation enabled, it sets current->kcov_mode to KCOV_MODE_TRACE_PC without installing a coverage area. Any instrumented code accepted as task-context coverage in that window dereferences current->kcov_area and crashes.
On ARMv5 Versatile PB with CONFIG_KCOV_SELFTEST=y, CONFIG_KCOV_INSTRUMENT_ALL=y and CONFIG_IRQSOFF_TRACER=y, boot hits a NULL pointer fault during the selftest:
kcov: running self test
Internal error: Oops: 5 [#1] ARM PC is at __sanitizer_cov_trace_pc+0x4c/0x90 Kernel panic - not syncing: Fatal exception
A diagnostic run showed the unwanted coverage comes from the IRQs-off tracer callbacks reached from ARM IRQ entry before hardirq context is visible to KCOV:
__sanitizer_cov_trace_pc from tracer_hardirqs_off+0x18/0x1cc tracer_hardirqs_off from trace_hardirqs_off+0x34/0x54 trace_hardirqs_off from __irq_svc+0x58/0xb0 __irq_svc from kcov_init+0x7c/0xdc
and similarly through tracer_hardirqs_on().
trace_preemptirq.o is already excluded because this tracing path can run from early interrupt code and produce coverage unrelated to syscall inputs. Exclude trace_irqsoff.o as well, instead of requiring users to turn off CONFIG_KCOV_INSTRUMENT_ALL=y, which is the default whole-kernel KCOV mode.
With the exclusion in place, the same ARMv5 Versatile PB QEMU test boots through the KCOV selftest and reaches userspace.
Tested on ARMv5 Versatile PB QEMU with CONFIG_KCOV_SELFTEST=y, CONFIG_KCOV_INSTRUMENT_ALL=y and CONFIG_IRQSOFF_TRACER=y.
--- kernel/trace/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/trace/Makefile +3 -2
@@ -31,9 +31,10 @@ ifdef CONFIG_GCOV_PROFILE_FTRACE GCOV_PROFILE := y endif -# Functions in this file could be invoked from early interrupt -# code and produce random code coverage. +# Functions in these files can run from IRQ entry before hardirq context +# is visible to KCOV, and produce coverage unrelated to syscall inputs. KCOV_INSTRUMENT_trace_preemptirq.o := n +KCOV_INSTRUMENT_trace_irqsoff.o := n CFLAGS_bpf_trace.o := -I$(src)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 268/1250 mmc: renesas_sdhi: Add OF entry for RZ/G2E SoC
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit ebf7f2198ac4817bd2929cf83c697cefa8bf36a9 ]
The RZ/G2E (R8A774C0) SoC was previously handled via the generic "renesas,rcar-gen3-sdhi" fallback compatible string. However, because the SDHI IP on RZ/G2E is identical with the R-Car E3 (R8A77990), it requires the specific quirks and configuration defined in of_r8a77990_compatible rather than the generic Gen3 data.
Add the explicit "renesas,sdhi-r8a774c0" match entry to map it correctly. Note that the DT binding file renesas,sdhi.yaml does not need an update as the entry for this SoC is already present.
--- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/renesas_sdhi_internal_dmac.c +1 -0
@@ -280,6 +280,7 @@ static const struct of_device_id renesas_sdhi_internal_dmac_of_match[] = { { .compatible = "renesas,sdhi-r7s9210", .data = &of_rza2_compatible, }, { .compatible = "renesas,sdhi-mmc-r8a77470", .data = &of_rcar_gen3_compatible, }, { .compatible = "renesas,sdhi-r8a774b1", .data = &of_r8a77965_compatible, }, + { .compatible = "renesas,sdhi-r8a774c0", .data = &of_r8a77990_compatible, }, { .compatible = "renesas,sdhi-r8a774e1", .data = &of_r8a7795_compatible, }, { .compatible = "renesas,sdhi-r8a7795", .data = &of_r8a7795_compatible, }, { .compatible = "renesas,sdhi-r8a77961", .data = &of_r8a77961_compatible, },
Signature · 1 line
2.53.0