7.2.6-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 185/1815 perf vendor events amd: Update Zen 5 core events
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandipan Das <[email protected]>
[ Upstream commit 047979af3bf6a118066c81099162d518de63abb1 ]
Update definitions for the following events.
* PMCx00A - Add missing unit masks
* PMCx00B - Add missing unit masks and fix descriptions
* PMCx00C - Add missing unit masks
* PMCx00D - Add missing unit masks
* PMCx025 - Add missing unit masks and fix descriptions
--- .../arch/x86/amdzen5/floating-point.json | 130 +++++++++++++++--- .../arch/x86/amdzen5/load-store.json | 8 +- 2 files changed, 120 insertions(+), 18 deletions(-)
tools/perf/pmu-events/arch/x86/amdzen5/floating-point.json +113 -17
@@ -179,6 +179,30 @@ "BriefDescription": "Retired scalar floating-point blend ops.", "UMask": "0x09" }, + { + "EventName": "fp_ops_retired_by_type.scalar_mov", + "EventCode": "0x0a", + "BriefDescription": "Retired scalar floating-point MOV ops.", + "UMask": "0x0a" + }, + { + "EventName": "fp_ops_retired_by_type.scalar_shuffle", + "EventCode": "0x0a", + "BriefDescription": "Retired scalar floating-point shuffle ops (may include instructions not necessarily thought of as including shuffles e.g. horizontal add, dot product, and certain MOV instructions).", + "UMask": "0x0b" + }, + { + "EventName": "fp_ops_retired_by_type.scalar_bfloat", + "EventCode": "0x0a", + "BriefDescription": "Retired scalar floating-point bfloat ops.", + "UMask": "0x0c" + }, + { + "EventName": "fp_ops_retired_by_type.scalar_logical", + "EventCode": "0x0a", + "BriefDescription": "Retired scalar floating-point logical ops.", + "UMask": "0x0d" + }, { "EventName": "fp_ops_retired_by_type.scalar_other", "EventCode": "0x0a",
@@ -245,12 +269,24 @@ "BriefDescription": "Retired vector floating-point blend ops.", "UMask": "0x90" }, + { + "EventName": "fp_ops_retired_by_type.vector_mov", + "EventCode": "0x0a", + "BriefDescription": "Retired vector floating-point MOV ops.", + "UMask": "0xa0" + }, { "EventName": "fp_ops_retired_by_type.vector_shuffle", "EventCode": "0x0a", "BriefDescription": "Retired vector floating-point shuffle ops (may include instructions not necessarily thought of as including shuffles e.g. horizontal add, dot product, and certain MOV instructions).", "UMask": "0xb0" }, + { + "EventName": "fp_ops_retired_by_type.vector_bfloat", + "EventCode": "0x0a", + "BriefDescription": "Retired vector floating-point bfloat ops.", + "UMask": "0xc0" + }, { "EventName": "fp_ops_retired_by_type.vector_logical", "EventCode": "0x0a",
@@ -278,7 +314,7 @@ { "EventName": "sse_avx_ops_retired.mmx_add", "EventCode": "0x0b", - "BriefDescription": "Retired MMX integer add.", + "BriefDescription": "Retired MMX integer add ops.", "UMask": "0x01" }, {
@@ -299,16 +335,34 @@ "BriefDescription": "Retired MMX integer multiply-accumulate ops.", "UMask": "0x04" }, + { + "EventName": "sse_avx_ops_retired.mmx_aes", + "EventCode": "0x0b", + "BriefDescription": "Retired MMX integer AES ops.", + "UMask": "0x05" + }, + { + "EventName": "sse_avx_ops_retired.mmx_sha", + "EventCode": "0x0b", + "BriefDescription": "Retired MMX integer SHA ops.", + "UMask": "0x06" + }, { "EventName": "sse_avx_ops_retired.mmx_cmp", "EventCode": "0x0b", "BriefDescription": "Retired MMX integer compare ops.", "UMask": "0x07" }, + { + "EventName": "sse_avx_ops_retired.mmx_cvt", + "EventCode": "0x0b", + "BriefDescription": "Retired MMX integer convert or pack ops.", + "UMask": "0x08" + }, { "EventName": "sse_avx_ops_retired.mmx_shift", "EventCode": "0x0b", - "BriefDescription": "Retired MMX integer shift ops.", + "BriefDescription": "Retired MMX integer shift or rotate ops.", "UMask": "0x09" }, {
@@ -324,9 +378,9 @@ "UMask": "0x0b" }, { - "EventName": "sse_avx_ops_retired.mmx_pack", + "EventName": "sse_avx_ops_retired.mmx_vnni", "EventCode": "0x0b", - "BriefDescription": "Retired MMX integer pack ops.", + "BriefDescription": "Retired MMX integer VNNI ops.", "UMask": "0x0c" }, {
@@ -390,15 +444,15 @@ "UMask": "0x70" }, { - "EventName": "sse_avx_ops_retired.sse_avx_clm", + "EventName": "sse_avx_ops_retired.sse_avx_cvt", "EventCode": "0x0b", - "BriefDescription": "Retired SSE and AVX integer CLM ops.", + "BriefDescription": "Retired SSE and AVX integer convert or pack ops.", "UMask": "0x80" }, { "EventName": "sse_avx_ops_retired.sse_avx_shift", "EventCode": "0x0b", - "BriefDescription": "Retired SSE and AVX integer shift ops.", + "BriefDescription": "Retired SSE and AVX integer shift or rotate ops.", "UMask": "0x90" }, {
@@ -414,9 +468,9 @@ "UMask": "0xb0" }, { - "EventName": "sse_avx_ops_retired.sse_avx_pack", + "EventName": "sse_avx_ops_retired.sse_avx_vnni", "EventCode": "0x0b", - "BriefDescription": "Retired SSE and AVX integer pack ops.", + "BriefDescription": "Retired SSE and AVX integer VNNI ops.", "UMask": "0xc0" }, {
@@ -497,12 +551,24 @@ "BriefDescription": "Retired 128-bit packed floating-point blend ops.", "UMask": "0x09" }, + { + "EventName": "fp_pack_ops_retired.fp128_mov", + "EventCode": "0x0c", + "BriefDescription": "Retired 128-bit packed floating-point MOV ops.", + "UMask": "0x0a" + }, { "EventName": "fp_pack_ops_retired.fp128_shuffle", "EventCode": "0x0c", "BriefDescription": "Retired 128-bit packed floating-point shuffle ops (may include instructions not necessarily thought of as including shuffles e.g. horizontal add, dot product, and certain MOV instructions).", "UMask": "0x0b" }, + { + "EventName": "fp_pack_ops_retired.fp128_bfloat", + "EventCode": "0x0c", + "BriefDescription": "Retired 128-bit packed floating-point bfloat ops.", + "UMask": "0x0c" + }, { "EventName": "fp_pack_ops_retired.fp128_logical", "EventCode": "0x0c",
@@ -575,12 +641,24 @@ "BriefDescription": "Retired 256-bit packed floating-point blend ops.", "UMask": "0x90" }, + { + "EventName": "fp_pack_ops_retired.fp256_mov", + "EventCode": "0x0c", + "BriefDescription": "Retired 256-bit packed floating-point MOV ops.", + "UMask": "0xa0" + }, { "EventName": "fp_pack_ops_retired.fp256_shuffle", "EventCode": "0x0c", "BriefDescription": "Retired 256-bit packed floating-point shuffle ops (may include instructions not necessarily thought of as including shuffles e.g. horizontal add, dot product, and certain MOV instructions).", "UMask": "0xb0" }, + { + "EventName": "fp_pack_ops_retired.fp256_bfloat", + "EventCode": "0x0c", + "BriefDescription": "Retired 256-bit packed floating-point bfloat ops.", + "UMask": "0xc0" + }, { "EventName": "fp_pack_ops_retired.fp256_logical", "EventCode": "0x0c",
@@ -648,15 +726,15 @@ "UMask": "0x07" }, { - "EventName": "packed_int_op_type.int128_clm", + "EventName": "packed_int_op_type.int128_cvt", "EventCode": "0x0d", - "BriefDescription": "Retired 128-bit packed integer CLM ops.", + "BriefDescription": "Retired 128-bit packed integer convert or pack ops.", "UMask": "0x08" }, { "EventName": "packed_int_op_type.int128_shift", "EventCode": "0x0d", - "BriefDescription": "Retired 128-bit packed integer shift ops.", + "BriefDescription": "Retired 128-bit packed integer shift or rotate ops.", "UMask": "0x09" }, {
@@ -672,9 +750,9 @@ "UMask": "0x0b" }, { - "EventName": "packed_int_op_type.int128_pack", + "EventName": "packed_int_op_type.int128_vnni", "EventCode": "0x0d", - "BriefDescription": "Retired 128-bit packed integer pack ops.", + "BriefDescription": "Retired 128-bit packed integer VNNI ops.", "UMask": "0x0c" }, {
@@ -719,16 +797,34 @@ "BriefDescription": "Retired 256-bit packed integer multiply-accumulate ops.", "UMask": "0x40" }, + { + "EventName": "packed_int_op_type.int256_aes", + "EventCode": "0x0d", + "BriefDescription": "Retired 256-bit packed integer AES ops.", + "UMask": "0x50" + }, + { + "EventName": "packed_int_op_type.int256_sha", + "EventCode": "0x0d", + "BriefDescription": "Retired 256-bit packed integer SHA ops.", + "UMask": "0x60" + }, { "EventName": "packed_int_op_type.int256_cmp", "EventCode": "0x0d", "BriefDescription": "Retired 256-bit packed integer compare ops.", "UMask": "0x70" }, + { + "EventName": "packed_int_op_type.int256_cvt", + "EventCode": "0x0d", + "BriefDescription": "Retired 256-bit packed integer convert or pack ops.", + "UMask": "0x80" + }, { "EventName": "packed_int_op_type.int256_shift", "EventCode": "0x0d", - "BriefDescription": "Retired 256-bit packed integer shift ops.", + "BriefDescription": "Retired 256-bit packed integer shift or rotate ops.", "UMask": "0x90" }, {
@@ -744,9 +840,9 @@ "UMask": "0xb0" }, { - "EventName": "packed_int_op_type.int256_pack", + "EventName": "packed_int_op_type.int256_vnni", "EventCode": "0x0d", - "BriefDescription": "Retired 256-bit packed integer pack ops.", + "BriefDescription": "Retired 256-bit packed integer VNNI ops.", "UMask": "0xc0" }, {
tools/perf/pmu-events/arch/x86/amdzen5/load-store.json +7 -1
@@ -8,9 +8,15 @@ { "EventName": "ls_locks.bus_lock", "EventCode": "0x25", - "BriefDescription": "Retired Lock instructions which caused a bus lock.", + "BriefDescription": "Retired lock instructions which caused a bus lock.", "UMask": "0x01" }, + { + "EventName": "ls_locks.all", + "EventCode": "0x25", + "BriefDescription": "Retired lock instructions of all types.", + "UMask": "0x1f" + }, { "EventName": "ls_ret_cl_flush", "EventCode": "0x26",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 186/1815 perf vendor events amd: Update Zen 6 core events
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandipan Das <[email protected]>
[ Upstream commit 6744430f106b0e46d6318d44a99cb27b0ee937ae ]
Update definitions for the following events.
* PMCx00A - Fix descriptions
* PMCx00C - Add missing unit masks
* PMCx00D - Add missing unit masks and fix descriptions
* PMCx013 - Fix incorrect unit masks
--- .../arch/x86/amdzen6/floating-point.json | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-)
tools/perf/pmu-events/arch/x86/amdzen6/floating-point.json +29 -5
@@ -212,7 +212,7 @@ { "EventName": "fp_ops_ret_by_type.scalar_logical", "EventCode": "0x0a", - "BriefDescription": "Retired scalar floating-point move uops.", + "BriefDescription": "Retired scalar floating-point logical uops.", "UMask": "0x0d" }, {
@@ -665,6 +665,12 @@ "BriefDescription": "Retired 256-bit packed floating-point shuffle uops (may include instructions not necessarily thought of as including shuffles e.g. horizontal add, dot product, and certain MOV instructions).", "UMask": "0xb0" }, + { + "EventName": "fp_pack_ops_ret.fp256_bfloat", + "EventCode": "0x0c", + "BriefDescription": "Retired 256-bit packed floating-point bfloat uops.", + "UMask": "0xc0" + }, { "EventName": "fp_pack_ops_ret.fp256_logical", "EventCode": "0x0c",
@@ -758,7 +764,7 @@ { "EventName": "fp_pack_int_ops_ret.int128_vnni", "EventCode": "0x0d", - "BriefDescription": "Retired 128-bit packed integer VNNI ops.", + "BriefDescription": "Retired 128-bit packed integer VNNI uops.", "UMask": "0x0c" }, {
@@ -803,12 +809,30 @@ "BriefDescription": "Retired 256-bit packed integer multiply-accumulate uops.", "UMask": "0x40" }, + { + "EventName": "fp_pack_int_ops_ret.int256_aes", + "EventCode": "0x0d", + "BriefDescription": "Retired 256-bit packed integer AES uops.", + "UMask": "0x50" + }, + { + "EventName": "fp_pack_int_ops_ret.int256_sha", + "EventCode": "0x0d", + "BriefDescription": "Retired 256-bit packed integer SHA uops.", + "UMask": "0x60" + }, { "EventName": "fp_pack_int_ops_ret.int256_cmp", "EventCode": "0x0d", "BriefDescription": "Retired 256-bit packed integer compare uops.", "UMask": "0x70" }, + { + "EventName": "fp_pack_int_ops_ret.int256_cvt", + "EventCode": "0x0d", + "BriefDescription": "Retired 256-bit packed integer convert or pack uops.", + "UMask": "0x80" + }, { "EventName": "fp_pack_int_ops_ret.int256_shift", "EventCode": "0x0d",
@@ -1083,19 +1107,19 @@ "EventName": "fp_nsq_read_stalls.fp_prf", "EventCode": "0x13", "BriefDescription": "Cycles when reads of the NSQ and writes to the floating-point or SIMD schedulers are stalled due to insufficient free physical register file (FP-PRF) entries.", - "UMask": "0x0e" + "UMask": "0x02" }, { "EventName": "fp_nsq_read_stalls.k_prf", "EventCode": "0x13", "BriefDescription": "Cycles when reads of the NSQ and writes to the floating-point or SIMD schedulers are stalled due to insufficient free mask physical register file (K-PRF) entries.", - "UMask": "0x0e" + "UMask": "0x04" }, { "EventName": "fp_nsq_read_stalls.fp_sq", "EventCode": "0x13", "BriefDescription": "Cycles when reads of the NSQ and writes to the floating-point or SIMD schedulers are stalled due to insufficient free scheduler entries.", - "UMask": "0x0e" + "UMask": "0x08" }, { "EventName": "fp_nsq_read_stalls.all",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 187/1815 hwrng: core - fix rng list on registration error
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manos Pitsidianakis <[email protected]>
[ Upstream commit 3a5834db2b1ce25649f330e78efe1ccde78967fd ]
hwrng_register(rng) does the following:
1. Checks if rng has name and read methods set
2. Checks if the name already exists
3. Adds rng to global rng_list
4. May try to set rng to current_rng
If step 4 fails, it returns an error. However, it does not remove the rng from rng_list, causing a dangling reference which can result in use-after-free if the caller frees rng, since registration failed.
Add a list_del_init() cleanup step.
--- drivers/char/hw_random/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/hw_random/core.c +3 -1
@@ -596,11 +596,13 @@ int hwrng_register(struct hwrng *rng)*/ err =set_current_rng (rng);if (err) - goto out_unlock; + goto out_list_del; } }mutex_unlock (&rng_mutex);return 0 ; +out_list_del: +list_del_init (&rng->list); out_unlock:mutex_unlock (&rng_mutex); out:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 188/1815 crypto: qat - cancel work on re-enable SR-IOV timeout
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit 455b0f3ac9e254edab9f5a873d337abe5e6e3604 ]
The QAT reset worker queues SR-IOV reenable work using a work_struct and completion embedded in an on-stack adf_sriov_dev_data. If the completion wait times out, the reset worker can return while device_sriov_wq still holds or executes the stack-backed work item.
Cancel the work on the device_sriov_wq on timeout before the stack frame unwinds.
--- drivers/crypto/intel/qat/qat_common/adf_aer.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/intel/qat/qat_common/adf_aer.c +2 -0
@@ -189,6 +189,8 @@ static void adf_device_reset_worker(struct work_struct *work)queue_work (device_sriov_wq, &sriov_data.sriov_work);if (wait_for_completion_timeout (&sriov_data.compl, wait_jiffies))adf_pf2vf_notify_restarted (accel_dev); +else +cancel_work_sync (&sriov_data.sriov_work);adf_dev_restarted_notify (accel_dev);clear_bit (ADF_STATUS_RESTARTING , &accel_dev->status);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 189/1815 crypto: qat - clear AES key schedule from stack
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit d41a9fcfb7f9ee36e4a4aaf5e7996bca6be1e7a9 ]
qat_alg_xts_reverse_key() expands the forward XTS AES key on the stack. That schedule contains key material and can remain in the stack frame.
Clear the temporary crypto_aes_ctx with memzero_explicit() after the copy.
--- drivers/crypto/intel/qat/qat_common/qat_algs.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/intel/qat/qat_common/qat_algs.c +1 -0
@@ -405,6 +405,7 @@ static void qat_alg_xts_reverse_key(const u8 *key_forward, unsigned int keylen,memcpy (key_reverse +AES_BLOCK_SIZE , key -AES_BLOCK_SIZE ,AES_BLOCK_SIZE ); } +memzero_explicit (&aes_expanded,sizeof (aes_expanded)); } static void qat_alg_skcipher_init_dec(struct qat_alg_skcipher_ctx *ctx,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 190/1815 crypto: atmel-ecc - reject hardware ECDH without a public key
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
[ Upstream commit f240f9b588f4e2de89822adebf560a96b5d263ed ]
The hardware ECDH path in atmel_ecdh_compute_shared_secret() uses the private key stored in the device. However, the public key is cached only after atmel_ecdh_set_secret() successfully generated that private key for the current tfm.
atmel_ecdh_generate_public_key() already rejects requests when no public key is cached. Add the same check to atmel_ecdh_compute_shared_secret() to prevent the device from using a private key that was not generated for the current tfm.
--- drivers/crypto/atmel-ecc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/atmel-ecc.c +3 -0
@@ -165,6 +165,9 @@ static int atmel_ecdh_compute_shared_secret(struct kpp_request *req)return crypto_kpp_compute_shared_secret (req); } +if (!ctx->public_key) +return -EINVAL ; +/* A P-256 public key must contain two 32-byte coordinates */ if (req->src_len !=ATMEL_ECC_PUBKEY_SIZE )return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 191/1815 crypto: atmel-sha204a - fix heap info leak on I2C transfer failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lothar Rubusch <[email protected]>
[ Upstream commit 72bbf11ba14bd7d5fbf31a1ec42fff608b657f74 ]
The nonblocking RNG path allocates a work_data structure to track the state of an in-flight asynchronous I2C request. This pointer is stored in rng->priv and later consumed by the read path once the transaction completes.
If the underlying I2C transfer fails, the completion callback is invoked with a non-zero status. In this case, the allocated work_data is not usable for producing RNG output and must not remain associated with the hwrng state.
Previously, the failure path only logged a warning but left the pointer state uncleared, which can result in subsequent read attempts observing stale state and interpreting it as valid completion data.
Fix this by freeing the pending work_data. The I2C transaction reports an error. This ensures that failed requests do not leave residual state behind that could be interpreted as valid RNG data on later reads. Clearing rng->priv is done at the subsequent call to nonblocking read.
--- drivers/crypto/atmel-sha204a.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/crypto/atmel-sha204a.c +5 -1
@@ -31,10 +31,14 @@ static void atmel_sha204a_rng_done(struct atmel_i2c_work_data *work_data,struct atmel_i2c_client_priv *i2c_priv = work_data->ctx;struct hwrng *rng = areq; -if (status) +if (status) {dev_warn_ratelimited (&i2c_priv->client->dev,"i2c transaction failed (%d)\n" , status); +kfree (work_data); +atomic_dec (&i2c_priv->tfm_count); +return ; + } rng->priv = (unsigned long )work_data;atomic_dec (&i2c_priv->tfm_count);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 192/1815 crypto: sa2ul - stop probe if context pool creation fails
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit d03f980a25853f6a380895119a572a3bb1194e8d ]
sa_ul_probe() calls sa_init_mem() to create the DMA pool used for security context buffers, but ignores its return value. If pool creation fails, probe still continues with DMA setup, algorithm registration and child population even though later request setup depends on that pool.
Stop probing when sa_init_mem() fails, and route that failure to the PM cleanup path without attempting to destroy an uncreated DMA pool.
--- drivers/crypto/sa2ul.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/crypto/sa2ul.c +5 -1
@@ -2395,7 +2395,10 @@ static int sa_ul_probe(struct platform_device *pdev)return ret; } -sa_init_mem (dev_data); + ret =sa_init_mem (dev_data); +if (ret) + goto disable_pm; + ret =sa_dma_init (dev_data);if (ret) goto destroy_dma_pool;
@@ -2430,6 +2433,7 @@ static int sa_ul_probe(struct platform_device *pdev) destroy_dma_pool:dma_pool_destroy (dev_data->sc_pool); +disable_pm:pm_runtime_put_sync (dev);pm_runtime_disable (dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 193/1815 hwrng: xilinx-trng - propagate timeout before any data is read
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit ba088974419326daf46c5dc03e2cf6ab6ab701f7 ]
xtrng_readblock32() polls for 16-byte chunks but returns the number of bytes read even when the first poll times out. Its caller then treats a zero return as a short successful read, and partial reads for full 32-byte blocks can make the tail copy use a fixed block offset rather than the amount already produced.
Return the poll error when no data has been read, preserve partial positive returns after some data is available, stop the generator on all collection exits, and append tail bytes at the current output count.
--- drivers/char/hw_random/xilinx-trng.c | 32 +++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-)
drivers/char/hw_random/xilinx-trng.c +24 -8
@@ -86,8 +86,8 @@ static void xtrng_softreset(struct xilinx_rng *rng)xtrng_readwrite32 (rng->rng_base +TRNG_CTRL_OFFSET ,TRNG_CTRL_PRNGSRST_MASK ,0 ); } -/* Return no. of bytes read */ -static size_t xtrng_readblock32 (void __iomem *rng_base,__be32 *buf,int blocks32,bool wait) +/* Return no. of bytes read or a negative error before any data is read. */ +static int xtrng_readblock32 (void __iomem *rng_base,__be32 *buf,int blocks32,bool wait) {int read =0 , ret;int timeout =1 ;
@@ -102,8 +102,11 @@ static size_t xtrng_readblock32(void __iomem *rng_base, __be32 *buf, int blocks3 ret =readl_poll_timeout (rng_base +TRNG_STATUS_OFFSET , val, (val &TRNG_STATUS_QCNT_MASK ) ==TRNG_STATUS_QCNT_16_BYTES , !!wait, timeout); -if (ret) +if (ret) { +if (!read) +return ret;break ; + }for (idx =0 ; idx <TRNG_READ_4_WORD ; idx++) { *(buf + read) =cpu_to_be32 (ioread32 (rng_base +TRNG_CORE_OUTPUT_OFFSET ));
@@ -118,27 +121,40 @@ static int xtrng_collect_random_data(struct xilinx_rng *rng, u8 *rand_gen_buf, {u8 randbuf[TRNG_SEC_STRENGTH_BYTES ];int byteleft, blocks, count =0 ; +int full_blocks_bytes;int ret; byteleft = no_of_random_bytes & (TRNG_SEC_STRENGTH_BYTES -1 ); blocks = no_of_random_bytes >>TRNG_SEC_STRENGTH_SHIFT ; + full_blocks_bytes = blocks *TRNG_SEC_STRENGTH_BYTES ;xtrng_readwrite32 (rng->rng_base +TRNG_CTRL_OFFSET ,TRNG_CTRL_PRNGSTART_MASK ,TRNG_CTRL_PRNGSTART_MASK );if (blocks) { ret =xtrng_readblock32 (rng->rng_base, (__be32 *)rand_gen_buf, blocks, wait); -if (!ret) -return 0 ; +if (ret <=0 ) { + count = ret; + goto out_stop; + } count += ret; +if (ret < full_blocks_bytes) + goto out_stop; }if (byteleft) { ret =xtrng_readblock32 (rng->rng_base, (__be32 *)randbuf,1 , wait); +if (ret <0 ) { +if (!count) + count = ret; + goto out_stop; + }if (!ret) -return count; -memcpy (rand_gen_buf + (blocks *TRNG_SEC_STRENGTH_BYTES ), randbuf, byteleft); - count += byteleft; + goto out_stop; + ret =min (ret, no_of_random_bytes - count); +memcpy (rand_gen_buf + count, randbuf, ret); + count += ret; } +out_stop:xtrng_readwrite32 (rng->rng_base +TRNG_CTRL_OFFSET ,TRNG_CTRL_PRNGMODE_MASK |TRNG_CTRL_PRNGSTART_MASK ,0U );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 194/1815 hwrng: omap - Fix probe error path cleanup
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit f8c24e6899e263073fbbeb07fadc1af85ec492f5 ]
omap_rng_probe() enables runtime PM before acquiring and enabling the functional clocks. Several later error paths returned or unwound without undoing all state acquired so far.
If pm_runtime_resume_and_get() failed, the driver returned through the generic ioremap error label and left runtime PM enabled. If either clock lookup returned -EPROBE_DEFER, the function returned directly and skipped the runtime PM cleanup; the register clock defer path could also leave the already enabled functional clock prepared.
Route these failures through the existing unwind labels so each path only undoes resources that were acquired successfully. Keep the resume failure path limited to pm_runtime_disable(), and use the later labels only after the runtime PM usage count or clocks have been acquired.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/char/hw_random/omap-rng.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-)
drivers/char/hw_random/omap-rng.c +20 -10
@@ -455,32 +455,40 @@ static int omap_rng_probe(struct platform_device *pdev) ret =pm_runtime_resume_and_get (&pdev->dev);if (ret <0 ) {dev_err (&pdev->dev,"Failed to runtime_get device: %d\n" , ret); - goto err_ioremap; + goto err_pm_disable; } priv->clk =devm_clk_get (&pdev->dev,NULL ); -if (PTR_ERR (priv->clk) == -EPROBE_DEFER ) -return -EPROBE_DEFER ; +if (PTR_ERR (priv->clk) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto err_pm_put; + }if (!IS_ERR (priv->clk)) { ret =clk_prepare_enable (priv->clk);if (ret) {dev_err (&pdev->dev,"Unable to enable the clk: %d\n" , ret); - goto err_register; + goto err_pm_put; } + }else { + priv->clk =NULL ; } priv->clk_reg =devm_clk_get (&pdev->dev,"reg" ); -if (PTR_ERR (priv->clk_reg) == -EPROBE_DEFER ) -return -EPROBE_DEFER ; +if (PTR_ERR (priv->clk_reg) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto err_clk; + }if (!IS_ERR (priv->clk_reg)) { ret =clk_prepare_enable (priv->clk_reg);if (ret) {dev_err (&pdev->dev,"Unable to enable the register clk: %d\n" , ret); - goto err_register; + goto err_clk; } + }else { + priv->clk_reg =NULL ; } ret = (dev->of_node) ? of_get_omap_rng_device_details(priv, pdev) :
@@ -498,12 +506,14 @@ static int omap_rng_probe(struct platform_device *pdev)return 0 ; err_register: +clk_disable_unprepare (priv->clk_reg); +err_clk: +clk_disable_unprepare (priv->clk); +err_pm_put: priv->base =NULL ;pm_runtime_put_sync (&pdev->dev); +err_pm_disable:pm_runtime_disable (&pdev->dev); - -clk_disable_unprepare (priv->clk_reg); -clk_disable_unprepare (priv->clk); err_ioremap:dev_err (dev,"initialization failed.\n" );return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 195/1815 crypto: rk3288 - fail ahash requests on HASH idle timeout
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit ae150db7826f21e8d19e54fb6243169628809c4d ]
rk_hash_run() waits for RK_CRYPTO_HASH_STS to become idle after the final DMA transfer, but ignores the poll result. If the hash engine never becomes idle, the driver still reads the digest registers and finalizes the request with the previous success value.
Store the poll result and finalize the request with the timeout error before reading the digest registers.
--- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/crypto/rockchip/rk3288_crypto_ahash.c +6 -1
@@ -324,7 +324,12 @@ static int rk_hash_run(struct crypto_engine *engine, void *breq)* efficiency, and make it response quickly when dma * complete. */ -readl_poll_timeout (rkc->reg +RK_CRYPTO_HASH_STS , v, v ==0 ,10 ,1000 ); + err =readl_poll_timeout (rkc->reg +RK_CRYPTO_HASH_STS , v, + v ==0 ,10 ,1000 ); +if (err) { +dev_err (rkc->dev,"HASH idle timeout\n" ); + goto theend; + }for (i =0 ; i <crypto_ahash_digestsize (tfm) /4 ; i++) { v =readl (rkc->reg +RK_CRYPTO_HASH_DOUT_0 + i *4 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 196/1815 crypto: keembay - Fix AEAD unregister count in error path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit e264401ce4776a288524e5b87593d4d864147115 ]
register_aes_algs() registers the AEAD algorithms before registering the skcipher algorithms. If skcipher registration fails, the function unwinds the earlier AEAD registration with crypto_engine_unregister_aeads(), but it passes ARRAY_SIZE(algs), which is the skcipher table size.
Use ARRAY_SIZE(algs_aead) for the AEAD unwind path so the unregister helper iterates over the same table that was registered. Also clarify the nearby
comment: the crypto registration helpers clean up algorithms registered within the same call, while this function must still unwind earlier successful registration steps.
--- drivers/crypto/intel/keembay/keembay-ocs-aes-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/intel/keembay/keembay-ocs-aes-core.c +2 -2
@@ -1541,7 +1541,7 @@ static int register_aes_algs(struct ocs_aes_dev *aes_dev)/* * If any algorithm fails to register, all preceding algorithms that -* were successfully registered will be automatically unregistered. +* were registered in the same call are automatically unregistered. */ ret =crypto_engine_register_aeads (algs_aead,ARRAY_SIZE (algs_aead));if (ret)
@@ -1549,7 +1549,7 @@ static int register_aes_algs(struct ocs_aes_dev *aes_dev) ret =crypto_engine_register_skciphers (algs,ARRAY_SIZE (algs));if (ret) -crypto_engine_unregister_aeads (algs_aead,ARRAY_SIZE (algs)); +crypto_engine_unregister_aeads (algs_aead,ARRAY_SIZE (algs_aead));return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 197/1815 RDMA/irdma: Deduplicate the irdma_del_memlist logic
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Moroni <[email protected]>
[ Upstream commit 097f50384e1877b7cf3ace12ff0d1beed19f2088 ]
Simplify/dedup the irdma_del_memlist logic in preparation for the QP/CQ/SRQ ring MR refcounting change that will follow in a subsequent commit.
Stable-dep-of: f67d8a08f60c ("RDMA/irdma: Add refcounting to user ring MRs")
--- drivers/infiniband/hw/irdma/verbs.c | 31 +++++++++++------------------ 1 file changed, 12 insertions(+), 19 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +12 -19
@@ -3935,35 +3935,28 @@ static void irdma_del_memlist(struct irdma_mr *iwmr, {struct irdma_pbl *iwpbl = &iwmr->iwpbl;unsigned long flags; +spinlock_t *lock;switch (iwmr->type) {case IRDMA_MEMREG_TYPE_CQ : -spin_lock_irqsave (&ucontext->cq_reg_mem_list_lock, flags); -if (iwpbl->on_list) { - iwpbl->on_list = false; -list_del (&iwpbl->list); - } -spin_unlock_irqrestore (&ucontext->cq_reg_mem_list_lock, flags); + lock = &ucontext->cq_reg_mem_list_lock;break ;case IRDMA_MEMREG_TYPE_QP : -spin_lock_irqsave (&ucontext->qp_reg_mem_list_lock, flags); -if (iwpbl->on_list) { - iwpbl->on_list = false; -list_del (&iwpbl->list); - } -spin_unlock_irqrestore (&ucontext->qp_reg_mem_list_lock, flags); + lock = &ucontext->qp_reg_mem_list_lock;break ;case IRDMA_MEMREG_TYPE_SRQ : -spin_lock_irqsave (&ucontext->srq_reg_mem_list_lock, flags); -if (iwpbl->on_list) { - iwpbl->on_list = false; -list_del (&iwpbl->list); - } -spin_unlock_irqrestore (&ucontext->srq_reg_mem_list_lock, flags); + lock = &ucontext->srq_reg_mem_list_lock;break ;default : -break ; +return ; + } + +spin_lock_irqsave (lock, flags); +if (iwpbl->on_list) { + iwpbl->on_list = false; +list_del (&iwpbl->list); } +spin_unlock_irqrestore (lock, flags); }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 198/1815 RDMA/irdma: Add a refcount to track user ring MR associations
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Moroni <[email protected]>
[ Upstream commit a7d0a6b58256a77566e9088a99e1594bf35821ec ]
User QP/CQ/SRQ rings are registered with the normal reg_mr mechanism prior to creating the actual QP/CQ/SRQ object. In order to prevent userspace from deregistering these special MRs while the child object still exists, a refcount will be used.
This commit adds the refcount and logic to reject a dereg_mr with active references. Subsequent commits will add logic to bump this refcount when the user QP/CQ/SRQ objects are created.
Stable-dep-of: f67d8a08f60c ("RDMA/irdma: Add refcounting to user ring MRs")
--- drivers/infiniband/hw/irdma/verbs.c | 21 +++++++++++++++++---- drivers/infiniband/hw/irdma/verbs.h | 1 + 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +17 -4
@@ -3362,6 +3362,7 @@ static struct irdma_mr *irdma_alloc_iwmr(struct ib_umem *region,if (!iwmr)return ERR_PTR (-ENOMEM ); +refcount_set (&iwmr->user_ring_refs,1 ); iwpbl = &iwmr->iwpbl; iwpbl->iwmr = iwmr; iwmr->region = region;
@@ -3929,13 +3930,16 @@ static struct ib_mr *irdma_get_dma_mr(struct ib_pd *pd, int acc)* irdma_del_memlist - Deleting pbl list entries for CQ/QP * @iwmr: iwmr for IB's user page addresses * @ucontext: ptr to user context +* +* Return: True if the MR is currently in-use by a QP/CQ/SRQ ring. */ -static void irdma_del_memlist (struct irdma_mr *iwmr, +static bool irdma_del_memlist (struct irdma_mr *iwmr,struct irdma_ucontext *ucontext) {struct irdma_pbl *iwpbl = &iwmr->iwpbl;unsigned long flags;spinlock_t *lock; +bool in_use = false;switch (iwmr->type) {case IRDMA_MEMREG_TYPE_CQ :
@@ -3948,15 +3952,19 @@ static void irdma_del_memlist(struct irdma_mr *iwmr, lock = &ucontext->srq_reg_mem_list_lock;break ;default : -return ; +return false; }spin_lock_irqsave (lock, flags); -if (iwpbl->on_list) { +if (!refcount_dec_if_one (&iwmr->user_ring_refs)) { + in_use = true; + }else if (iwpbl->on_list) { iwpbl->on_list = false;list_del (&iwpbl->list); }spin_unlock_irqrestore (lock, flags); + +return in_use; }/**
@@ -3979,7 +3987,12 @@ static int irdma_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata) ucontext =rdma_udata_to_drv_context (udata, struct irdma_ucontext, ibucontext); -irdma_del_memlist (iwmr, ucontext); + +/* Do not allow the MR to be unpinned if it is still +* backing a user ring. +*/ +if (irdma_del_memlist (iwmr, ucontext)) +return -EBUSY ; } goto done; }
drivers/infiniband/hw/irdma/verbs.h +1 -0
@@ -120,6 +120,7 @@ struct irdma_mr {u64 len;u64 pgaddrmem[IRDMA_MAX_SAVED_PHY_PGADDR ];struct irdma_pbl iwpbl; +refcount_t user_ring_refs; };struct irdma_srq {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 199/1815 RDMA/irdma: Add irdma_cq fields to track pbl allocations
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Moroni <[email protected]>
[ Upstream commit 971e99623ed7a0d75a719021cf4fd64e5f9e44e5 ]
These fields will be used in a subsequent commit which adds refcounting to user CQ MRs.
Stable-dep-of: f67d8a08f60c ("RDMA/irdma: Add refcounting to user ring MRs")
--- drivers/infiniband/hw/irdma/verbs.c | 25 +++++++++++++++---------- drivers/infiniband/hw/irdma/verbs.h | 2 ++ 2 files changed, 17 insertions(+), 10 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +15 -10
@@ -2128,6 +2128,11 @@ static int irdma_resize_cq(struct ib_cq *ibcq, unsigned int entries, goto error;spin_lock_irqsave (&iwcq->lock, flags); +if (udata) +/* Only update if the resize was successful. Otherwise, HW is +* still pointing to the old PBL. +*/ + iwcq->iwpbl = iwpbl_buf;if (cq_buf) { cq_buf->kmem_buf = iwcq->kmem; cq_buf->hw = dev->hw;
@@ -2498,6 +2503,8 @@ static int irdma_create_cq(struct ib_cq *ibcq,INIT_LIST_HEAD (&iwcq->resize_list);INIT_LIST_HEAD (&iwcq->cmpl_generated); iwcq->cq_num = cq_num; + iwcq->iwpbl =NULL ; + iwcq->iwpbl_shadow =NULL ; info.dev = dev; ukinfo->cq_size =max (entries,4 ); ukinfo->cq_id = cq_num;
@@ -2517,8 +2524,6 @@ static int irdma_create_cq(struct ib_cq *ibcq,struct irdma_ucontext *ucontext;struct irdma_create_cq_req req = {};struct irdma_cq_mr *cqmr; -struct irdma_pbl *iwpbl; -struct irdma_pbl *iwpbl_shadow;struct irdma_cq_mr *cqmr_shadow; iwcq->user_mode = true;
@@ -2532,34 +2537,34 @@ static int irdma_create_cq(struct ib_cq *ibcq, }spin_lock_irqsave (&ucontext->cq_reg_mem_list_lock, flags); - iwpbl =irdma_get_pbl ((unsigned long )req.user_cq_buf, - &ucontext->cq_reg_mem_list); + iwcq->iwpbl =irdma_get_pbl ((unsigned long )req.user_cq_buf, + &ucontext->cq_reg_mem_list);spin_unlock_irqrestore (&ucontext->cq_reg_mem_list_lock, flags); -if (!iwpbl) { +if (!iwcq->iwpbl) { err_code = -EPROTO ; goto cq_free_rsrc; } - cqmr = &iwpbl->cq_mr; + cqmr = &iwcq->iwpbl->cq_mr;if (rf->sc_dev.hw_attrs.uk_attrs.feature_flags &IRDMA_FEATURE_CQ_RESIZE ) {spin_lock_irqsave (&ucontext->cq_reg_mem_list_lock, flags); - iwpbl_shadow =irdma_get_pbl ( + iwcq->iwpbl_shadow =irdma_get_pbl ( (unsigned long )req.user_shadow_area, &ucontext->cq_reg_mem_list);spin_unlock_irqrestore (&ucontext->cq_reg_mem_list_lock, flags); -if (!iwpbl_shadow) { +if (!iwcq->iwpbl_shadow) { err_code = -EPROTO ; goto cq_free_rsrc; } - cqmr_shadow = &iwpbl_shadow->cq_mr; + cqmr_shadow = &iwcq->iwpbl_shadow->cq_mr; info.shadow_area_pa = cqmr_shadow->cq_pbl.addr; }else { info.shadow_area_pa = cqmr->shadow; } -if (iwpbl->pbl_allocated) { +if (iwcq->iwpbl->pbl_allocated) { info.virtual_map = true; info.pbl_chunk_size =1 ; info.first_pm_pbl_idx = cqmr->cq_pbl.idx;
drivers/infiniband/hw/irdma/verbs.h +2 -0
@@ -153,6 +153,8 @@ struct irdma_cq {struct list_head resize_list;struct irdma_cq_poll_info cur_cqe;struct list_head cmpl_generated; +struct irdma_pbl *iwpbl; +struct irdma_pbl *iwpbl_shadow; };struct irdma_cmpl_gen {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 200/1815 RDMA/irdma: Add refcounting to user ring MRs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Moroni <[email protected]>
[ Upstream commit f67d8a08f60c9217df6d40da56422d2049f5e334 ]
Prevent userspace from deregistering the MRs that back QP/CQ/SRQ rings by bumping the MR's refcount upon association.
--- drivers/infiniband/hw/irdma/utils.c | 6 ++++ drivers/infiniband/hw/irdma/verbs.c | 45 +++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-)
drivers/infiniband/hw/irdma/utils.c +6 -0
@@ -1168,6 +1168,12 @@ void irdma_free_qp_rsrc(struct irdma_qp *iwqp) iwqp->kqp.dma_mem.va =NULL ;kfree (iwqp->kqp.sq_wrid_mem);kfree (iwqp->kqp.rq_wrid_mem); + +if (iwqp->user_mode && iwqp->iwpbl) { +struct irdma_mr *iwmr = iwqp->iwpbl->iwmr; + +refcount_dec (&iwmr->user_ring_refs); + } }/**
drivers/infiniband/hw/irdma/verbs.c +43 -2
91 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 201/1815 arm64: dts: qcom: sm8750: wire UFS to ice instance
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuldeep Singh <[email protected]>
[ Upstream commit ac456227d22952b656ad291ebd2d3d3e498e3d95 ]
The Inline Crypto Engine (ICE) exists as a standalone DT node, but the UFS node lacks the required qcom,ice phandle reference.
Add the qcom,ice property to explicitly associate the UFS controller with its ICE instance.
--- arch/arm64/boot/dts/qcom/sm8750.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sm8750.dtsi +1 -0
@@ -5445,6 +5445,7 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, phy-names = "ufsphy"; #reset-cells = <1>; + qcom,ice = <&ice>; status = "disabled";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 202/1815 arm64: dts: qcom: talos: Fix GMU unit address
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 34a4ec6910e68ce06eb7201fa36778ca59a1e510 ]
Correct unit address of GMU node to match 'reg' property and fix dtc W=1 warnings like:
talos.dtsi:2020.20-2055.5: Warning (simple_bus_reg): /soc@0/gmu@506a000: simple-bus unit address format error, expected "506d000"
--- arch/arm64/boot/dts/qcom/talos.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/talos.dtsi +1 -1
@@ -2017,7 +2017,7 @@ opp-435000000 { }; }; - gmu: gmu@506a000 { + gmu: gmu@506d000 { compatible = "qcom,adreno-rgmu-612.0", "qcom,adreno-rgmu"; reg = <0x0 0x0506d000 0x0 0x2c000>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 203/1815 RDMA/bng_re: return a timeout when firmware responses stall
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 5f9576c6734abca88a02db72c466e09d2eddf160 ]
__wait_for_resp() documents that it returns a non-zero error when a firmware command does not complete, and bng_re_rcfw_send_message() already marks the firmware as stalled when the helper returns -ENODEV.
However, the helper ignores wait_event_timeout() expiry. If the response slot remains in use after the timeout and after the polled CREQ service attempt, the loop starts another full timeout period and can repeat forever.
Return -ENODEV after a timed out wait that still has no response. The existing caller then marks FIRMWARE_STALL_DETECTED and returns -ETIMEDOUT to the command issuer.
--- drivers/infiniband/hw/bng_re/bng_fw.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/infiniband/hw/bng_re/bng_fw.c +7 -3
@@ -401,14 +401,15 @@ static int __wait_for_resp(struct bng_re_rcfw *rcfw, u16 cookie) {struct bng_re_cmdq_ctx *cmdq;struct bng_re_crsqe *crsqe; +unsigned long time_left; cmdq = &rcfw->cmdq; crsqe = &rcfw->crsqe_tbl[cookie]; do { - wait_event_timeout(cmdq->waitq, - !crsqe->is_in_used, - secs_to_jiffies(rcfw->max_timeout)); + time_left = wait_event_timeout(cmdq->waitq, + !crsqe->is_in_used, + secs_to_jiffies(rcfw->max_timeout)); if (!crsqe->is_in_used) return 0;
@@ -417,6 +418,9 @@ static int __wait_for_resp(struct bng_re_rcfw *rcfw, u16 cookie)if (!crsqe->is_in_used)return 0 ; + +if (!time_left) +return -ENODEV ; }while (true); };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 204/1815 fuse: move "epoch" from dentry.d_time to fuse_dentry.epoch
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
[ Upstream commit 6648f54f3459c5d069b7ce294170d721ce9bac2f ]
...in hope of removing d_time one day.
--- fs/fuse/dir.c | 23 ++++++++++++++++------- fs/fuse/fuse_i.h | 2 ++ fs/fuse/readdir.c | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-)
fs/fuse/dir.c +16 -7
@@ -96,6 +96,7 @@ static void fuse_advise_use_readdirplus(struct inode *dir)struct fuse_dentry {u64 time; +u64 epoch;union {struct rcu_head rcu;struct rb_node node;
@@ -236,6 +237,13 @@ void fuse_dentry_tree_cleanup(void)WARN_ON_ONCE (!RB_EMPTY_ROOT (&dentry_hash[i].tree)); } +void fuse_dentry_set_epoch (struct dentry *dentry,u64 epoch) +{ +struct fuse_dentry *fd = dentry->d_fsdata; + + fd->epoch = epoch; +} +static inline void __fuse_dentry_settime (struct dentry *dentry,u64 time) { ((struct fuse_dentry *) dentry->d_fsdata)->time = time;
@@ -387,10 +395,11 @@ static int fuse_dentry_revalidate(struct inode *dir, const struct qstr *name,struct fuse_mount *fm;struct fuse_conn *fc;struct fuse_inode *fi; +struct fuse_dentry *fd = entry->d_fsdata;int ret; fc =get_fuse_conn_super (dir->i_sb); -if (entry->d_time <atomic_read (&fc->epoch)) +if (fd->epoch <atomic_read (&fc->epoch)) goto invalid; inode =d_inode_rcu (entry);
@@ -480,10 +489,10 @@ static int fuse_dentry_init(struct dentry *dentry)RB_CLEAR_NODE (&fd->node); dentry->d_fsdata = fd;/* -* Initialising d_time (epoch) to '0' ensures the dentry is invalid +* Initialising epoch to '0' ensures the dentry is invalid * if compared to fc->epoch, which is initialized to '1'. */ - dentry->d_time =0 ; +fuse_dentry_set_epoch (dentry,0 );return 0 ; }
@@ -641,7 +650,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, goto out_err; entry = newent ? newent : entry; - entry->d_time = epoch; +fuse_dentry_set_epoch (entry, epoch);if (outarg_valid)fuse_change_entry_timeout (entry, &outarg);else
@@ -898,7 +907,7 @@ static int fuse_create_open(struct mnt_idmap *idmap, struct inode *dir, }kfree (forget);d_instantiate (entry, inode); - entry->d_time = epoch; +fuse_dentry_set_epoch (entry, epoch);fuse_change_entry_timeout (entry, &outentry);fuse_dir_changed (dir); err =generic_file_open (inode, file);
@@ -1028,10 +1037,10 @@ static struct dentry *create_new_entry(struct mnt_idmap *idmap, struct fuse_mounreturn d;if (d) { - d->d_time = epoch; +fuse_dentry_set_epoch (d, epoch);fuse_change_entry_timeout (d, &outarg); }else { - entry->d_time = epoch; +fuse_dentry_set_epoch (entry, epoch);fuse_change_entry_timeout (entry, &outarg); }fuse_dir_changed (dir);
fs/fuse/fuse_i.h +2 -0
@@ -1054,6 +1054,8 @@ u64 fuse_time_to_jiffies(u64 sec, u32 nsec);void fuse_change_entry_timeout (struct dentry *entry,struct fuse_entry_out *o); +void fuse_dentry_set_epoch (struct dentry *dentry,u64 epoch); +/* * Initialize fuse_conn */
fs/fuse/readdir.c +1 -1
@@ -260,7 +260,7 @@ static int fuse_direntplus_link(struct file *file, }if (fc->readdirplus_auto)set_bit (FUSE_I_INIT_RDPLUS , &get_fuse_inode (inode)->state); - dentry->d_time = epoch; +fuse_dentry_set_epoch (dentry, epoch);fuse_change_entry_timeout (dentry, o);dput (dentry);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 205/1815 nvme-apple: Use acquire/release for queue enabled state
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gui-Dong Han <[email protected]>
[ Upstream commit f61c934aa084b7440fec681be3f4b481eb5a8609 ]
apple_nvme_init_queue() initializes queue state and then marks the queue enabled. The interrupt and request paths check enabled before using that queue state.
The old wmb() after WRITE_ONCE(enabled, true) does not publish the earlier initialization before enabled becomes visible. Use a release store when enabling the queue and acquire loads when testing it.
Although the shutdown-side enabled accesses are not used for publishing queue initialization, use helpers for them as well for consistency.
--- drivers/nvme/host/apple.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-)
drivers/nvme/host/apple.c +23 -7
@@ -151,6 +151,23 @@ struct apple_nvme_queue {bool enabled; }; +static inline bool apple_nvme_queue_enabled (struct apple_nvme_queue *q) +{ +/* Pair with apple_nvme_enable_queue(). */ +return smp_load_acquire (&q->enabled); +} + +static inline void apple_nvme_enable_queue (struct apple_nvme_queue *q) +{ +/* Publish queue initialization before setting q->enabled. */ +smp_store_release (&q->enabled, true); +} + +static inline void apple_nvme_disable_queue (struct apple_nvme_queue *q) +{ +WRITE_ONCE (q->enabled, false); +} +/* * The apple_nvme_iod describes the data in an I/O. *
@@ -677,7 +694,7 @@ static bool apple_nvme_handle_cq(struct apple_nvme_queue *q, bool force)bool found;DEFINE_IO_COMP_BATCH (iob); -if (!READ_ONCE (q->enabled) && !force) +if (!apple_nvme_queue_enabled (q) && !force)return false; found =apple_nvme_poll_cq (q, &iob);
@@ -780,7 +797,7 @@ static blk_status_t apple_nvme_queue_rq(struct blk_mq_hw_ctx *hctx,* We should not need to do this, but we're still using this to * ensure we can drain requests on a dying queue. */ -if (unlikely (!READ_ONCE (q->enabled))) +if (unlikely (!apple_nvme_queue_enabled (q)))return BLK_STS_IOERR ;if (!nvme_check_ready (&anv->ctrl, req, true))
@@ -863,7 +880,7 @@ static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown)nvme_quiesce_io_queues (&anv->ctrl);if (!dead) { -if (READ_ONCE (anv->ioq.enabled)) { +if (apple_nvme_queue_enabled (&anv->ioq)) {apple_nvme_remove_sq (anv);apple_nvme_remove_cq (anv); }
@@ -887,8 +904,8 @@ static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown)nvme_disable_ctrl (&anv->ctrl, false); } -WRITE_ONCE (anv->ioq.enabled, false); -WRITE_ONCE (anv->adminq.enabled, false); +apple_nvme_disable_queue (&anv->ioq); +apple_nvme_disable_queue (&anv->adminq);mb ();/* ensure that nvme_queue_rq() sees that enabled is cleared */ nvme_quiesce_admin_queue (&anv->ctrl);
@@ -1016,8 +1033,7 @@ static void apple_nvme_init_queue(struct apple_nvme_queue *q)memset (q->tcbs,0 , anv->hw->max_queue_depth *sizeof (struct apple_nvmmu_tcb ));memset (q->cqes,0 , depth *sizeof (struct nvme_completion )); -WRITE_ONCE (q->enabled, true); -wmb ();/* ensure the first interrupt sees the initialization */ +apple_nvme_enable_queue (q); }static void apple_nvme_reset_work (struct work_struct *work)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 206/1815 nvmet-rdma: factor out response resource cleanup
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shin'ichiro Kawasaki <[email protected]>
[ Upstream commit 90096175473f7c86e39c3f74f10343f965f5a05d ]
Move the RDMA read/write context teardown and the request SGL freeing out of nvmet_rdma_release_rsp() into a new helper function nvmet_rdma_free_rsp_resources().
This is a refactoring with no functional change, in preparation for the following patch that uses nvmet_rdma_free_rsp_resources().
Stable-dep-of: 0114dd303b37 ("nvmet-rdma: fix response resource leak on queue teardown")
--- drivers/nvme/target/rdma.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/nvme/target/rdma.c +10 -3
@@ -657,18 +657,25 @@ static void nvmet_rdma_rw_ctx_destroy(struct nvmet_rdma_rsp *rsp) req->sg, req->sg_cnt, nvmet_data_dir(req)); } -static void nvmet_rdma_release_rsp (struct nvmet_rdma_rsp *rsp) +static void nvmet_rdma_free_rsp_resources (struct nvmet_rdma_rsp *rsp) {struct nvmet_rdma_queue *queue = rsp->queue; -atomic_add (1 + rsp->n_rdma, &queue->sq_wr_avail); -if (rsp->n_rdma)nvmet_rdma_rw_ctx_destroy (rsp);if (rsp->req.sg < rsp->cmd->inline_sg || rsp->req.sg >= rsp->cmd->inline_sg + queue->dev->inline_page_count)nvmet_req_free_sgls (&rsp->req); +} + +static void nvmet_rdma_release_rsp (struct nvmet_rdma_rsp *rsp) +{ +struct nvmet_rdma_queue *queue = rsp->queue; + +atomic_add (1 + rsp->n_rdma, &queue->sq_wr_avail); + +nvmet_rdma_free_rsp_resources (rsp);if (unlikely (!list_empty_careful (&queue->rsp_wr_wait_list)))nvmet_rdma_process_wr_wait_list (queue);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 207/1815 nvmet-rdma: fix response resource leak on queue teardown
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shin'ichiro Kawasaki <[email protected]>
[ Upstream commit 0114dd303b373522dea06053aabae34bdd33a7c4 ]
When an nvme target with rdma transport is removed while I/Os are in flight, a response can be posted but its send completion is never delivered before the connection is torn down. As a result nvmet_rdma_send_done() and nvmet_rdma_release_rsp() are never called for the response, and this leaks the allocated RDMA read/write context and request SGLs.
These leaks are recreated by running blktests nvme/061 with the rdma transport and the siw driver. Kernel kmemleak feature reports them as follows:
unreferenced object 0xffff88812bc490c0 (size 32):
comm "kworker/2:1H", pid 409, jiffies 4307744490
backtrace (crc 89afd339):
__kmalloc_noprof+0x5f9/0x890
sgl_alloc_order+0x7b/0x380
nvmet_req_alloc_sgls+0x290/0x4f0 [nvmet]
nvmet_rdma_map_sgl_keyed+0x241/0x12e0 [nvmet_rdma]
nvmet_rdma_handle_command+0x73e/0xb80 [nvmet_rdma]
__ib_process_cq+0x149/0x4c0 [ib_core]
ib_cq_poll_work+0x49/0x160 [ib_core]
process_one_work+0x8b2/0x1640
worker_thread+0x5fd/0xfe0
kthread+0x367/0x460
ret_from_fork+0x655/0x9d0
ret_from_fork_asm+0x1a/0x30 unreferenced object 0xffff88814bd05e80 (size 64):
comm "kworker/3:1H", pid 148, jiffies 4295195428
backtrace (crc e35510cb):
__kmalloc_noprof+0x5f9/0x890
rdma_rw_ctx_init+0x333/0x1fa0 [ib_core]
nvmet_rdma_map_sgl_keyed+0x5c8/0x12e0 [nvmet_rdma]
nvmet_rdma_handle_command+0x73e/0xb80 [nvmet_rdma]
__ib_process_cq+0x149/0x4c0 [ib_core]
ib_cq_poll_work+0x49/0x160 [ib_core]
process_one_work+0x8b2/0x1640
worker_thread+0x5fd/0xfe0
kthread+0x367/0x460
ret_from_fork+0x655/0x9d0
ret_from_fork_asm+0x1a/0x30To avoid the memory leaks, reclaim the memory of the in-flight responses when the queue QP is torn down. Call nvmet_rdma_free_rsp_resources() that frees up the RDMA read/write context and the request SGLs of such responses.
--- drivers/nvme/target/rdma.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/nvme/target/rdma.c +18 -0
@@ -1345,9 +1345,27 @@ static int nvmet_rdma_create_queue_ib(struct nvmet_rdma_queue *queue) goto out; } +static bool nvmet_rdma_reclaim_rsp (struct sbitmap *sb,unsigned int bitnr, +void *data) +{ +struct nvmet_rdma_queue *queue = data; + +nvmet_rdma_free_rsp_resources (&queue->rsps[bitnr]); + +return true; +} +static void nvmet_rdma_destroy_queue_ib (struct nvmet_rdma_queue *queue) {ib_drain_qp (queue->qp); + +/* +* Reclaim resources of a response that is still in-flight when the +* queue is being torn down. This happens when the connection was +* forcefully disconnected while an I/O is in flight. +*/ +sbitmap_for_each_set (&queue->rsp_tags, nvmet_rdma_reclaim_rsp, queue); +if (queue->cm_id)rdma_destroy_id (queue->cm_id);ib_destroy_qp (queue->qp);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 208/1815 bus: ti-sysc: Fix /chosen node reference leak
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit 6342de0aed216b6df460b492ddb532b3e0ed16f1 ]
sysc_init_stdout_path() gets the /chosen node with of_find_node_by_path() to read stdout-path. The function then overwrites the local node pointer with the stdout-path lookup result, or exits on error, without dropping the /chosen reference.
Keep the /chosen node in a separate variable and put it after the stdout-path value has been used for the lookup. The successful stdout node lookup remains referenced by the cached stdout_path pointer.
--- drivers/bus/ti-sysc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/bus/ti-sysc.c +8 -4
@@ -682,6 +682,7 @@ static struct device_node *stdout_path;static void sysc_init_stdout_path (struct sysc *ddata) { +struct device_node *chosen;struct device_node *np =NULL ;const char *uart;
@@ -691,15 +692,18 @@ static void sysc_init_stdout_path(struct sysc *ddata)if (stdout_path)return ; - np =of_find_node_by_path ("/chosen" ); -if (!np) + chosen =of_find_node_by_path ("/chosen" ); +if (!chosen) goto err; - uart =of_get_property (np,"stdout-path" ,NULL ); -if (!uart) + uart =of_get_property (chosen,"stdout-path" ,NULL ); +if (!uart) { +of_node_put (chosen); goto err; + } np =of_find_node_by_path (uart); +of_node_put (chosen);if (!np) goto err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 209/1815 PM: sleep: Fix off-by-one in wakelocks number limit check
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haowen Tu <[email protected]>
[ Upstream commit 6058646587dded0ce0ba91bd5a6afbf14fe42055 ]
CONFIG_PM_WAKELOCKS_LIMIT is documented as the maximum number of user-space wakeup sources, but the limit check is performed before the counter is incremented and only rejects new wakeup sources when the current number is greater than the limit. This allows one extra wakeup source to be created.
Reject new wakeup sources once the counter has reached the limit.
--- kernel/power/wakelock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/wakelock.c +1 -1
@@ -63,7 +63,7 @@ static unsigned int number_of_wakelocks;static inline bool wakelocks_limit_exceeded (void ) { -return number_of_wakelocks >CONFIG_PM_WAKELOCKS_LIMIT ; +return number_of_wakelocks >=CONFIG_PM_WAKELOCKS_LIMIT ; }static inline void increment_wakelocks_number (void )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 210/1815 cgroup/cpuset: Make nr_deadline_tasks an atomic_t
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 95220e1f18f6321008f021abc7d6f581f64bcb82 ]
The nr_deadline_tasks variable in the cpuset structure was introduced by commit 6c24849f5515 ("sched/cpuset: Keep track of SCHED_DEADLINE task in cpusets"). It is reported by sashiko [1] that nr_deadline_tasks can currently be modified by inc_dl_tasks_cs() under rq->lock and by cpuset_attach() under cpuset_mutex. So if both updates happen simultaneously, the nr_deadline_tasks variable can be corrupted leading to incorrect operations down the road.
Fix that by changing its type to atomic_t so that nr_deadline_tasks are always atomically updated. This fix patch is a low hanging fruit. It can handle some of the races between a concurrent sched_setscheduler() and cpuset_can_attach()/cpuset_attach() calls, but not all of them like the other issue raised by sashiko [2]. This will be handled hopefully in a future follow up patch.
[1] https://sashiko.dev/#/patchset/20260626181923.133658-1-longman%40redhat.com
[2] https://sashiko.dev/#/patchset/20260630033344.352702-1-longman%40redhat.com
--- kernel/cgroup/cpuset-internal.h | 2 +- kernel/cgroup/cpuset.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
kernel/cgroup/cpuset-internal.h +1 -1
@@ -165,7 +165,7 @@ struct cpuset {* number of SCHED_DEADLINE tasks attached to this cpuset, so that we * know when to rebuild associated root domain bandwidth information. */ -int nr_deadline_tasks; +atomic_t nr_deadline_tasks;int nr_migrate_dl_tasks;/* DL bandwidth that needs destination reservation for this attach. */ u64 sum_migrate_dl_bw;
kernel/cgroup/cpuset.c +5 -5
@@ -222,14 +222,14 @@ void inc_dl_tasks_cs(struct task_struct *p) {struct cpuset *cs =task_cs (p); - cs->nr_deadline_tasks++; +atomic_inc (&cs->nr_deadline_tasks); }void dec_dl_tasks_cs (struct task_struct *p) {struct cpuset *cs =task_cs (p); - cs->nr_deadline_tasks--; +atomic_dec (&cs->nr_deadline_tasks); }static inline bool is_partition_valid (const struct cpuset *cs)
@@ -918,7 +918,7 @@ static void dl_update_tasks_root_domain(struct cpuset *cs)struct css_task_iter it;struct task_struct *task; -if (cs->nr_deadline_tasks ==0 ) +if (atomic_read (&cs->nr_deadline_tasks) ==0 )return ;css_task_iter_start (&cs->css,0 , &it);
@@ -3216,8 +3216,8 @@ static void cpuset_attach(struct cgroup_taskset *tset) cs->old_mems_allowed = cpuset_attach_nodemask_to;if (cs->nr_migrate_dl_tasks) { - cs->nr_deadline_tasks += cs->nr_migrate_dl_tasks; - oldcs->nr_deadline_tasks -= cs->nr_migrate_dl_tasks; +atomic_add (cs->nr_migrate_dl_tasks, &cs->nr_deadline_tasks); +atomic_sub (cs->nr_migrate_dl_tasks, &oldcs->nr_deadline_tasks);reset_migrate_dl_data (cs); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 211/1815 clk: qcom: gdsc: Add custom disable callback for GX GDSC
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jagadeesh Kona <[email protected]>
[ Upstream commit 0661ee1d650facefdf61401c7d00eb96fad40b10 ]
The GX GDSC is a special power domain that should only be disabled by OS during GMU recovery. In all other scenarios, the GMU firmware is responsible for handling its disable sequence, and OS must not interfere.
During the resume_noirq() phase of system resume, the GenPD framework enables all power domains and later disables them in the complete() phase if there are no active votes from OS. This behavior can incorrectly disable the GX GDSC while the GMU firmware is still using it.
To prevent this, implement a custom disable callback for GX GDSC that relies on GenPD’s synced_poweroff flag. The GMU driver sets this flag only during recovery, allowing OS to explicitly disable GX GDSC in hardware in that case. In all other situations, the disable callback will avoid touching GX GDSC hardware.
Stable-dep-of: badf361c00c8 ("clk: qcom: gxclkctl: Use custom disable callback for gx_gdsc")
--- drivers/clk/qcom/gdsc.c | 22 ++++++++++++++++++++++ drivers/clk/qcom/gdsc.h | 1 + 2 files changed, 23 insertions(+)
drivers/clk/qcom/gdsc.c +22 -0
@@ -708,3 +708,25 @@ int gdsc_gx_do_nothing_enable(struct generic_pm_domain *domain)return ret; }EXPORT_SYMBOL_GPL (gdsc_gx_do_nothing_enable); + +/* +* GX GDSC is a special power domain. Normally, its disable sequence +* is managed by the GMU firmware, and high level OS must not attempt +* to disable it. The only exception is during GMU recovery, where the +* GMU driver can set GenPD’s synced_poweroff flag to allow explicitly +* disable GX GDSC in hardware. +*/ +int gdsc_gx_disable (struct generic_pm_domain *domain) +{ +struct gdsc *sc =domain_to_gdsc (domain); + +if (domain->synced_poweroff) +return gdsc_disable (domain); + +/* Remove parent-supply placed in enable */ +if (sc->rsupply) +return regulator_disable (sc->rsupply); + +return 0 ; +} +EXPORT_SYMBOL_GPL (gdsc_gx_disable);
drivers/clk/qcom/gdsc.h +1 -0
@@ -93,6 +93,7 @@ int gdsc_register(struct gdsc_desc *desc, struct reset_controller_dev *, struct regmap *);void gdsc_unregister (struct gdsc_desc *desc);int gdsc_gx_do_nothing_enable (struct generic_pm_domain *domain); +int gdsc_gx_disable (struct generic_pm_domain *domain);#else static inline int gdsc_register(struct gdsc_desc *desc, struct reset_controller_dev *rcdev,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 212/1815 clk: qcom: gxclkctl: Use custom disable callback for gx_gdsc
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit badf361c00c802738c776fb5f4e8b08b4d0bad1c ]
The GX GDSC represents a special GPU power domain that must not be disabled during normal runtime PM flows. As per the GMU architecture, GX GDSC should only be force-disabled during GMU/GPU recovery, where the OS explicitly resets the GX power domain.
However, when managed by the generic GDSC runtime PM path, GX GDSC may be disabled during GMU runtime suspend, resulting in warnings such as:
gx_clkctl_gx_gdsc status stuck at 'on'
and failures in gdsc_toggle_logic() during rpm suspend.
Use the newly added custom disable callback for gx_gdsc to ensure the GDSC is toggled only in recovery scenarios, while preventing unintended disable attempts during normal GMU runtime PM operations.
--- drivers/clk/qcom/gxclkctl-kaanapali.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/gxclkctl-kaanapali.c +1 -0
@@ -25,6 +25,7 @@ static struct gdsc gx_clkctl_gx_gdsc = { .pd = { .name = "gx_clkctl_gx_gdsc", .power_on = gdsc_gx_do_nothing_enable, + .power_off = gdsc_gx_disable, }, .pwrsts = PWRSTS_OFF_ON, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 213/1815 arm64: dts: qcom: monaco: fix wrong connection for the replicator
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jie Gan <[email protected]>
[ Upstream commit bf949e86fb5c3034b70b62c9ee31b3d88d5f7fb5 ]
Fix the wrong connection for the qdss replicator device.
--- arch/arm64/boot/dts/qcom/monaco.dtsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/qcom/monaco.dtsi +8 -8
@@ -3017,14 +3017,6 @@ in-ports { #address-cells = <1>; #size-cells = <0>; - port@0 { - reg = <0>; - - swao_rep_out0: endpoint { - remote-endpoint = <&qdss_rep_in>; - }; - }; - port@1 { reg = <1>;
@@ -3734,6 +3726,14 @@ out-ports { #address-cells = <1>; #size-cells = <0>; + port@0 { + reg = <0>; + + swao_rep_out0: endpoint { + remote-endpoint = <&qdss_rep_in>; + }; + }; + port@1 { reg = <1>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 214/1815 arm64: dts: qcom: sc8280xp-blackrock: switch to uefi rtc offset
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Glathe <[email protected]>
[ Upstream commit f52102fc9ccbbb3c4bc01a29f3194fe07f9602f5 ]
On many Qualcomm platforms the PMIC RTC control and time registers are read-only so that the RTC time can not be updated. Instead an offset needs be stored in some machine-specific non-volatile memory, which a driver can take into account.
On platforms where the offset is stored in a Qualcomm specific UEFI variable the variables are also accessed in a non-standard way, which means that the OS cannot assume that the variable service is available by the time the RTC driver probes.
Use the new 'qcom,uefi-rtc-info' property to indicate that the offset is stored in a UEFI variable so that the OS can determine whether to wait for it to become available.
[1]: https://lore.kernel.org/r/[email protected]
--- .../boot/dts/qcom/sc8280xp-microsoft-blackrock.dts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp-microsoft-blackrock.dts +1 -10
@@ -763,20 +763,11 @@ &pmk8280_pon_resin { }; &pmk8280_rtc { - nvmem-cells = <&rtc_offset>; - nvmem-cell-names = "offset"; + qcom,uefi-rtc-info; status = "okay"; }; -&pmk8280_sdam_6 { - status = "okay"; - - rtc_offset: rtc-offset@bc { - reg = <0xbc 0x4>; - }; -}; - &pmk8280_vadc { channel@144 { reg = <PM8350_ADC7_AMUX_THM1_100K_PU(1)>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 215/1815 arm64: dts: qcom: sm7225-fairphone-fp4: Fix address in fb node name
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
[ Upstream commit f6e65005fe55c3d09287851523de06367cbf0bc2 ]
'reg' is 0xa0000000 so the node name is missing a zero. Add it, so that the reg and address in the node name matches.
No functional impact.
--- arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts +1 -1
@@ -48,7 +48,7 @@ chosen { stdout-path = "serial0:115200n8"; - framebuffer0: framebuffer@a000000 { + framebuffer0: framebuffer@a0000000 { compatible = "simple-framebuffer"; reg = <0 0xa0000000 0 (2340 * 1080 * 4)>; width = <1080>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 216/1815 arm64: dts: qcom: sm6125: Use 64 bit addressing
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Biswapriyo Nath <[email protected]>
[ Upstream commit 88f8e2ca76ee9999c1f21d020362e6588a6d5ef5 ]
SM6125's SMMU uses 36bit VAs, which is a good indicator that we should increase (dma-)ranges - and by extension #address- and
#size-cells to prevent things from getting lost in translation
(both literally and figuratively). Do so.
--- arch/arm64/boot/dts/qcom/sm6125.dtsi | 153 ++++++++++++++------------- 1 file changed, 78 insertions(+), 75 deletions(-)
arch/arm64/boot/dts/qcom/sm6125.dtsi +78 -75
@@ -374,22 +374,23 @@ smem: smem { }; soc@0 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x00 0x00 0x00 0xffffffff>; + #address-cells = <2>; + #size-cells = <2>; + ranges = <0 0 0 0 0x10 0>; + dma-ranges = <0 0 0 0 0x10 0>; compatible = "simple-bus"; tcsr_mutex: hwlock@340000 { compatible = "qcom,tcsr-mutex"; - reg = <0x00340000 0x20000>; + reg = <0x0 0x00340000 0x0 0x20000>; #hwlock-cells = <1>; }; tlmm: pinctrl@500000 { compatible = "qcom,sm6125-tlmm"; - reg = <0x00500000 0x400000>, - <0x00900000 0x400000>, - <0x00d00000 0x400000>; + reg = <0x0 0x00500000 0x0 0x400000>, + <0x0 0x00900000 0x0 0x400000>, + <0x0 0x00d00000 0x0 0x400000>; reg-names = "west", "south", "east"; interrupts = <GIC_SPI 227 IRQ_TYPE_LEVEL_HIGH>; gpio-controller;
@@ -672,7 +673,7 @@ qup_uart4_default: qup-uart4-default-state { gcc: clock-controller@1400000 { compatible = "qcom,gcc-sm6125"; - reg = <0x01400000 0x1f0000>; + reg = <0x0 0x01400000 0x0 0x1f0000>; #clock-cells = <1>; #reset-cells = <1>; #power-domain-cells = <1>;
@@ -682,7 +683,7 @@ gcc: clock-controller@1400000 { hsusb_phy1: phy@1613000 { compatible = "qcom,msm8996-qusb2-phy"; - reg = <0x01613000 0x180>; + reg = <0x0 0x01613000 0x0 0x180>; #phy-cells = <0>; clocks = <&gcc GCC_AHB2PHY_USB_CLK>,
@@ -695,18 +696,18 @@ hsusb_phy1: phy@1613000 { rng: rng@1b53000 { compatible = "qcom,prng-ee"; - reg = <0x01b53000 0x1000>; + reg = <0x0 0x01b53000 0x0 0x1000>; clocks = <&gcc GCC_PRNG_AHB_CLK>; clock-names = "core"; }; spmi_bus: spmi@1c40000 { compatible = "qcom,spmi-pmic-arb"; - reg = <0x01c40000 0x1100>, - <0x01e00000 0x2000000>, - <0x03e00000 0x100000>, - <0x03f00000 0xa0000>, - <0x01c0a000 0x26000>; + reg = <0x0 0x01c40000 0x0 0x1100>, + <0x0 0x01e00000 0x0 0x2000000>, + <0x0 0x03e00000 0x0 0x100000>, + <0x0 0x03f00000 0x0 0xa0000>, + <0x0 0x01c0a000 0x0 0x26000>; reg-names = "core", "chnls", "obsrvr", "intr", "cnfg"; interrupt-names = "periph_irq"; interrupts = <GIC_SPI 183 IRQ_TYPE_LEVEL_HIGH>;
@@ -720,12 +721,13 @@ spmi_bus: spmi@1c40000 { rpm_msg_ram: sram@45f0000 { compatible = "qcom,rpm-msg-ram"; - reg = <0x045f0000 0x7000>; + reg = <0x0 0x045f0000 0x0 0x7000>; }; sdhc_1: mmc@4744000 { compatible = "qcom,sm6125-sdhci", "qcom,sdhci-msm-v5"; - reg = <0x04744000 0x1000>, <0x04745000 0x1000>; + reg = <0x0 0x04744000 0x0 0x1000>, + <0x0 0x04745000 0x0 0x1000>; reg-names = "hc", "cqhci"; interrupts = <GIC_SPI 348 IRQ_TYPE_LEVEL_HIGH>,
@@ -752,7 +754,7 @@ sdhc_1: mmc@4744000 { sdhc_2: mmc@4784000 { compatible = "qcom,sm6125-sdhci", "qcom,sdhci-msm-v5"; - reg = <0x04784000 0x1000>; + reg = <0x0 0x04784000 0x0 0x1000>; reg-names = "hc"; interrupts = <GIC_SPI 350 IRQ_TYPE_LEVEL_HIGH>,
@@ -780,7 +782,8 @@ sdhc_2: mmc@4784000 { ufs_mem_hc: ufshc@4804000 { compatible = "qcom,sm6125-ufshc", "qcom,ufshc", "jedec,ufs-2.0"; - reg = <0x04804000 0x3000>, <0x04810000 0x8000>; + reg = <0x0 0x04804000 0x0 0x3000>, + <0x0 0x04810000 0x0 0x8000>; reg-names = "std", "ice"; interrupts = <GIC_SPI 356 IRQ_TYPE_LEVEL_HIGH>;
@@ -825,7 +828,7 @@ ufs_mem_hc: ufshc@4804000 { ufs_mem_phy: phy@4807000 { compatible = "qcom,sm6125-qmp-ufs-phy"; - reg = <0x04807000 0xdb8>; + reg = <0x0 0x04807000 0x0 0xdb8>; clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>, <&gcc GCC_UFS_PHY_PHY_AUX_CLK>,
@@ -846,7 +849,7 @@ ufs_mem_phy: phy@4807000 { gpi_dma0: dma-controller@4a00000 { compatible = "qcom,sm6125-gpi-dma", "qcom,sdm845-gpi-dma"; - reg = <0x04a00000 0x60000>; + reg = <0x0 0x04a00000 0x0 0x60000>; interrupts = <GIC_SPI 335 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 336 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 337 IRQ_TYPE_LEVEL_HIGH>,
@@ -864,19 +867,19 @@ gpi_dma0: dma-controller@4a00000 { qupv3_id_0: geniqup@4ac0000 { compatible = "qcom,geni-se-qup"; - reg = <0x04ac0000 0x2000>; + reg = <0x0 0x04ac0000 0x0 0x2000>; clocks = <&gcc GCC_QUPV3_WRAP_0_M_AHB_CLK>, <&gcc GCC_QUPV3_WRAP_0_S_AHB_CLK>; clock-names = "m-ahb", "s-ahb"; iommus = <&apps_smmu 0x123 0x0>; - #address-cells = <1>; - #size-cells = <1>; + #address-cells = <2>; + #size-cells = <2>; ranges; status = "disabled"; i2c0: i2c@4a80000 { compatible = "qcom,geni-i2c"; - reg = <0x04a80000 0x4000>; + reg = <0x0 0x04a80000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP0_S0_CLK>; clock-names = "se"; interrupts = <GIC_SPI 327 IRQ_TYPE_LEVEL_HIGH>;
@@ -893,7 +896,7 @@ i2c0: i2c@4a80000 { spi0: spi@4a80000 { compatible = "qcom,geni-spi"; - reg = <0x04a80000 0x4000>; + reg = <0x0 0x04a80000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP0_S0_CLK>; clock-names = "se"; interrupts = <GIC_SPI 327 IRQ_TYPE_LEVEL_HIGH>;
@@ -910,7 +913,7 @@ spi0: spi@4a80000 { i2c1: i2c@4a84000 { compatible = "qcom,geni-i2c"; - reg = <0x04a84000 0x4000>; + reg = <0x0 0x04a84000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP0_S1_CLK>; clock-names = "se"; interrupts = <GIC_SPI 328 IRQ_TYPE_LEVEL_HIGH>;
@@ -927,7 +930,7 @@ i2c1: i2c@4a84000 { i2c2: i2c@4a88000 { compatible = "qcom,geni-i2c"; - reg = <0x04a88000 0x4000>; + reg = <0x0 0x04a88000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP0_S2_CLK>; clock-names = "se"; interrupts = <GIC_SPI 329 IRQ_TYPE_LEVEL_HIGH>;
@@ -944,7 +947,7 @@ i2c2: i2c@4a88000 { spi2: spi@4a88000 { compatible = "qcom,geni-spi"; - reg = <0x04a88000 0x4000>; + reg = <0x0 0x04a88000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP0_S2_CLK>; clock-names = "se"; interrupts = <GIC_SPI 329 IRQ_TYPE_LEVEL_HIGH>;
@@ -961,7 +964,7 @@ spi2: spi@4a88000 { i2c3: i2c@4a8c000 { compatible = "qcom,geni-i2c"; - reg = <0x04a8c000 0x4000>; + reg = <0x0 0x04a8c000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP0_S3_CLK>; clock-names = "se"; interrupts = <GIC_SPI 330 IRQ_TYPE_LEVEL_HIGH>;
@@ -978,7 +981,7 @@ i2c3: i2c@4a8c000 { i2c4: i2c@4a90000 { compatible = "qcom,geni-i2c"; - reg = <0x04a90000 0x4000>; + reg = <0x0 0x04a90000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP0_S4_CLK>; clock-names = "se"; interrupts = <GIC_SPI 331 IRQ_TYPE_LEVEL_HIGH>;
@@ -995,7 +998,7 @@ i2c4: i2c@4a90000 { uart4: serial@4a90000 { compatible = "qcom,geni-debug-uart"; - reg = <0x04a90000 0x4000>; + reg = <0x0 0x04a90000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP0_S4_CLK>; clock-names = "se"; interrupts = <GIC_SPI 331 IRQ_TYPE_LEVEL_HIGH>;
@@ -1007,7 +1010,7 @@ uart4: serial@4a90000 { gpi_dma1: dma-controller@4c00000 { compatible = "qcom,sm6125-gpi-dma", "qcom,sdm845-gpi-dma"; - reg = <0x04c00000 0x60000>; + reg = <0x0 0x04c00000 0x0 0x60000>; interrupts = <GIC_SPI 314 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 315 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 316 IRQ_TYPE_LEVEL_HIGH>,
@@ -1025,19 +1028,19 @@ gpi_dma1: dma-controller@4c00000 { qupv3_id_1: geniqup@4cc0000 { compatible = "qcom,geni-se-qup"; - reg = <0x04cc0000 0x2000>; + reg = <0x0 0x04cc0000 0x0 0x2000>; clocks = <&gcc GCC_QUPV3_WRAP_1_M_AHB_CLK>, <&gcc GCC_QUPV3_WRAP_1_S_AHB_CLK>; clock-names = "m-ahb", "s-ahb"; iommus = <&apps_smmu 0x143 0x0>; - #address-cells = <1>; - #size-cells = <1>; + #address-cells = <2>; + #size-cells = <2>; ranges; status = "disabled"; i2c5: i2c@4c80000 { compatible = "qcom,geni-i2c"; - reg = <0x04c80000 0x4000>; + reg = <0x0 0x04c80000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP1_S0_CLK>; clock-names = "se"; interrupts = <GIC_SPI 308 IRQ_TYPE_LEVEL_HIGH>;
@@ -1054,7 +1057,7 @@ i2c5: i2c@4c80000 { spi5: spi@4c80000 { compatible = "qcom,geni-spi"; - reg = <0x04c80000 0x4000>; + reg = <0x0 0x04c80000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP1_S0_CLK>; clock-names = "se"; interrupts = <GIC_SPI 308 IRQ_TYPE_LEVEL_HIGH>;
@@ -1071,7 +1074,7 @@ spi5: spi@4c80000 { i2c6: i2c@4c84000 { compatible = "qcom,geni-i2c"; - reg = <0x04c84000 0x4000>; + reg = <0x0 0x04c84000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP1_S1_CLK>; clock-names = "se"; interrupts = <GIC_SPI 309 IRQ_TYPE_LEVEL_HIGH>;
@@ -1088,7 +1091,7 @@ i2c6: i2c@4c84000 { spi6: spi@4c84000 { compatible = "qcom,geni-spi"; - reg = <0x04c84000 0x4000>; + reg = <0x0 0x04c84000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP1_S1_CLK>; clock-names = "se"; interrupts = <GIC_SPI 309 IRQ_TYPE_LEVEL_HIGH>;
@@ -1105,7 +1108,7 @@ spi6: spi@4c84000 { i2c7: i2c@4c88000 { compatible = "qcom,geni-i2c"; - reg = <0x04c88000 0x4000>; + reg = <0x0 0x04c88000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP1_S2_CLK>; clock-names = "se"; interrupts = <GIC_SPI 310 IRQ_TYPE_LEVEL_HIGH>;
@@ -1122,7 +1125,7 @@ i2c7: i2c@4c88000 { i2c8: i2c@4c8c000 { compatible = "qcom,geni-i2c"; - reg = <0x04c8c000 0x4000>; + reg = <0x0 0x04c8c000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP1_S3_CLK>; clock-names = "se"; interrupts = <GIC_SPI 311 IRQ_TYPE_LEVEL_HIGH>;
@@ -1139,7 +1142,7 @@ i2c8: i2c@4c8c000 { spi8: spi@4c8c000 { compatible = "qcom,geni-spi"; - reg = <0x04c8c000 0x4000>; + reg = <0x0 0x04c8c000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP1_S3_CLK>; clock-names = "se"; interrupts = <GIC_SPI 311 IRQ_TYPE_LEVEL_HIGH>;
@@ -1156,7 +1159,7 @@ spi8: spi@4c8c000 { i2c9: i2c@4c90000 { compatible = "qcom,geni-i2c"; - reg = <0x04c90000 0x4000>; + reg = <0x0 0x04c90000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP1_S4_CLK>; clock-names = "se"; interrupts = <GIC_SPI 312 IRQ_TYPE_LEVEL_HIGH>;
@@ -1173,7 +1176,7 @@ i2c9: i2c@4c90000 { spi9: spi@4c90000 { compatible = "qcom,geni-spi"; - reg = <0x04c90000 0x4000>; + reg = <0x0 0x04c90000 0x0 0x4000>; clocks = <&gcc GCC_QUPV3_WRAP1_S4_CLK>; clock-names = "se"; interrupts = <GIC_SPI 312 IRQ_TYPE_LEVEL_HIGH>;
@@ -1191,9 +1194,9 @@ spi9: spi@4c90000 { usb3: usb@4ef8800 { compatible = "qcom,sm6125-dwc3", "qcom,dwc3"; - reg = <0x04ef8800 0x400>; - #address-cells = <1>; - #size-cells = <1>; + reg = <0x0 0x04ef8800 0x0 0x400>; + #address-cells = <2>; + #size-cells = <2>; ranges; clocks = <&gcc GCC_CFG_NOC_USB3_PRIM_AXI_CLK>,
@@ -1228,7 +1231,7 @@ usb3: usb@4ef8800 { usb3_dwc3: usb@4e00000 { compatible = "snps,dwc3"; - reg = <0x04e00000 0xcd00>; + reg = <0x0 0x04e00000 0x0 0xcd00>; interrupts = <GIC_SPI 255 IRQ_TYPE_LEVEL_HIGH>; iommus = <&apps_smmu 0x100 0x0>; phys = <&hsusb_phy1>;
@@ -1244,12 +1247,12 @@ usb3_dwc3: usb@4e00000 { sram@4690000 { compatible = "qcom,rpm-stats"; - reg = <0x04690000 0x10000>; + reg = <0x0 0x04690000 0x0 0x10000>; }; mdss: display-subsystem@5e00000 { compatible = "qcom,sm6125-mdss"; - reg = <0x05e00000 0x1000>; + reg = <0x0 0x05e00000 0x0 0x1000>; reg-names = "mdss"; interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
@@ -1269,16 +1272,16 @@ mdss: display-subsystem@5e00000 { iommus = <&apps_smmu 0x400 0x0>; - #address-cells = <1>; - #size-cells = <1>; + #address-cells = <2>; + #size-cells = <2>; ranges; status = "disabled"; mdss_mdp: display-controller@5e01000 { compatible = "qcom,sm6125-dpu"; - reg = <0x05e01000 0x83208>, - <0x05eb0000 0x3000>; + reg = <0x0 0x05e01000 0x0 0x83208>, + <0x0 0x05eb0000 0x0 0x3000>; reg-names = "mdp", "vbif"; interrupt-parent = <&mdss>;
@@ -1348,7 +1351,7 @@ opp-400000000 { mdss_dsi0: dsi@5e94000 { compatible = "qcom,sm6125-dsi-ctrl", "qcom,mdss-dsi-ctrl"; - reg = <0x05e94000 0x400>; + reg = <0x0 0x05e94000 0x0 0x400>; reg-names = "dsi_ctrl"; interrupt-parent = <&mdss>;
@@ -1417,9 +1420,9 @@ opp-187500000 { mdss_dsi0_phy: phy@5e94400 { compatible = "qcom,sm6125-dsi-phy-14nm"; - reg = <0x05e94400 0x100>, - <0x05e94500 0x300>, - <0x05e94800 0x188>; + reg = <0x0 0x05e94400 0x0 0x100>, + <0x0 0x05e94500 0x0 0x300>, + <0x0 0x05e94800 0x0 0x188>; reg-names = "dsi_phy", "dsi_phy_lane", "dsi_pll";
@@ -1441,7 +1444,7 @@ mdss_dsi0_phy: phy@5e94400 { dispcc: clock-controller@5f00000 { compatible = "qcom,sm6125-dispcc"; - reg = <0x05f00000 0x20000>; + reg = <0x0 0x05f00000 0x0 0x20000>; clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>, <&mdss_dsi0_phy DSI_BYTE_PLL_CLK>,
@@ -1470,7 +1473,7 @@ dispcc: clock-controller@5f00000 { apps_smmu: iommu@c600000 { compatible = "qcom,sm6125-smmu-500", "qcom,smmu-500", "arm,mmu-500"; - reg = <0x0c600000 0x80000>; + reg = <0x0 0x0c600000 0x0 0x80000>; interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
@@ -1544,74 +1547,74 @@ apps_smmu: iommu@c600000 { apcs_glb: mailbox@f111000 { compatible = "qcom,sm6125-apcs-hmss-global", "qcom,msm8994-apcs-kpss-global"; - reg = <0x0f111000 0x1000>; + reg = <0x0 0x0f111000 0x0 0x1000>; #mbox-cells = <1>; }; timer@f120000 { compatible = "arm,armv7-timer-mem"; - #address-cells = <1>; + #address-cells = <2>; #size-cells = <1>; - ranges; - reg = <0x0f120000 0x1000>; + reg = <0x0 0x0f120000 0x0 0x1000>; + ranges = <0x0 0x0 0x0 0x0 0x20000000>; clock-frequency = <19200000>; frame@f121000 { frame-number = <0>; interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; - reg = <0x0f121000 0x1000>, - <0x0f122000 0x1000>; + reg = <0x0 0x0f121000 0x1000>, + <0x0 0x0f122000 0x1000>; }; frame@f123000 { frame-number = <1>; interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>; - reg = <0x0f123000 0x1000>; + reg = <0x0 0x0f123000 0x1000>; status = "disabled"; }; frame@f124000 { frame-number = <2>; interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; - reg = <0x0f124000 0x1000>; + reg = <0x0 0x0f124000 0x1000>; status = "disabled"; }; frame@f125000 { frame-number = <3>; interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>; - reg = <0x0f125000 0x1000>; + reg = <0x0 0x0f125000 0x1000>; status = "disabled"; }; frame@f126000 { frame-number = <4>; interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; - reg = <0x0f126000 0x1000>; + reg = <0x0 0x0f126000 0x1000>; status = "disabled"; }; frame@f127000 { frame-number = <5>; interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>; - reg = <0x0f127000 0x1000>; + reg = <0x0 0x0f127000 0x1000>; status = "disabled"; }; frame@f128000 { frame-number = <6>; interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; - reg = <0x0f128000 0x1000>; + reg = <0x0 0x0f128000 0x1000>; status = "disabled"; }; }; intc: interrupt-controller@f200000 { compatible = "arm,gic-v3"; - reg = <0x0f200000 0x20000>, - <0x0f300000 0x100000>; + reg = <0x0 0x0f200000 0x0 0x20000>, + <0x0 0x0f300000 0x0 0x100000>; #interrupt-cells = <3>; interrupt-controller; interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 217/1815 arm64: dts: qcom: hamoa: Fix clocks for HSPHYs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 115894bc201b0cd1799d239875a1b40924f0ef7b ]
The tertiary controller's HSPHY has its own toggle in TCSR, while the primary one is wired directly to the XO clock. Fix that.
--- arch/arm64/boot/dts/qcom/hamoa.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/hamoa.dtsi +2 -2
@@ -2868,7 +2868,7 @@ usb_1_ss0_hsphy: phy@fd3000 { reg = <0 0x00fd3000 0 0x154>; #phy-cells = <0>; - clocks = <&tcsr TCSR_USB2_1_CLKREF_EN>; + clocks = <&rpmhcc RPMH_CXO_CLK>; clock-names = "ref"; resets = <&gcc GCC_QUSB2PHY_PRIM_BCR>;
@@ -3010,7 +3010,7 @@ usb_1_ss2_hsphy: phy@fde000 { reg = <0 0x00fde000 0 0x154>; #phy-cells = <0>; - clocks = <&tcsr TCSR_USB2_1_CLKREF_EN>; + clocks = <&tcsr TCSR_USB2_2_CLKREF_EN>; clock-names = "ref"; resets = <&gcc GCC_QUSB2PHY_TERT_BCR>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 218/1815 arm64: dts: qcom: glymur: Fix unit-address mismatch for spmi_bus2
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gopikrishna Garmidi <[email protected]>
[ Upstream commit 82a766b68cd4d323b302a28082fbb7924f1146e6 ]
The spmi_bus2 node was named spmi@c48000, but its reg property specifies the base address as 0x0c448000. Fix the node name to spmi@c448000 to match the actual register base address.
--- arch/arm64/boot/dts/qcom/glymur.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/glymur.dtsi +1 -1
@@ -5029,7 +5029,7 @@ spmi_bus1: spmi@c437000 { #size-cells = <0>; }; - spmi_bus2: spmi@c48000 { + spmi_bus2: spmi@c448000 { reg = <0x0 0x0c448000 0x0 0x4000>, <0x0 0x0c8e0000 0x0 0x10000>, <0x0 0x0c44c000 0x0 0x8000>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 219/1815 arm64: dts: qcom: glymur: Fix gcc clock specifier for usb_mp_qmpphy nodes
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gopikrishna Garmidi <[email protected]>
[ Upstream commit eca50d95b60cdcabb82a8e1b727fad2547e52f1d ]
usb_mp_qmpphy0 and usb_mp_qmpphy1 have #clock-cells set to 0 so they take no specifier. Drop the erroneous QMP_USB43DP_USB3_PIPE_CLK argument.
This fixes the following dtbs_check warning:
clock-controller@100000 (qcom,glymur-gcc): clocks: [[59, 0], ..... [0]] is too long
from schema $id: http://devicetree.org/schemas/clock/qcom,glymur-gcc.yaml
--- arch/arm64/boot/dts/qcom/glymur.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/glymur.dtsi +2 -2
@@ -786,8 +786,8 @@ gcc: clock-controller@100000 { <&usb_0_qmpphy QMP_USB43DP_USB3_PIPE_CLK>, <&usb_1_qmpphy QMP_USB43DP_USB3_PIPE_CLK>, <&usb_2_qmpphy QMP_USB43DP_USB3_PIPE_CLK>, - <&usb_mp_qmpphy0 QMP_USB43DP_USB3_PIPE_CLK>, - <&usb_mp_qmpphy1 QMP_USB43DP_USB3_PIPE_CLK>, + <&usb_mp_qmpphy0>, /* USB3 UNI PHY pipe 0 */ + <&usb_mp_qmpphy1>, /* USB3 UNI PHY pipe 1 */ <0>, /* USB4 PHY 0 pcie pipe */ <0>, /* USB4 PHY 0 Max pipe */ <0>, /* USB4 PHY 1 pcie pipe */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 220/1815 arm64: dts: qcom: glymur-crd: Add Embedded controller node
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sibi Sankar <[email protected]>
[ Upstream commit 44c655a08c9ee9590e64f8306a66917bbb629970 ]
Add embedded controller node for Glymur CRDs which adds fan control, temperature sensors, access to EC state changes through SCI events and suspend entry/exit notifications to the EC.
Stable-dep-of: f64ef325f1d9 ("arm64: dts: glymur-crd: Add reset GPIO to touchscreen node")
--- arch/arm64/boot/dts/qcom/glymur-crd.dtsi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
arch/arm64/boot/dts/qcom/glymur-crd.dtsi +23 -0
@@ -22,6 +22,7 @@ aliases { i2c0 = &i2c0; i2c1 = &i2c4; i2c2 = &i2c5; + i2c3 = &i2c9; spi0 = &spi18; };
@@ -444,6 +445,22 @@ vreg_l4h_e0_1p2: ldo4 { }; }; +&i2c9 { + clock-frequency = <400000>; + + status = "okay"; + + embedded-controller@76 { + compatible = "qcom,glymur-crd-ec", "qcom,hamoa-crd-ec"; + reg = <0x76>; + + interrupts-extended = <&tlmm 66 IRQ_TYPE_EDGE_FALLING>; + + pinctrl-0 = <&ec_int_n_default>; + pinctrl-names = "default"; + }; +}; + &pcie3b { vddpe-3v3-supply = <&vreg_nvmesec>;
@@ -596,6 +613,12 @@ hall_int_n_default: hall-int-n-state { bias-disable; }; + ec_int_n_default: ec-int-n-state { + pins = "gpio66"; + function = "gpio"; + bias-disable; + }; + pcie4_default: pcie4-default-state { clkreq-n-pins { pins = "gpio147";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 221/1815 arm64: dts: qcom: glymur-crd: Move common board nodes to shared DTSI
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gopikrishna Garmidi <[email protected]>
[ Upstream commit 711e6f11640f800f649d416b260c7f8555b0c955 ]
Mahua CRD is pin-to-pin compatible with Glymur CRD, as verified against schematics; only the external peripherals connected differ. Move the common board nodes from glymur-crd.dts to glymur-crd.dtsi to enable reuse by Mahua CRD.
Stable-dep-of: f64ef325f1d9 ("arm64: dts: glymur-crd: Add reset GPIO to touchscreen node")
--- arch/arm64/boot/dts/qcom/glymur-crd.dts | 399 ----------------------- arch/arm64/boot/dts/qcom/glymur-crd.dtsi | 396 ++++++++++++++++++++++ 2 files changed, 396 insertions(+), 399 deletions(-)
arch/arm64/boot/dts/qcom/glymur-crd.dts +0 -399
@@ -8,198 +8,9 @@ #include "glymur.dtsi" #include "glymur-crd.dtsi" -#include <dt-bindings/pinctrl/qcom,pmic-gpio.h> - / { model = "Qualcomm Technologies, Inc. Glymur CRD"; compatible = "qcom,glymur-crd", "qcom,glymur"; - - pmic-glink { - compatible = "qcom,glymur-pmic-glink", - "qcom,pmic-glink"; - #address-cells = <1>; - #size-cells = <0>; - - connector@0 { - compatible = "usb-c-connector"; - reg = <0>; - power-role = "dual"; - data-role = "dual"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - - pmic_glink_hs_in: endpoint { - remote-endpoint = <&usb_0_dwc3_hs>; - }; - }; - - port@1 { - reg = <1>; - - pmic_glink_ss_in: endpoint { - remote-endpoint = <&usb_0_qmpphy_out>; - }; - }; - }; - }; - - connector@1 { - compatible = "usb-c-connector"; - reg = <1>; - power-role = "dual"; - data-role = "dual"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - - pmic_glink_hs_in1: endpoint { - remote-endpoint = <&usb_1_dwc3_hs>; - }; - }; - - port@1 { - reg = <1>; - - pmic_glink_ss_in1: endpoint { - remote-endpoint = <&usb_1_qmpphy_out>; - }; - }; - }; - }; - }; - - vreg_edp_3p3: regulator-edp-3p3 { - compatible = "regulator-fixed"; - - regulator-name = "VREG_EDP_3P3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - - gpio = <&tlmm 70 GPIO_ACTIVE_HIGH>; - enable-active-high; - - pinctrl-0 = <&edp_reg_en>; - pinctrl-names = "default"; - - regulator-boot-on; - }; - - vreg_misc_3p3: regulator-misc-3p3 { - compatible = "regulator-fixed"; - - regulator-name = "VREG_MISC_3P3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - - gpio = <&pmh0110_f_e0_gpios 6 GPIO_ACTIVE_HIGH>; - enable-active-high; - - pinctrl-0 = <&misc_3p3_reg_en>; - pinctrl-names = "default"; - - regulator-boot-on; - }; -}; - -&i2c0 { - clock-frequency = <400000>; - - status = "okay"; - - touchpad@2c { - compatible = "hid-over-i2c"; - reg = <0x2c>; - - hid-descr-addr = <0x20>; - interrupts-extended = <&tlmm 3 IRQ_TYPE_LEVEL_LOW>; - - vdd-supply = <&vreg_misc_3p3>; - vddl-supply = <&vreg_l15b_e0_1p8>; - - pinctrl-0 = <&tpad_default>; - pinctrl-names = "default"; - - wakeup-source; - }; - - keyboard@3a { - compatible = "hid-over-i2c"; - reg = <0x3a>; - - hid-descr-addr = <0x1>; - interrupts-extended = <&tlmm 67 IRQ_TYPE_LEVEL_LOW>; - - vdd-supply = <&vreg_misc_3p3>; - vddl-supply = <&vreg_l15b_e0_1p8>; - - pinctrl-0 = <&kybd_default>; - pinctrl-names = "default"; - - wakeup-source; - }; -}; - -&i2c8 { - clock-frequency = <400000>; - - status = "okay"; - - touchscreen@38 { - compatible = "hid-over-i2c"; - reg = <0x38>; - - hid-descr-addr = <0x1>; - interrupts-extended = <&tlmm 51 IRQ_TYPE_LEVEL_LOW>; - - vdd-supply = <&vreg_misc_3p3>; - vddl-supply = <&vreg_l15b_e0_1p8>; - - pinctrl-0 = <&ts0_default>; - pinctrl-names = "default"; - }; -}; - -&i2c5 { - clock-frequency = <400000>; - - status = "okay"; - - ptn3222_0: redriver@43 { - compatible = "nxp,ptn3222"; - reg = <0x43>; - - reset-gpios = <&tlmm 8 GPIO_ACTIVE_LOW>; - - vdd3v3-supply = <&vreg_l8b_e0_1p50>; - vdd1v8-supply = <&vreg_l15b_e0_1p8>; - - #phy-cells = <0>; - }; - - ptn3222_1: redriver@47 { - compatible = "nxp,ptn3222"; - reg = <0x47>; - - reset-gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; - - vdd3v3-supply = <&vreg_l8b_e0_1p50>; - vdd1v8-supply = <&vreg_l15b_e0_1p8>; - - #phy-cells = <0>; - }; -}; - -&mdss { - status = "okay"; }; &mdss_dp0 {
@@ -217,213 +28,3 @@ &mdss_dp1 { &mdss_dp1_out { link-frequencies = /bits/ 64 <1620000000 2700000000 5400000000 8100000000>; }; - -&mdss_dp3 { - /delete-property/ #sound-dai-cells; - - status = "okay"; - - aux-bus { - panel { - compatible = "samsung,atna60cl08", "samsung,atna33xc20"; - enable-gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>; - power-supply = <&vreg_edp_3p3>; - - pinctrl-0 = <&edp_bl_en>; - pinctrl-names = "default"; - - port { - edp_panel_in: endpoint { - remote-endpoint = <&mdss_dp3_out>; - }; - }; - }; - }; -}; - -&mdss_dp3_out { - data-lanes = <0 1 2 3>; - link-frequencies = /bits/ 64 <1620000000 2700000000 5400000000 8100000000>; - - remote-endpoint = <&edp_panel_in>; -}; - -&mdss_dp3_phy { - vdda-phy-supply = <&vreg_l2f_e1_0p83>; - vdda-pll-supply = <&vreg_l4f_e1_1p08>; - - status = "okay"; -}; - -&pmh0110_f_e0_gpios { - misc_3p3_reg_en: misc-3p3-reg-en-state { - pins = "gpio6"; - function = "normal"; - bias-disable; - input-disable; - output-enable; - drive-push-pull; - power-source = <1>; /* 1.8 V */ - qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>; - }; -}; - -&smb2370_j_e2_eusb2_repeater { - vdd18-supply = <&vreg_l15b_e0_1p8>; - vdd3-supply = <&vreg_l7b_e0_2p79>; -}; - -&smb2370_k_e2_eusb2_repeater { - vdd18-supply = <&vreg_l15b_e0_1p8>; - vdd3-supply = <&vreg_l7b_e0_2p79>; -}; - -&tlmm { - edp_bl_en: edp-bl-en-state { - pins = "gpio18"; - function = "gpio"; - drive-strength = <16>; - bias-disable; - }; - - edp_reg_en: edp-reg-en-state { - pins = "gpio70"; - function = "gpio"; - drive-strength = <16>; - bias-disable; - }; - - kybd_default: kybd-default-state { - pins = "gpio67"; - function = "gpio"; - bias-disable; - }; - - tpad_default: tpad-default-state { - pins = "gpio3"; - function = "gpio"; - bias-disable; - }; - - ts0_default: ts0-default-state { - int-n-pins { - pins = "gpio51"; - function = "gpio"; - bias-disable; - }; - - reset-n-pins { - pins = "gpio48"; - function = "gpio"; - drive-strength = <16>; - bias-disable; - }; - }; -}; - -&usb_0 { - status = "okay"; -}; - -&usb_0_dwc3_hs { - remote-endpoint = <&pmic_glink_hs_in>; -}; - -&usb_0_hsphy { - vdd-supply = <&vreg_l3f_e0_0p72>; - vdda12-supply = <&vreg_l4h_e0_1p2>; - - phys = <&smb2370_j_e2_eusb2_repeater>; - - status = "okay"; -}; - -&usb_0_qmpphy { - vdda-phy-supply = <&vreg_l4h_e0_1p2>; - vdda-pll-supply = <&vreg_l3f_e0_0p72>; - refgen-supply = <&vreg_l2f_e0_0p82>; - - status = "okay"; -}; - -&usb_0_qmpphy_out { - remote-endpoint = <&pmic_glink_ss_in>; -}; - -&usb_1 { - status = "okay"; -}; - -&usb_1_dwc3_hs { - remote-endpoint = <&pmic_glink_hs_in1>; -}; - -&usb_1_hsphy { - vdd-supply = <&vreg_l3f_e0_0p72>; - vdda12-supply = <&vreg_l4h_e0_1p2>; - - phys = <&smb2370_k_e2_eusb2_repeater>; - - status = "okay"; -}; - -&usb_1_qmpphy { - vdda-phy-supply = <&vreg_l4h_e0_1p2>; - vdda-pll-supply = <&vreg_l1h_e0_0p89>; - refgen-supply = <&vreg_l2f_e0_0p82>; - - status = "okay"; -}; - -&usb_1_qmpphy_out { - remote-endpoint = <&pmic_glink_ss_in1>; -}; - -&usb_hs { - status = "okay"; -}; - -&usb_hs_phy { - vdd-supply = <&vreg_l2h_e0_0p72>; - vdda12-supply = <&vreg_l4h_e0_1p2>; - - phys = <&ptn3222_1>; - - status = "okay"; -}; - -&usb_mp { - status = "okay"; -}; - -&usb_mp_hsphy0 { - vdd-supply = <&vreg_l2h_e0_0p72>; - vdda12-supply = <&vreg_l4h_e0_1p2>; - - phys = <&ptn3222_0>; - - status = "okay"; -}; - -&usb_mp_hsphy1 { - vdd-supply = <&vreg_l2h_e0_0p72>; - vdda12-supply = <&vreg_l4h_e0_1p2>; - - status = "okay"; -}; - -&usb_mp_qmpphy0 { - vdda-phy-supply = <&vreg_l4h_e0_1p2>; - vdda-pll-supply = <&vreg_l2h_e0_0p72>; - refgen-supply = <&vreg_l4f_e1_1p08>; - - status = "okay"; -}; - -&usb_mp_qmpphy1 { - vdda-phy-supply = <&vreg_l4h_e0_1p2>; - vdda-pll-supply = <&vreg_l2h_e0_0p72>; - refgen-supply = <&vreg_l4f_e1_1p08>; - - status = "okay"; -};
arch/arm64/boot/dts/qcom/glymur-crd.dtsi +396 -0
446 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 222/1815 arm64: dts: glymur-crd: Add reset GPIO to touchscreen node
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pradyot Kumar Nayak <[email protected]>
[ Upstream commit f64ef325f1d9ca9d005b7124c2bf065bb0b99c3d ]
The touchscreen module on Glymur/Mahua CRDs is different from the one used on Hamoa CRDs and requires the reset-gpios to be wired to the device. Without this in place the reset line will remain permanently asserted during resume leaving the device offline and causing all I2C transactions to fail with -ENXIO.
Error Logs:i2c_hid_of 3-0038: failed to change power setting.i2c_hid_of 3-0038: PM: dpm_run_callback(): i2c_hid_core_pm_resume [i2c_hid] returns -6 i2c_hid_of 3-0038: PM: failed to resume async: error -6
Add the reset GPIO so the driver can deassert the line on resume, restoring I2C communication with the device.
--- arch/arm64/boot/dts/qcom/glymur-crd.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/glymur-crd.dtsi +2 -0
@@ -640,6 +640,8 @@ touchscreen@38 { vdd-supply = <&vreg_misc_3p3>; vddl-supply = <&vreg_l15b_e0_1p8>; + reset-gpios = <&tlmm 48 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&ts0_default>; pinctrl-names = "default"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 223/1815 clk: qcom: gcc-glymur: Move EVA clocks to critical clock list
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 7399034fd78615ba826b864fca2e4572f13cf8e3 ]
The gcc_eva_ahb_clk and gcc_eva_xo_clk branch clocks should not be registered as standalone GCC branch clocks. Drop these clocks from the GCC clock list and instead add their CBCR registers to the GCC critical clocks list to ensure they remain enabled during early boot.
If these clocks are registered as normal branch clocks, they may be gated, which breaks access to the EVA clock controller during clock controller probe, thus leave them as critical clocks similar to other subsystem AHB and XO clocks.
--- drivers/clk/qcom/gcc-glymur.c | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-)
drivers/clk/qcom/gcc-glymur.c +2 -30
@@ -3668,21 +3668,6 @@ static struct clk_branch gcc_disp_hf_axi_clk = { }, }; -static struct clk_branch gcc_eva_ahb_clk = { - .halt_reg =0x9b004 , - .halt_check =BRANCH_HALT_VOTED , - .hwcg_reg =0x9b004 , - .hwcg_bit =1 , - .clkr = { - .enable_reg =0x9b004 , - .enable_mask =BIT (0 ), - .hw.init = &(const struct clk_init_data ) { - .name ="gcc_eva_ahb_clk" , - .ops = &clk_branch2_ops, - }, - }, -}; -static struct clk_branch gcc_eva_axi0_clk = { .halt_reg =0x9b008 , .halt_check =BRANCH_HALT_SKIP ,
@@ -3713,19 +3698,6 @@ static struct clk_branch gcc_eva_axi0c_clk = { }, }; -static struct clk_branch gcc_eva_xo_clk = { - .halt_reg =0x9b024 , - .halt_check =BRANCH_HALT , - .clkr = { - .enable_reg =0x9b024 , - .enable_mask =BIT (0 ), - .hw.init = &(const struct clk_init_data ) { - .name ="gcc_eva_xo_clk" , - .ops = &clk_branch2_ops, - }, - }, -}; -static struct clk_branch gcc_gp1_clk = { .halt_reg =0x64000 , .halt_check =BRANCH_HALT ,
@@ -7992,10 +7964,8 @@ static struct clk_regmap *gcc_glymur_clocks[] = { [GCC_CFG_NOC_USB_ANOC_AHB_CLK] = &gcc_cfg_noc_usb_anoc_ahb_clk.clkr, [GCC_CFG_NOC_USB_ANOC_SOUTH_AHB_CLK] = &gcc_cfg_noc_usb_anoc_south_ahb_clk.clkr, [GCC_DISP_HF_AXI_CLK] = &gcc_disp_hf_axi_clk.clkr, - [GCC_EVA_AHB_CLK] = &gcc_eva_ahb_clk.clkr, [GCC_EVA_AXI0_CLK] = &gcc_eva_axi0_clk.clkr, [GCC_EVA_AXI0C_CLK] = &gcc_eva_axi0c_clk.clkr, - [GCC_EVA_XO_CLK] = &gcc_eva_xo_clk.clkr, [GCC_GP1_CLK] = &gcc_gp1_clk.clkr, [GCC_GP1_CLK_SRC] = &gcc_gp1_clk_src.clkr, [GCC_GP2_CLK] = &gcc_gp2_clk.clkr,
@@ -8544,6 +8514,8 @@ static const u32 gcc_glymur_critical_cbcrs[] = {0x71004 ,/* GCC_GPU_CFG_AHB_CLK */ 0x32004 ,/* GCC_VIDEO_AHB_CLK */ 0x32058 ,/* GCC_VIDEO_XO_CLK */ +0x9b004 ,/* GCC_EVA_AHB_CLK */ + 0x9b024, /* GCC_EVA_XO_CLK */ }; static const struct regmap_config gcc_glymur_regmap_config = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 224/1815 arm64: dts: qcom: sc8280xp: sort reserved memory regions
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 53275adfb07d416a32004612227265939d0df00d ]
Move memory region reserved for the GPU to its proper place in DT.
--- arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +5 -5
@@ -692,11 +692,6 @@ reserved-region@85b00000 { no-map; }; - pil_gpu_mem: gpu-mem@8bf00000 { - reg = <0 0x8bf00000 0 0x2000>; - no-map; - }; - pil_adsp_mem: adsp-region@86c00000 { reg = <0 0x86c00000 0 0x2000000>; no-map;
@@ -712,6 +707,11 @@ pil_nsp0_mem: cdsp0-region@8a100000 { no-map; }; + pil_gpu_mem: gpu-mem@8bf00000 { + reg = <0 0x8bf00000 0 0x2000>; + no-map; + }; + pil_nsp1_mem: cdsp1-region@8c600000 { reg = <0 0x8c600000 0 0x1e00000>; no-map;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 225/1815 bus: qcom-ebi2: Fix clock leak on probe failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 64774dea58969194ea5c27fa639954e551a87024 ]
qcom_ebi2_probe() enables the EBI2X and EBI2 clocks before it walks child nodes and populates child devices. If reading a child node's reg property fails, or if of_platform_default_populate() fails, probe returns without disabling either clock.
Route those failure paths through the existing clock cleanup labels so a failed probe does not leave the clocks prepared and enabled.
--- drivers/bus/qcom-ebi2.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/bus/qcom-ebi2.c +7 -3
@@ -353,7 +353,7 @@ static int qcom_ebi2_probe(struct platform_device *pdev)/* Figure out the chipselect */ ret =of_property_read_u32 (child,"reg" , &csindex);if (ret) -return ret; + goto err_disable_clk;if (csindex >5 ) { dev_err(dev,
@@ -372,8 +372,12 @@ static int qcom_ebi2_probe(struct platform_device *pdev) have_children = true; } -if (have_children) -return of_platform_default_populate (np,NULL , dev); +if (have_children) { + ret =of_platform_default_populate (np,NULL , dev); +if (ret) + goto err_disable_clk; + } +return 0 ; err_disable_clk:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 226/1815 PCI: qcom: Skip PERST# GPIOs provided by downstream PCIe devices
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 3edb3a038d423480efeb204dbc6ddc9a292f8ecb ]
Currently, the pcie-qcom driver recursively parses the PERST# GPIO from all child nodes defined in DT and acquires them. But this creates issues with PERST# GPIO provided by one of the child devices like the PCIe switch port. In this case, the RC driver cannot acquire the PERST# GPIO since it will be provided by the child PCIe device which was not yet enumerated during RC driver probe.
Fix this by checking if the GPIO provider is a child of the RC's DT node (i.e., sits behind this PCIe controller). If so, skip it, as PERST# should be controlled by the respective PCIe client driver implementation. GPIOs provided by external GPIO controllers (e.g., TLMM in Qcom SoCs) continue to be handled normally.
--- drivers/pci/controller/dwc/pcie-qcom.c | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +37 -0
@@ -1820,6 +1820,23 @@ static const struct pci_ecam_ops pci_qcom_ecam_ops = { } }; +/* Check if @node is a child of @dev in DT */ +static bool qcom_pcie_is_child_node (struct device *dev, +struct device_node *node) +{ +struct device_node *parent; + +for (parent =of_get_parent (node); parent; + parent =of_get_next_parent (parent)) { +if (parent == dev->of_node) { +of_node_put (parent); +return true; + } + } + +return false; +} +/* Parse PERST# from all nodes in depth first manner starting from @np */ static int qcom_pcie_parse_perst(struct qcom_pcie *pcie, struct qcom_pcie_port *port,
@@ -1827,6 +1844,7 @@ static int qcom_pcie_parse_perst(struct qcom_pcie *pcie, {struct device *dev = pcie->pci->dev;struct qcom_pcie_perst *perst; +struct device_node *gpio_np;struct gpio_desc *reset;int ret;
@@ -1840,6 +1858,25 @@ static int qcom_pcie_parse_perst(struct qcom_pcie *pcie,if (!of_find_property (np,"reset-gpios" ,NULL )) goto parse_child_node; +/* +* Skip GPIOs provided by a PCIe device which is a child of the Root +* Complex (e.g., a PCIe switch with GPIO controller capability). Such +* controllers won't be available at RC probe time and their PERST# +* should be controlled by the respective PCI client driver +* implementation. +*/ + gpio_np =of_parse_phandle (np,"reset-gpios" ,0 ); +if (!gpio_np) { +dev_err (dev,"Failed to parse GPIO provider\n" ); +return -EINVAL ; + } + +if (qcom_pcie_is_child_node (dev, gpio_np)) { +of_node_put (gpio_np); + goto parse_child_node; + } +of_node_put (gpio_np); + reset =devm_fwnode_gpiod_get (dev,of_fwnode_handle (np),"reset" ,GPIOD_OUT_HIGH ,"PERST#" );if (IS_ERR (reset)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 227/1815 wifi: mac80211_hwsim: avoid NULL skb in stop queue drain
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <[email protected]>
[ Upstream commit 158438cd6ad69d6dd7d871582c38baf22169fede ]
mac80211_hwsim_stop() drops any frames left in data->pending. The loop currently checks skb_queue_empty() and then dequeues separately.
That split is racy with TX status handling, which can remove a pending frame under the queue lock. If the last entry is removed after the empty check, skb_dequeue() returns NULL and the stop path passes that NULL skb to ieee80211_free_txskb().
Use skb_dequeue() as the loop condition instead. The dequeue result is the object that stop owns and frees, and a concurrent status completion that empties the queue simply makes the loop terminate.
--- drivers/net/wireless/virtual/mac80211_hwsim_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim_main.c +3 -2
@@ -2314,6 +2314,7 @@ static int mac80211_hwsim_start(struct ieee80211_hw *hw)static void mac80211_hwsim_stop (struct ieee80211_hw *hw,bool suspend) {struct mac80211_hwsim_data *data = hw->priv; +struct sk_buff *skb;int i; data->started = false;
@@ -2321,8 +2322,8 @@ static void mac80211_hwsim_stop(struct ieee80211_hw *hw, bool suspend)for (i =0 ; i <ARRAY_SIZE (data->link_data); i++)hrtimer_cancel (&data->link_data[i].beacon_timer); -while (!skb_queue_empty (&data->pending)) -ieee80211_free_txskb (hw,skb_dequeue (&data->pending)); +while ((skb =skb_dequeue (&data->pending))) +ieee80211_free_txskb (hw, skb);wiphy_dbg (hw->wiphy,"%s\n" , __func__); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 228/1815 staging: greybus: audio: correct sscanf() return value check
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander A. Klimov <[email protected]>
[ Upstream commit f883fa1a0a0212f63acb18c50e5f900301f3bb1e ]
manager_sysfs_add_store() passes 6 pointers to sscanf(), but required latter to return 7 which always failed the operation. I corrected it to 6.
--- drivers/staging/greybus/audio_manager_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/audio_manager_sysfs.c +1 -1
@@ -23,7 +23,7 @@ static ssize_t manager_sysfs_add_store(struct kobject *kobj, desc.name, &desc.vid, &desc.pid, &desc.intf_id, &desc.ip_devices, &desc.op_devices); -if (num !=7 ) +if (num !=6 )return -EINVAL ; num =gb_audio_manager_add (&desc);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 229/1815 staging: sm750fb: gate dualview dataflow using g_dualview
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmet Sezgin Duran <[email protected]>
[ Upstream commit d352778979d2eed09e266ed0f3a5e3ccd3983940 ]
In sm750fb_setup and sm750fb_set_drv functions, the dualview related code is guarded by sm750_dev->fb_count > 1 condition. That value is updated only after each framebuffer is registered, while both guards are used before any increment.
Current flow:
lynxfb_pci_probe()
sm750fb_setup() // fb_count is 0
for each fb:
sm750fb_framebuffer_alloc()
lynxfb_set_fbinfo()
sm750fb_set_drv() // fb_count is 0 or 1
register_framebuffer()
sm750_dev->fb_count++; // fb_count is incrementedThus even if dualview=1 parameter is passed down to the driver, fb_count is never > 1 at either check, so dualview dataflows are not selected and crtc->vidmem_size is never halved.
Use g_dualview global variable instead of fb_count > 1 to correctly enable dualview capabilities.
--- drivers/staging/sm750fb/sm750.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/sm750fb/sm750.c +2 -2
@@ -591,7 +591,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par) crtc = &par->crtc; crtc->vidmem_size = sm750_dev->vidmem_size; -if (sm750_dev->fb_count >1 ) +if (g_dualview) crtc->vidmem_size >>=1 ;/* setup crtc and output member */
@@ -896,7 +896,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src) NO_PARAM:if (sm750_dev->revid !=SM750LE_REVISION_ID ) { -if (sm750_dev->fb_count >1 ) { +if (g_dualview) {if (swap) sm750_dev->dataflow = sm750_dual_swap;else
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 230/1815 staging: sm750fb: Add missing Kconfig dependency
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rong Zhang <[email protected]>
[ Upstream commit da8fd33e7d6af4c069668c2d42234b969f706885 ]
The sm750 frame buffer driver depends on FB_IOMEM_FOPS, but its Kconfig somehow misses it.
Fix it by making FB_SM750 select FB_IOMEM_FOPS, as other frame buffer drivers do.
--- drivers/staging/sm750fb/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/staging/sm750fb/Kconfig +1 -0
@@ -6,6 +6,7 @@ config FB_SM750 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS help Frame buffer driver for the Silicon Motion SM750 chip with 2D acceleration and dual head support.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 231/1815 greybus: audio: bound the topology section sizes against the fetched size
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryam Vargas <[email protected]>
[ Upstream commit 33d8c7b794d2a30637c9d3fcb478f1d3222bef1e ]
gb_audio_gb_get_topology() fetches a topology blob of a module-supplied size, and gbaudio_tplg_parse_data() then walks it by adding the module-supplied size_dais, size_controls and size_widgets fields to form the control, widget and route section offsets. Those le32 sizes are never checked against the fetched blob, so a module reporting a small topology size but large section sizes makes the offsets point past the allocation, and parsing reads out of bounds.
Reject a topology whose section sizes do not fit within the fetched size before it is parsed.
--- drivers/staging/greybus/audio_gb.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/staging/greybus/audio_gb.c +13 -0
@@ -37,6 +37,19 @@ int gb_audio_gb_get_topology(struct gb_connection *connection,return ret; } +/* +* The size_* fields are supplied by the module and are used by +* gbaudio_tplg_parse_data() to compute offsets into the blob; make +* sure the sections fit within the fetched topology, so walking it +* cannot read out of bounds. +*/ +if ((u64 )le32_to_cpu (topo->size_dais) +le32_to_cpu (topo->size_controls) + +le32_to_cpu (topo->size_widgets) +le32_to_cpu (topo->size_routes) > + size -sizeof (*topo)) { +kfree (topo); +return -EINVAL ; + } + *topology = topo;return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 232/1815 staging: fbtft: Use sysfs_emit_at() to print to sysfs file
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 221192a784c25e28b489a7e75fabf59be4f63d57 ]
This scnprintf() uses the wrong limit. It should be "PAGE_SIZE - len" instead of just PAGE_SIZE. We're not going to hit the limit in real life since we are printing at most FBTFT_GAMMA_MAX_VALUES_TOTAL (128) u32 values, however, it's still worth fixing.
Use sysfs_emit_at() to fix this since this is a sysfs file.
--- drivers/staging/fbtft/fbtft-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fbtft-sysfs.c +1 -1
@@ -98,7 +98,7 @@ sprintf_gamma(struct fbtft_par *par, u32 *curves, char *buf)mutex_lock (&par->gamma.lock);for (i =0 ; i < par->gamma.num_curves; i++) {for (j =0 ; j < par->gamma.num_values; j++) - len +=scnprintf (&buf[len],PAGE_SIZE , + len +=sysfs_emit_at (buf, len,"%04x " , curves[i * par->gamma.num_values + j]); buf[len -1 ] ='\n' ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 233/1815 staging: octeon: add missing tasklet_kill in cvm_oct_tx_shutdown
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ayush Mukkanwar <[email protected]>
[ Upstream commit b9af44b0d20b2247c4eb0ea5cfca907d643eea50 ]
The TX cleanup tasklet can be scheduled by the watchdog IRQ handler to execute cvm_oct_tx_do_cleanup. There can be a pending tasklet in the queue which might run after the cvm_oct_remove() frees net_device structures, causing a use-after-free in cvm_oct_tx_do_cleanup() as it iterates cvm_oct_device[] which is an array of netdevice pointers. Add tasklet_kill() after free_irq() to ensure the tasklet is no longer scheduled or running before teardown proceeds.
--- drivers/staging/octeon/ethernet-tx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/octeon/ethernet-tx.c +2 -0
@@ -668,4 +668,6 @@ void cvm_oct_tx_shutdown(void) {/* Free the interrupt handler */ free_irq (OCTEON_IRQ_TIMER1 , cvm_oct_device); + +tasklet_kill (&cvm_oct_tx_cleanup_tasklet); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 234/1815 staging: octeon: add missing napi_disable in cvm_oct_rx_shutdown
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ayush Mukkanwar <[email protected]>
[ Upstream commit c0a9a8586a63fda49e61a6b83360feac2a60d898 ]
cvm_oct_rx_shutdown calls free_irq and netif_napi_del without disabling the napi instance first. As the free_irq only waits for completion of hard interrupt handlers, the napi poll function could still be active. If cvm_oct_remove proceeds to free the plat structure (which holds the NAPI instances), the active poll function will access freed memory, resulting in a use-after-free crash.
--- drivers/staging/octeon/ethernet-rx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/octeon/ethernet-rx.c +2 -0
@@ -535,6 +535,8 @@ void cvm_oct_rx_shutdown(struct platform_device *pdev)else cvmx_write_csr (CVMX_POW_WQ_INT_THRX (i),0 ); +napi_disable (&plat->rx_group[i].napi); +/* Free the interrupt handler */ free_irq (plat->rx_group[i].irq, &plat->rx_group[i].napi);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 235/1815 staging: rtl8723bs: fix mismatched free of HalData in rtw_sdio_if1_init()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dawei Feng <[email protected]>
[ Upstream commit 264676418b726baca7be49171e306b6aa05cceb0 ]
padapter->HalData is allocated via vzalloc(), but incorrectly freed using kfree() in the rtw_sdio_if1_init() error path. Using kfree() to release this vmalloc-backed buffer can lead to memory corruption.
Use rtw_hal_data_deinit() to pair the free correctly and free HalData with vfree().
The bug was first flagged by an experimental static analysis tool we are developing for kernel memory-management bugs. Manual inspection confirms that the issue is still present in current mainline.
An x86_64 allyesconfig build showed no new warnings. As we do not have suitable RTL8723BS SDIO hardware to test with, no runtime testing was able to be performed.
--- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +2 -2
@@ -285,8 +285,8 @@ static struct adapter *rtw_sdio_if1_init(struct dvobj_priv *dvobj, const struct status = _SUCCESS; free_hal_data: -if (status != _SUCCESS && padapter->HalData) -kfree (padapter->HalData); +if (status != _SUCCESS) +rtw_hal_data_deinit (padapter);if (status != _SUCCESS) {rtw_wdev_unregister (padapter->rtw_wdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 236/1815 kbuild: unset sub_make_done before calling kselftest build system
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit e77f165d26f72c280654cff248f5106cb9a53951 ]
The kselftest build system may recourse back into kbuild when building test modules. In that case kbuild needs to parse the new flags passed from the command line, instead of using the ones inherited from the kbuild invocation.
Force that command line reevaluation.
The same was done for scripts/install.sh in commit 14ccc638b02f9ec ("kbuild: cancel sub_make_done for the install target to fix DKMS")
--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -1605,10 +1605,10 @@ tools/%: FORCE PHONY += kselftest kselftest: headers - $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests + $(Q)unset sub_make_done; $(MAKE) -C $(srctree)/tools/testing/selftests run_tests kselftest-%: headers FORCE - $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $* + $(Q)unset sub_make_done; $(MAKE) -C $(srctree)/tools/testing/selftests $* PHONY += kselftest-merge kselftest-merge:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 237/1815 ALSA: via82xx: Remove unreachable branch in snd_via686_pcm_pointer()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Evgenii Burenchev <[email protected]>
[ Upstream commit cd3447e1b6425efd1704ed07f1f245c842927eb0 ]
The condition
if (count && size < count)
can never evaluate to true.
The VIA DMA count register is masked with 0x00ffffff before use, while the DMA buffer size is limited to 0x00fffffe bytes. As a result, 'count' can never exceed 'size', making the condition permanently false.
This branch has therefore been unreachable since the driver was introduced. Remove the unreachable branch without changing runtime behavior.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/pci/via82xx_modem.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-)
sound/pci/via82xx_modem.c +10 -16
@@ -573,24 +573,18 @@ static inline unsigned int calc_linear_pos(struct via82xx_modem *chip, viadev->bufsize2, viadev->idx_table[idx].offset, viadev->idx_table[idx].size, count);#endif -if (count && size < count) { +if (! count) +/* bogus count 0 on the DMA boundary? */ + res = viadev->idx_table[idx].offset; +else +/* count register returns full size +* when end of buffer is reached +*/ + res = viadev->idx_table[idx].offset + size; +if (check_invalid_pos (viadev, res)) {dev_dbg (chip->card->dev, -"invalid via82xx_cur_ptr, using last valid pointer\n" ); +"invalid via82xx_cur_ptr (2), using last valid pointer\n" ); res = viadev->lastpos; - }else { -if (! count) -/* bogus count 0 on the DMA boundary? */ - res = viadev->idx_table[idx].offset; -else -/* count register returns full size -* when end of buffer is reached -*/ - res = viadev->idx_table[idx].offset + size; -if (check_invalid_pos (viadev, res)) { -dev_dbg (chip->card->dev, -"invalid via82xx_cur_ptr (2), using last valid pointer\n" ); - res = viadev->lastpos; - } } } viadev->lastpos = res;/* remember the last position */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 238/1815 selftests/bpf: libarena: Clean up allocation state before buddy tests
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Tsalapatis <[email protected]>
[ Upstream commit 14c2b770d15d5b0d814cdef114de55e01a281e00 ]
Summary: The buddy allocator requires the global BPF buddy allocator to not be already initialized. However, the test currently merely resets the allocator before the buddy tests instead of destroying it, and the test worked because the buddy test happened to run first. Properly destroy the allocator instead of resetting it.
--- tools/testing/selftests/bpf/libarena/src/common.bpf.c | 6 ++++++ tools/testing/selftests/bpf/prog_tests/libarena.c | 8 ++++++-- tools/testing/selftests/bpf/prog_tests/libarena_asan.c | 8 ++++++-- 3 files changed, 18 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/libarena/src/common.bpf.c +6 -0
@@ -38,6 +38,12 @@ __weak int arena_buddy_reset(void)return buddy_init (&buddy); } +SEC("syscall") +__weak int arena_buddy_destroy (void ) +{ +return buddy_destroy (&buddy); +} + __weak void __arena *arena_malloc(size_t size) {return buddy_alloc (&buddy, size);
tools/testing/selftests/bpf/prog_tests/libarena.c +6 -2
@@ -15,7 +15,12 @@ static void run_libarena_test(struct libarena *skel, struct bpf_program *prog, {int ret; -if (!strstr (name,"test_buddy" )) { +if (strstr (name,"test_buddy" )) { +/* Buddy tests initialize the allocator directly. */ + ret =libarena_run_prog (bpf_program__fd (skel->progs.arena_buddy_destroy)); +if (!ASSERT_OK (ret,"arena_buddy_destroy" )) +return ; + }else { ret =libarena_run_prog (bpf_program__fd (skel->progs.arena_buddy_reset));if (!ASSERT_OK (ret,"arena_buddy_reset" ))return ;
@@ -24,7 +29,6 @@ static void run_libarena_test(struct libarena *skel, struct bpf_program *prog, ret =libarena_run_prog (bpf_program__fd (prog));ASSERT_OK (ret, name); - }static void *run_libarena_parallel_prog (void *arg)
tools/testing/selftests/bpf/prog_tests/libarena_asan.c +6 -2
@@ -17,7 +17,12 @@ static void run_libarena_asan_test(struct libarena_asan *skel, {int ret; -if (!strstr (name,"test_buddy" )) { +if (strstr (name,"test_buddy" )) { +/* Buddy tests initialize the allocator directly. */ + ret =libarena_run_prog (bpf_program__fd (skel->progs.arena_buddy_destroy)); +if (!ASSERT_OK (ret,"arena_buddy_destroy" )) +return ; + }else { ret =libarena_run_prog (bpf_program__fd (skel->progs.arena_buddy_reset));if (!ASSERT_OK (ret,"arena_buddy_reset" ))return ;
@@ -90,4 +95,3 @@ void test_libarena_asan(void)return ; } -
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 239/1815 selftests/bpf: Fix memory leak in msg_alloc_iov error path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malaya Kumar Rout <[email protected]>
[ Upstream commit 0bebfaa39deadec21638f6fba553eae12627a26d ]
In msg_alloc_iov(), when calloc() fails for an individual iov_base allocation, the error path frees all previously allocated iov_base entries but fails to free the iov array itself that was allocated with calloc() at the beginning of the function. This results in a memory leak of the iov array.
Add free(iov) in the unwind_iov error path to ensure proper cleanup of all allocated memory.
--- tools/testing/selftests/bpf/test_sockmap.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/test_sockmap.c +1 -0
@@ -436,6 +436,7 @@ static int msg_alloc_iov(struct msghdr *msg, unwind_iov:for (i--; i >=0 ; i--)free (msg->msg_iov[i].iov_base); +free (iov);return -ENOMEM ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 240/1815 bpf: Reject MEM_ALLOC BTF accesses past object bounds
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yiyang Chen <[email protected]>
[ Upstream commit 9c9ee0324c774490ae953162aaaf4561d222bd93 ]
BTF struct walks relax the struct-size check for accesses through a trailing flexible array. That is valid for ordinary BTF type walking, but PTR_TO_BTF_ID | MEM_ALLOC values point to objects allocated with the static BTF type size.
When walking a MEM_ALLOC object, reject the access before applying the flexible-array relaxation if the access range extends past the struct size. Apply the same policy to struct ID matching so kfunc and kptr type checks do not walk past the allocated object bounds either.
--- include/linux/bpf.h | 2 +- kernel/bpf/btf.c | 17 +++++++++++------ kernel/bpf/verifier.c | 11 +++++++---- 3 files changed, 19 insertions(+), 11 deletions(-)
include/linux/bpf.h +1 -1
@@ -3146,7 +3146,7 @@ int btf_struct_access(struct bpf_verifier_log *log,bool btf_struct_ids_match (struct bpf_verifier_log *log,const struct btf *btf,u32 id,int off,const struct btf *need_btf,u32 need_type_id, -bool strict); +bool strict,bool walk_flex_arrays); int btf_distill_func_proto(struct bpf_verifier_log *log, struct btf *btf,
kernel/bpf/btf.c +11 -6
@@ -7108,7 +7108,7 @@ enum bpf_struct_walk_result {static int btf_struct_walk (struct bpf_verifier_log *log,const struct btf *btf,const struct btf_type *t,int off,int size,u32 *next_btf_id,enum bpf_type_flag *flag, -const char **field_name) +const char **field_name,bool walk_flex_arrays) {u32 i, moff, mtrue_end, msize =0 , total_nelems =0 ;const struct btf_type *mtype, *elem_type =NULL ;
@@ -7135,11 +7135,14 @@ static int btf_struct_walk(struct bpf_verifier_log *log, const struct btf *btf, *flag |=PTR_UNTRUSTED ;if (off + size > t->size) { +struct btf_array *array_elem; + +if (!walk_flex_arrays) + goto error; +/* If the last element is a variable size array, we may * need to relax the rule. */ -struct btf_array *array_elem; -if (vlen ==0 ) goto error;
@@ -7404,7 +7407,8 @@ int btf_struct_access(struct bpf_verifier_log *log, t =btf_type_by_id (btf, id); do { - err = btf_struct_walk(log, btf, t, off, size, &id, &tmp_flag, field_name); + err = btf_struct_walk(log, btf, t, off, size, &id, &tmp_flag, + field_name, !type_is_alloc(reg->type)); switch (err) { case WALK_PTR:
@@ -7463,7 +7467,7 @@ bool btf_types_are_same(const struct btf *btf1, u32 id1,bool btf_struct_ids_match (struct bpf_verifier_log *log,const struct btf *btf,u32 id,int off,const struct btf *need_btf,u32 need_type_id, -bool strict) +bool strict,bool walk_flex_arrays) {const struct btf_type *type;enum bpf_type_flag flag =0 ;
@@ -7482,7 +7486,8 @@ bool btf_struct_ids_match(struct bpf_verifier_log *log, type =btf_type_by_id (btf, id);if (!type)return false; - err =btf_struct_walk (log, btf, type, off,1 , &id, &flag,NULL ); + err =btf_struct_walk (log, btf, type, off,1 , &id, &flag,NULL , + walk_flex_arrays);if (err !=WALK_STRUCT )return false;
kernel/bpf/verifier.c +7 -4
@@ -4349,7 +4349,8 @@ static int map_kptr_match_type(struct bpf_verifier_env *env,*/ if (!btf_struct_ids_match (&env->log, reg->btf, reg->btf_id, reg->var_off.value, kptr_field->kptr.btf, kptr_field->kptr.btf_id, - kptr_field->type !=BPF_KPTR_UNREF )) + kptr_field->type !=BPF_KPTR_UNREF , + !type_is_alloc (reg->type))) goto bad_type;return 0 ; bad_type:
@@ -7947,7 +7948,7 @@ static int check_reg_type(struct bpf_verifier_env *env, struct bpf_reg_state *reif (!btf_struct_ids_match (&env->log, reg->btf, reg->btf_id, reg->var_off.value, btf_vmlinux, *arg_btf_id, - strict_type_match)) { + strict_type_match, !type_is_alloc (reg->type))) { verbose(env, "%s is of type %s but %s is expected\n", reg_arg_name(env, argno), btf_type_name(reg->btf, reg->btf_id),
@@ -11414,7 +11415,8 @@ static int process_kf_arg_ptr_to_btf_id(struct bpf_verifier_env *env, reg_ref_t =btf_type_skip_modifiers (reg_btf, reg_ref_id, ®_ref_id); reg_ref_tname =btf_name_by_offset (reg_btf, reg_ref_t->name_off); struct_same =btf_struct_ids_match (&env->log, reg_btf, reg_ref_id, reg->var_off.value, - meta->btf, ref_id, strict_type_match); + meta->btf, ref_id, strict_type_match, + !type_is_alloc (reg->type));/* If kfunc is accepting a projection type (ie. __sk_buff), it cannot * actually use it -- it must cast to the underlying type. So we allow * caller to pass in the underlying type.
@@ -11861,7 +11863,8 @@ __process_kf_arg_ptr_to_graph_node(struct bpf_verifier_env *env, et =btf_type_by_id (field->graph_root.btf, field->graph_root.value_btf_id); t =btf_type_by_id (reg->btf, reg->btf_id);if (!btf_struct_ids_match (&env->log, reg->btf, reg->btf_id,0 , field->graph_root.btf, - field->graph_root.value_btf_id, true)) { + field->graph_root.value_btf_id, true, + !type_is_alloc (reg->type))) { verbose(env, "operation on %s expects arg#1 %s at offset=%d " "in struct %s, but arg is at offset=%d in struct %s\n", btf_field_type_name(head_field_type),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 241/1815 s390/bpf: Replace ly instruction with llgf
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Khmelevskii <[email protected]>
[ Upstream commit 5f6cc299938b561cb01e343bab7042611fcee12a ]
cpu_nr is a 32 bit value and BPF_REG_0 is a 64 bit register, when ly loads the cpu_nr into BPF_REG_0 it does not zero the upper bits, but llgf does.
--- arch/s390/net/bpf_jit_comp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/net/bpf_jit_comp.c +2 -2
@@ -1783,8 +1783,8 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, insn->imm == BPF_FUNC_get_smp_processor_id) {const u32 *cpu_nr = &get_lowcore ()->cpu_nr; -/* ly %b0, cpu_nr */ -EMIT6_DISP_LH (0xe3000000 ,0x0058 ,BPF_REG_0 ,REG_0 ,REG_0 , +/* llgf %b0, cpu_nr */ +EMIT6_DISP_LH (0xe3000000 ,0x0016 ,BPF_REG_0 ,REG_0 ,REG_0 , (unsigned long )cpu_nr);break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 242/1815 selftests/bpf: Fix memory leak in msg_alloc_iov
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Feng Yang <[email protected]>
[ Upstream commit 602701718649936eb287bf6c7ecf870ec54c6f71 ]
In the msg_alloc_iov function, the iov pointer is only assigned to msg->msg_iov after all memory allocations complete successfully. Therefore, when a calloc failure triggers the unwind_iov cleanup branch, we should use the local variable iov instead of msg->msg_iov.
--- tools/testing/selftests/bpf/test_sockmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/test_sockmap.c +1 -1
@@ -435,7 +435,7 @@ static int msg_alloc_iov(struct msghdr *msg,return 0 ; unwind_iov:for (i--; i >=0 ; i--) -free (msg->msg_iov[i].iov_base); +free (iov[i].iov_base);free (iov);return -ENOMEM ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 243/1815 selftests/lsm: Fix memory leak in attr_lsm_count
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Yan <[email protected]>
[ Upstream commit 0cee720cfd51402cfcb14d96cb326a36c13b823a ]
The calloc-allocated buffer in attr_lsm_count() is never released on any exit path, including both the normal return path and the early return when read_sysfs_lsms fails, resulting in a heap memory leak.
Add free() for the buffer on all return branches to fix the leak.
--- tools/testing/selftests/lsm/common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/lsm/common.c +3 -1
@@ -76,7 +76,7 @@ int attr_lsm_count(void)return 0 ;if (read_sysfs_lsms (names,sysconf (_SC_PAGESIZE))) -return 0 ; + goto out;if (strstr (names,"selinux" )) count++;
@@ -85,5 +85,7 @@ int attr_lsm_count(void)if (strstr (names,"apparmor" )) count++; +out: +free (names);return count; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 244/1815 irqchip/gic-v3-its: Fix memleak in its_probe_one()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
[ Upstream commit 1efffab6fe336a5c4fd3c2886f255cd2f998e65f ]
Fix collection leak when its_init_domain() failed in its_probe_one().
--- drivers/irqchip/irq-gic-v3-its.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3-its.c +3 -1
@@ -5320,7 +5320,7 @@ static int __init its_probe_one(struct its_node *its) err =its_init_domain (its);if (err) - goto out_free_tables; + goto out_free_collection;raw_spin_lock (&its_lock);list_add (&its->entry, &its_nodes);
@@ -5328,6 +5328,8 @@ static int __init its_probe_one(struct its_node *its)return 0 ; +out_free_collection: +kfree (its->collections); out_free_tables:its_free_tables (its); out_free_cmd:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 245/1815 irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
[ Upstream commit 698a8648ca8051d34722b09b8a8088c741120ac3 ]
Fix its node leak when its_probe_one() failed ingic_acpi_parse_madt_its().
--- drivers/irqchip/irq-gic-v3-its.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +6 -2
@@ -5741,9 +5741,13 @@ static int __init gic_acpi_parse_madt_its(union acpi_subtable_headers *header, its->flags |=ITS_FLAGS_FORCE_NON_SHAREABLE ; err =its_probe_one (its); -if (!err) -return 0 ; +if (err) + goto probe_err; + +return 0 ; +probe_err: +its_node_destroy (its); node_err:iort_deregister_domain_token (its_entry->translation_id); dom_err:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 246/1815 selftests: timers: leap-a-day: Fix -w option and update usage comment
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiangshan Yi <[email protected]>
[ Upstream commit b4b66151a71445f3a71574136ddc82968c7b175e ]
Commit 98b74e1f3104 ("kselftests: timers: leap-a-day: Change default arguments to help test runs") replaced the -s option with -w and made "wait for the leap second" the non-default behaviour, but it only updated the switch/case handling. Two things were left inconsistent:
- The getopt() option string still lists 's' instead of 'w', so passing -w is rejected as an invalid option and the new behaviour cannot be selected at all.
- The file header comment still documents the removed -s option and an outdated default for -i.
Fix the getopt() string to accept 'w' (matching the existing case 'w':
handler) and update the header comment to describe -w, -t and the current -i default.
--- tools/testing/selftests/timers/leap-a-day.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
tools/testing/selftests/timers/leap-a-day.c +11 -8
@@ -9,16 +9,19 @@* kernel's leap-second behavior, as well as how well applications * handle the leap-second discontinuity. * -* Usage: leap-a-day [-s] [-i <num>] +* Usage: leap-a-day [-w] [-i <num>] [-t] * * Options: -* -s: Each iteration, set the date to 10 seconds before midnight GMT. -* This speeds up the number of leapsecond transitions tested, -* but because it calls settimeofday frequently, advancing the -* time by 24 hours every ~16 seconds, it may cause application -* disruption. +* -w: Only set the leap-second flag and wait for the leap second +* each iteration, instead of advancing the time. By default the +* date is set to 10 seconds before midnight GMT, which speeds up +* the number of leapsecond transitions tested, but because it +* calls settimeofday frequently, advancing the time by 24 hours +* every ~16 seconds, it may cause application disruption. * -* -i: Number of iterations to run (default: infinite) +* -i: Number of iterations to run (-1 = infinite, default: 10) +* +* -t: Print TAI time. * * Other notes: Disabling NTP prior to running this is advised, as the two * may conflict in their commands to the kernel.
@@ -186,7 +189,7 @@ int main(int argc, char **argv)int opt;/* Process arguments */ -while ((opt =getopt (argc, argv,"sti:" )) !=-1 ) { +while ((opt =getopt (argc, argv,"wti:" )) !=-1 ) {switch (opt) {case 'w' :printf ("Only setting leap-flag, not changing time. It could take up to a day for leap to trigger.\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 247/1815 clocksource: Unregister subsystem on device registration failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit 3dee6537e728bd8137fda6eaf859f26e685943f7 ]
init_clocksource_sysfs() registers the clocksource subsystem before registering the clocksource device. If device_register() fails, the function returns the error while leaving the subsystem registered.
Unregister the clocksource subsystem on that failure path so the successful subsystem registration is unwound before returning.
--- kernel/time/clocksource.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/time/clocksource.c +6 -2
@@ -1566,8 +1566,12 @@ static int __init init_clocksource_sysfs(void) {int error =subsys_system_register (&clocksource_subsys,NULL ); -if (!error) - error =device_register (&device_clocksource); +if (error) +return error; + + error =device_register (&device_clocksource); +if (error) +bus_unregister (&clocksource_subsys);return error; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 248/1815 timekeeping: Unwind aux clock sysfs children on failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit f2eee7e31ccd4bc87d047d8670cc2ec39cf36647 ]
tk_aux_sysfs_init() creates one child kobject per auxiliary clock. If a later child or sysfs group creation fails, the current error path only puts the parent kobjects and leaves earlier children and groups behind.
Store the child kobjects during init and remove the successfully created groups and kobjects on failure.
--- kernel/time/timekeeping.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
kernel/time/timekeeping.c +15 -6
@@ -3315,7 +3315,9 @@ static const struct attribute_group aux_clock_enable_attr_group = {static int __init tk_aux_sysfs_init (void ) {struct kobject *auxo, *tko =kobject_create_and_add ("time" , kernel_kobj); +struct kobject *clks[MAX_AUX_CLOCKS ];int ret = -ENOMEM ; +int i;if (!tko)return ret;
@@ -3324,21 +3326,28 @@ static int __init tk_aux_sysfs_init(void)if (!auxo) goto err_clean; -for (int i =0 ; i <MAX_AUX_CLOCKS ; i++) { +for (i =0 ; i <MAX_AUX_CLOCKS ; i++) {char id[2 ] = { [0 ] ='0' + i, }; -struct kobject *clk =kobject_create_and_add (id, auxo); + clks[i] =kobject_create_and_add (id, auxo); -if (!clk) { +if (!clks[i]) { ret = -ENOMEM ; - goto err_clean; + goto err_clks; } - ret =sysfs_create_group (clk, &aux_clock_enable_attr_group); + ret =sysfs_create_group (clks[i], &aux_clock_enable_attr_group);if (ret) - goto err_clean; + goto err_clk; }return 0 ; +err_clk: +kobject_put (clks[i]); +err_clks: +while (--i >=0 ) { +sysfs_remove_group (clks[i], &aux_clock_enable_attr_group); +kobject_put (clks[i]); + } err_clean:kobject_put (auxo);kobject_put (tko);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 249/1815 timers/migration: Fix memory leak in tmigr_setup_groups() error path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malaya Kumar Rout <[email protected]>
[ Upstream commit eddfded4196542deda7cb2da3d7ebef83f7ccfa4 ]
When the WARN_ON_ONCE(i >= tmigr_hierarchy_levels) assertion triggers, the function returns -EINVAL without freeing the 'stack' memory allocated via kzalloc_objs() at the beginning of the function.
Add kfree(stack) before returning to prevent the memory leak.
--- kernel/time/timer_migration.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/time/timer_migration.c +3 -1
@@ -1847,8 +1847,10 @@ static int tmigr_setup_groups(struct tmigr_hierarchy *hier, unsigned int cpu, }/* Assert single root without parent */ -if (WARN_ON_ONCE (i >= tmigr_hierarchy_levels)) +if (WARN_ON_ONCE (i >= tmigr_hierarchy_levels)) { +kfree (stack);return -EINVAL ; + }for (; i >= start_lvl; i--) { group = stack[i];
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 250/1815 time/namespace: Validate nanosecond field in proc_timens_set_offset()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malaya Kumar Rout <[email protected]>
[ Upstream commit 06aba58e58492d2b8eae059274caed29025ea96e ]
The function validates tv_sec to be within [-KTIME_SEC_MAX, KTIME_SEC_MAX] but never validates that tv_nsec is within the valid range of [0, NSEC_PER_SEC-1] before using it in timespec64_add().
timespec64_add() expects both timespec64 structures to have normalized values with tv_nsec in the range [0, 999999999]. If off->val.tv_nsec contains invalid values (negative or >= NSEC_PER_SEC), it could lead to incorrect calculations or unexpected behavior.
Add validation to ensure tv_nsec is within the valid range before performing the addition.
--- kernel/time/namespace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/time/namespace.c +4 -2
@@ -293,10 +293,12 @@ int proc_timens_set_offset(struct file *file, struct task_struct *p,return -EINVAL ; } -if (off->val.tv_sec >KTIME_SEC_MAX || - off->val.tv_sec < -KTIME_SEC_MAX ) +if (off->val.tv_sec >KTIME_SEC_MAX || off->val.tv_sec < -KTIME_SEC_MAX )return -ERANGE ; +if (off->val.tv_nsec <0 || off->val.tv_nsec >=NSEC_PER_SEC ) +return -EINVAL ; + tp =timespec64_add (tp, off->val);/* * KTIME_SEC_MAX is divided by 2 to be sure that KTIME_MAX is
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 251/1815 y2038: uapi: Use 64-bit __kernel_old_timespec::tv_nsec on x32
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 79ced850e549e8c86b772a79ea417a1425b5c04b ]
'struct __kernel_old_timespec' represents the 'native' time ABI of the kernel. On 32-bit systems it uses 32-bit fields and on 64-bit systems it uses 64-bit fields.
However the x86 x32 ABI uses the 64-bit time ABI natively. This is correctly handled for the 'tv_sec' fields, through the typedefs of '__kernel_old_time_t' -> '__kernel_long_t' -> 'long long'. The same treatment was missed for 'tv_nsec'.
In practice this might not make much of a difference as the value of 'tv_nsec' will always fit into 32 bits and the missing bits fall into the padding of the structure.
When introspecting the structure however, a difference can be observed.
Switch to 64-bit tv_nsec on x32. No other architectures or ABIs are affected.
While this could be interpreted as violating the POSIX requirement of 'timespec::tv_nsec' being 'long':
* __kernel_old_timespec is not actually the POSIX timespec type
* the requirement is gone in newer versions of POSIX
* this matches glibc
--- include/uapi/linux/time_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/time_types.h +1 -1
@@ -30,7 +30,7 @@ struct __kernel_old_timeval {struct __kernel_old_timespec {__kernel_old_time_t tv_sec;/* seconds */ -long tv_nsec;/* nanoseconds */ +__kernel_long_t tv_nsec;/* nanoseconds */ };struct __kernel_old_itimerval {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 252/1815 timekeeping: Account for monotonicity adjustment in ntp_error
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
[ Upstream commit b7befd6d91207cf3f4cecd68fea0c212093906cf ]
timekeeping_apply_adjustment() modifies xtime_nsec to ensure monotonicity when mult changes:
xtime_nsec -= offset
This ensures that the time reported to userspace does not jump when the multiplier is adjusted from one tick to the next. However, the ntp_error accumulator which tracks the difference between intended and actual clock position was not being updated to reflect this additional discrepancy.
An earlier attempt at this compensation existed as:
ntp_error -= (interval - offset) << ntp_error_shift
but was removed in commit c2cda2a5bda9 ("timekeeping/ntp: Don't align NTP frequency adjustments to ticks") because it was a major source of NTP error. That's because (interval - offset) was wrong: the subtraction of "interval" prematurely accounted for the changed xtime_interval of the next tick, which would be correctly accounted in the next accumulation anyway — a double subtraction.
What is actually needed is just the "offset" part: ntp_error must be told that xtime_nsec moved by "offset" without a corresponding change in the intended position. For the normal ±1 mult dithering this is negligible (the adjustments cancel over time), but for larger mult changes — such as when an external reference clock sets a new frequency — the one-time uncompensated offset is significant.
Fix by adjusting ntp_error by the correct amount:
ntp_error += offset << ntp_error_shift
This keeps ntp_error consistent with the actual xtime_nsec position after the adjustment, and ensures the discrepancy is correctly smoothed away over time and the clock returns to where it should have been.
--- kernel/time/timekeeping.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/time/timekeeping.c +6 -0
@@ -2390,6 +2390,11 @@ static __always_inline void timekeeping_apply_adjustment(struct timekeeper *tk,* xtime_nsec_2 = xtime_nsec_1 - offset * Which simplifies to: * xtime_nsec -= offset +* +* When subtracting offset from xtime_nsec, the same amount +* (in appropriate units) has to be added to ntp_error, in +* order to correctly track the delta between the time +* reported in xtime_nsec, and the intended time. */ if ((mult_adj >0 ) && (tk->tkr_mono.mult + mult_adj < mult_adj)) {/* NTP adjustment caused clocksource mult overflow */
@@ -2400,6 +2405,7 @@ static __always_inline void timekeeping_apply_adjustment(struct timekeeper *tk, tk->tkr_mono.mult += mult_adj; tk->xtime_interval += interval; tk->tkr_mono.xtime_nsec -= offset; + tk->ntp_error += offset << tk->ntp_error_shift; }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 253/1815 arm64: dts: qcom: Add #{address,size}-cells to Chromium-based /firmware
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <[email protected]>
[ Upstream commit 2a906f0b4f037b3fe5f790a48f88549a86288fdf ]
Chromium/Depthcharge bootloaders may dynamically add a few device nodes to a system's DTB under a /firmware node. A typical DT looks something like the following:
/ {
firmware {
ranges;
coreboot {
compatible = "coreboot";
reg = <...>;
...;
};
};
};Notably, the /firmware node has an empty 'ranges', but does not have address/size-cells.
Commit 6e5773d52f4a ("of/address: Fix WARN when attempting translating non-translatable addresses") started requiring #address-cells for a device's parent if we want to use the reg resource in a device node. This leads to errors like the following:
[ 7.763870] coreboot_table firmware:coreboot: probe with driver coreboot_table failed with error -22
Add appropriate #{address,size}-cells to work around the problem.
Note that Google has also patched the Depthcharge bootloader source to add {address,size}-cells [1], but bootloader updates are typically delivered only via Google OS updates. Not all users install Google software updates, and even if they do, Google may not produce updated binaries for all/older devices.
[1] https://lore.kernel.org/all/[email protected]/
https://crrev.com/c/6051580 ("coreboot: Insert #address-cells and #size-cells for firmware node")
--- arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 5 +++++ arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi | 5 +++++ 2 files changed, 10 insertions(+)
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +5 -0
@@ -99,6 +99,11 @@ chosen { stdout-path = "serial0:115200n8"; }; + firmware { + #address-cells = <2>; + #size-cells = <2>; + }; + /* FIXED REGULATORS - parents above children */ /* This is the top level supply and variable voltage */
arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi +5 -0
@@ -25,6 +25,11 @@ chosen { stdout-path = "serial0:115200n8"; }; + firmware { + #address-cells = <2>; + #size-cells = <2>; + }; + /* * FIXED REGULATORS *
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 254/1815 clk: qcom: gdsc: propagate gdsc_check_status() errors from gdsc_poll_status
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herman van Hazendonk <[email protected]>
[ Upstream commit d69f0c2b8d292b4890c9f0fbe184dfc26c4de86c ]
gdsc_check_status() returns negative errno when the underlying regmap_read() fails -- e.g. when a parent regmap dies during system suspend, a CSR is removed by an HW debug tool, or the bus controller goes into protection. gdsc_poll_status() treats the result as a plain boolean ("is the GDSC in the requested state?"), so any negative error return is truncated to "true" and the poll exits with success even though the rail's real state is unknown:
do {
if (gdsc_check_status(sc, status))
return 0;
} while (ktime_us_delta(ktime_get(), start) < STATUS_POLL_TIMEOUT_US);
if (gdsc_check_status(sc, status))
return 0;
return -ETIMEDOUT;This silently misleads gdsc_toggle_logic() (which writes/un-writes SW_COLLAPSE on the strength of the poll succeeding) and the gdsc_init() sync path (which assumes the readback represents real silicon state).
Latch the return value, propagate negative errno immediately, and only treat a strictly-positive value as "reached the target state". Make the same change in the post-timeout final check so a regmap that comes back after the deadline does not silently degrade to -ETIMEDOUT.
--- drivers/clk/qcom/gdsc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/clk/qcom/gdsc.c +9 -2
@@ -104,14 +104,21 @@ static int gdsc_hwctrl(struct gdsc *sc, bool en)static int gdsc_poll_status (struct gdsc *sc,enum gdsc_status status) {ktime_t start; +int ret; start =ktime_get ();do { -if (gdsc_check_status (sc, status)) + ret =gdsc_check_status (sc, status); +if (ret <0 ) +return ret; +if (ret)return 0 ; }while (ktime_us_delta (ktime_get (), start) <STATUS_POLL_TIMEOUT_US ); -if (gdsc_check_status (sc, status)) + ret =gdsc_check_status (sc, status); +if (ret <0 ) +return ret; +if (ret)return 0 ;return -ETIMEDOUT ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 255/1815 clk: qcom: gdsc: propagate gdsc_enable() failure for ALWAYS_ON domains
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herman van Hazendonk <[email protected]>
[ Upstream commit eea55fc694e132aacbe2cf4be7f345115e3d1801 ]
GENPD_FLAG_ALWAYS_ON requires the underlying domain to be on at genpd_init() time -- the framework will refuse to register the domain otherwise. When the cold readback in gdsc_init() finds an ALWAYS_ON GDSC powered down, the driver tries to bring it back up:
} else if (sc->flags & ALWAYS_ON) {
/* If ALWAYS_ON GDSCs are not ON, turn them ON */
gdsc_enable(&sc->pd);
on = true;
}but discards the return value: if gdsc_enable() fails (regmap write error, the long-form sequence's status poll times out, or the HW_CTRL hand-off errors) the code still sets on=true and falls through to pm_genpd_init(..., !on) -- which then registers the domain in the ON state and sets GENPD_FLAG_ALWAYS_ON, even though the silicon is actually off. Subsequent consumer probes will see genpd report "on" while accessing dead registers and hang or read garbage.
Catch the failure and surface it: returning the error from gdsc_init() makes the provider probe fail with the underlying errno, which propagates to consumers as -EPROBE_DEFER (or fatal if the hardware really is broken) rather than silently lying about the rail state.
--- drivers/clk/qcom/gdsc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/qcom/gdsc.c +3 -1
@@ -500,7 +500,9 @@ static int gdsc_init(struct gdsc *sc) }else if (sc->flags &ALWAYS_ON ) {/* If ALWAYS_ON GDSCs are not ON, turn them ON */ -gdsc_enable (&sc->pd); + ret =gdsc_enable (&sc->pd); +if (ret) +return ret; on = true; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 256/1815 clk: qcom: gdsc: tear down per-domain genpds in gdsc_unregister()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herman van Hazendonk <[email protected]>
[ Upstream commit 86b23609d5e17a770d03037e53c6a443e742a6e6 ]
gdsc_unregister() removes the OF provider entry and tears down the parent/subdomain wiring, but never calls pm_genpd_remove() on the individual generic_pm_domain structures registered by gdsc_init():
void gdsc_unregister(struct gdsc_desc *desc)
{
struct device *dev = desc->dev;
size_t num = desc->num;
gdsc_pm_subdomain_remove(desc, num);
of_genpd_del_provider(dev->of_node);
}That leaves dangling entries on the global gpd_list. After a provider unbind/rebind cycle (deferred-probe replay during early boot, real module unload of a clk driver that owns GDSCs, or an OF-overlay tear- down) the next gdsc_init() will end up trying to re-register a name that is still in the list and pm_genpd_init() returns -EEXIST.
While we are here, flip the order so the consumer-facing OF provider entry is the first thing removed -- otherwise a fresh of_genpd_get_from_provider() call racing with the teardown could attach to a domain that is mid-removal.
Iterate the scs[] array and pm_genpd_remove() each registered domain after the subdomain links are torn down. The regulators stay devm- managed (devm_regulator_get_optional() in gdsc_register()), so the release happens automatically when the underlying device is unbound; just the genpd accounting needs to be undone explicitly.
--- drivers/clk/qcom/gdsc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/clk/qcom/gdsc.c +9 -1
@@ -678,10 +678,18 @@ int gdsc_register(struct gdsc_desc *desc,void gdsc_unregister (struct gdsc_desc *desc) {struct device *dev = desc->dev; +struct gdsc **scs = desc->scs;size_t num = desc->num; +int i; -gdsc_pm_subdomain_remove (desc, num);of_genpd_del_provider (dev->of_node); +gdsc_pm_subdomain_remove (desc, num); + +for (i =0 ; i < num; i++) { +if (!scs[i]) +continue ; +pm_genpd_remove (&scs[i]->pd); + } }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 257/1815 arm64: dts: qcom: sc8280xp-arcata: Fix top USB-C DP alt mode
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérôme de Bretagne <[email protected]>
[ Upstream commit 16065c4ec1e7ca595f4fa363dc2251c6bdf1f6b3 ]
The top USB-C port (usb0) didn't switch to DP alt mode, as reusing the same GPIO 101 as on the SC8280XP CRD or Lenovo ThinkPad X13s was not working on the Surface Pro 9 5G.
Investigation [1] by Jens on the Windows Dev Kit (WDK2023), the other sc8280xp-based "blackrock" model from Microsoft, found a reference to GPIO 100 in the DSDT in addition to 101. Switching to GPIO 100 fixed the issue on blackrock, as it does on arcata to enable external screen when using the left-side top USB-C port.
[1] https://lore.kernel.org/all/20250609-blackrock-usb0-mux-v1-1-7903c3b071e4@oldschoolsolutions.biz/
--- arch/arm64/boot/dts/qcom/sc8280xp-microsoft-arcata.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp-microsoft-arcata.dts +2 -2
@@ -243,7 +243,7 @@ map1 { usb0-sbu-mux { compatible = "pericom,pi3usb102", "gpio-sbu-mux"; - enable-gpios = <&tlmm 101 GPIO_ACTIVE_LOW>; + enable-gpios = <&tlmm 100 GPIO_ACTIVE_LOW>; select-gpios = <&tlmm 164 GPIO_ACTIVE_HIGH>; pinctrl-0 = <&usb0_sbu_default>;
@@ -996,7 +996,7 @@ tx-pins { usb0_sbu_default: usb0-sbu-state { oe-n-pins { - pins = "gpio101"; + pins = "gpio100"; function = "gpio"; bias-disable; drive-strength = <16>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 258/1815 arm64: dts: qcom: sm6125-xiaomi-laurel-sprout: Fixup panel compatible
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yedaya Katsman <[email protected]>
[ Upstream commit f135fd1bc76d052f1bf4b1cc987cd47fe0a71d8a ]
The change to the panel compatible was missed, fix it. This compatible is already in the driver.
--- arch/arm64/boot/dts/qcom/sm6125-xiaomi-laurel-sprout.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm6125-xiaomi-laurel-sprout.dts +1 -1
@@ -198,7 +198,7 @@ &mdss_dsi0 { status = "okay"; panel@0 { - compatible = "samsung,s6e8fco-m1906f9"; + compatible = "samsung,s6e8fc0-m1906f9"; reg = <0>; reset-gpios = <&tlmm 90 GPIO_ACTIVE_LOW>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 259/1815 arm64: dts: qcom: sdm670-google: add lpi reserved gpios
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Acayan <[email protected]>
[ Upstream commit 71dd62dac8e2d03f952587f8985a859fce422815 ]
Add reserved GPIOs for the Pixel 3a, which blocks access to the sensor GPIOs. The hunk in the original patch was dropped in the commit because it depended on an unapplied patch, which is now commit fe9f4a46895d ("arm64: dts: qcom: sdm670-google: add common device tree include").
--- arch/arm64/boot/dts/qcom/sdm670-google-common.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/qcom/sdm670-google-common.dtsi +5 -0
@@ -522,6 +522,11 @@ rmi4_f12: rmi4-f12@12 { }; }; +&lpi_tlmm { + /* sensor gpios are protected */ + gpio-reserved-ranges = <0 8>, <12 6>; +}; + &mdss { status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 260/1815 arm64: dts: qcom: sc8180x-primus: Rename regulator nodes
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit ae51d9396f9318189e91578878409d8ada152edb ]
The nodes would be sorted correctly, if their names started with "regulator-" (which is the style used in the latest submissions). Touch that up.
Stable-dep-of: 80bf2eb87bfb ("arm64: dts: qcom: sc8180x-primus: Describe the display power net")
--- arch/arm64/boot/dts/qcom/sc8180x-primus.dts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sc8180x-primus.dts +4 -4
@@ -167,7 +167,7 @@ reserved-region@9a500000 { }; }; - vreg_nvme_0p9: nvme-0p9-regulator { + vreg_nvme_0p9: regulator-nvme-0p9 { compatible = "regulator-fixed"; regulator-name = "vreg_nvme_0p9";
@@ -177,7 +177,7 @@ vreg_nvme_0p9: nvme-0p9-regulator { regulator-always-on; }; - vreg_nvme_3p3: nvme-3p3-regulator { + vreg_nvme_3p3: regulator-nvme-3p3 { compatible = "regulator-fixed"; regulator-name = "vreg_nvme_3p3";
@@ -190,7 +190,7 @@ vreg_nvme_3p3: nvme-3p3-regulator { regulator-always-on; }; - vdd_kb_tp_3v3: vdd-kb-tp-3v3-regulator { + vdd_kb_tp_3v3: regulator-vdd-kb-tp-3v3 { compatible = "regulator-fixed"; regulator-name = "vdd_kb_tp_3v3"; regulator-min-microvolt = <3300000>;
@@ -205,7 +205,7 @@ vdd_kb_tp_3v3: vdd-kb-tp-3v3-regulator { pinctrl-0 = <&kb_tp_3v3_en_active_state>; }; - vph_pwr: vph-pwr-regulator { + vph_pwr: regulator-vph-pwr { compatible = "regulator-fixed"; regulator-name = "vph_pwr"; regulator-min-microvolt = <3700000>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 261/1815 arm64: dts: qcom: sc8180x-primus: Describe the display power net
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 80bf2eb87bfbf1b7bc7b12228cbcc710b0a26275 ]
Describe and wire up the power supplies for the eDP panel and its backlight. Previously, this was only working because of settings inherited from the bootloader.
--- arch/arm64/boot/dts/qcom/sc8180x-primus.dts | 48 ++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc8180x-primus.dts +47 -1
@@ -29,9 +29,10 @@ backlight: backlight { compatible = "pwm-backlight"; pwms = <&pmc8180c_lpg 4 1000000>; enable-gpios = <&pmc8180c_gpios 8 GPIO_ACTIVE_HIGH>; + power-supply = <&vled_bl_pw>; - pinctrl-names = "default"; pinctrl-0 = <&bl_pwm_default>; + pinctrl-names = "default"; }; chosen {
@@ -167,6 +168,38 @@ reserved-region@9a500000 { }; }; + vled_bl_pw: regulator-vled-bl-pw { + compatible = "regulator-fixed"; + + regulator-name = "VLED_BL_PW"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&pmc8180_2_gpios 1 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&bl_pwr_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_lcm_3v3: regulator-edp-3p3 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_LCM_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&tlmm 130 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&lcm_3v3_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + vreg_nvme_0p9: regulator-nvme-0p9 { compatible = "regulator-fixed"; regulator-name = "vreg_nvme_0p9";
@@ -540,6 +573,7 @@ &mdss_edp { aux-bus { panel { compatible = "edp-panel"; + power-supply = <&vreg_lcm_3v3>; backlight = <&backlight>;
@@ -769,6 +803,12 @@ &wifi { }; /* PINCTRL */ +&pmc8180_2_gpios { + bl_pwr_en: bl-pwr-en-state { + pins = "gpio1"; + function = "normal"; + }; +}; &pmc8180c_gpios { bl_pwm_default: bl-pwm-default-state {
@@ -950,4 +990,10 @@ rx-pins { bias-pull-up; }; }; + + lcm_3v3_en: lcm-3v3-en-state { + pins = "gpio130"; + function = "gpio"; + bias-disable; + }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 262/1815 arm64: dts: qcom: sc8180x-lenovo-flex-5g: Rename regulator nodes
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 0b1c6d2a65fc41aa0d5f6617dd04043384678d61 ]
Align with the contemporary way of naming regulator nodes (regulator- prefix) in preparation for adding more of them.
Reorder the renamed entries to match the expectations of the DT coding style doc.
Stable-dep-of: d5f5c089858f ("arm64: dts: qcom: sc8180x-lenovo-flex-5g: Describe the display power net")
--- .../boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts +8 -8
@@ -157,14 +157,7 @@ cdsp_mem: cdsp-region@98900000 { }; }; - vph_pwr: vph-pwr-regulator { - compatible = "regulator-fixed"; - regulator-name = "vph_pwr"; - regulator-min-microvolt = <3700000>; - regulator-max-microvolt = <3700000>; - }; - - vreg_s4a_1p8: pm8150-s4-regulator { + vreg_s4a_1p8: regulator-pm8150-s4 { compatible = "regulator-fixed"; regulator-name = "vreg_s4a_1p8";
@@ -177,6 +170,13 @@ vreg_s4a_1p8: pm8150-s4-regulator { vin-supply = <&vph_pwr>; }; + vph_pwr: regulator-vph-pwr { + compatible = "regulator-fixed"; + regulator-name = "vph_pwr"; + regulator-min-microvolt = <3700000>; + regulator-max-microvolt = <3700000>; + }; + usbprim-sbu-mux { compatible = "pericom,pi3usb102", "gpio-sbu-mux";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 263/1815 arm64: dts: qcom: sc8180x-lenovo-flex-5g: Describe the display power net
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit d5f5c089858f7accd1e4574c0c09d811e90eb51f ]
Describe and wire up the power supplies for the eDP panel and its backlight. Previously, this was only working because of settings inherited from the bootloader.
--- .../boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+)
arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts +47 -0
@@ -26,6 +26,7 @@ backlight: backlight { compatible = "pwm-backlight"; pwms = <&pmc8180c_lpg 4 1000000>; enable-gpios = <&pmc8180c_gpios 8 GPIO_ACTIVE_HIGH>; + power-supply = <&vled_bl_pw>; pinctrl-0 = <&bl_pwm_default>; pinctrl-names = "default";
@@ -157,6 +158,38 @@ cdsp_mem: cdsp-region@98900000 { }; }; + vled_bl_pw: regulator-vled-bl-pw { + compatible = "regulator-fixed"; + + regulator-name = "VLED_BL_PW"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&pmc8180_2_gpios 1 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&bl_pwr_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_lcm_3v3: regulator-edp-3p3 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_LCM_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&tlmm 130 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&lcm_3v3_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + vreg_s4a_1p8: regulator-pm8150-s4 { compatible = "regulator-fixed"; regulator-name = "vreg_s4a_1p8";
@@ -438,6 +471,7 @@ &mdss_edp { aux-bus { panel { compatible = "edp-panel"; + power-supply = <&vreg_lcm_3v3>; no-hpd; backlight = <&backlight>;
@@ -472,6 +506,13 @@ &pcie3_phy { status = "okay"; }; +&pmc8180_2_gpios { + bl_pwr_en: bl-pwr-en-state { + pins = "gpio1"; + function = "normal"; + }; +}; + &pmc8180_pwrkey { status = "okay"; };
@@ -765,6 +806,12 @@ ts_int_default: ts-int-default-state { drive-strength = <2>; }; + lcm_3v3_en: lcm-3v3-en-state { + pins = "gpio130"; + function = "gpio"; + bias-disable; + }; + usbprim_sbu_default: usbprim-sbu-state { oe-n-pins { pins = "gpio152";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 264/1815 clk: qcom: gcc-qcs8300: Use retention for PCIe power domains
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Loic Poulain <[email protected]>
[ Upstream commit 11b170abe4d324cac0d15a410282d1ec2b6bafa0 ]
As the PCIe host controller driver does not yet support dealing with the loss of state during suspend, use retention for relevant GDSCs.
Fix the PCIe link not surviving upon resume, and GDSC error:
gcc_pcie_0_gdsc status stuck at 'off'
--- drivers/clk/qcom/gcc-qcs8300.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/gcc-qcs8300.c +2 -2
@@ -3267,7 +3267,7 @@ static struct gdsc gcc_pcie_0_gdsc = { .pd = { .name = "gcc_pcie_0_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = VOTABLE | RETAIN_FF_ENABLE | POLL_CFG_GDSCR, };
@@ -3281,7 +3281,7 @@ static struct gdsc gcc_pcie_1_gdsc = { .pd = { .name = "gcc_pcie_1_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = VOTABLE | RETAIN_FF_ENABLE | POLL_CFG_GDSCR, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 265/1815 clk: qcom: gcc-qcs8300: Use retention for USB power domains
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Loic Poulain <[email protected]>
[ Upstream commit d8638610e0c9ebab2800b7ad6c2c2a3737090da9 ]
The USB subsystem does not expect to lose its state on suspend:
xhci-hcd xhci-hcd.1.auto: xHC error in resume, USBSTS 0x401, Reinit usb usb1: root hub lost power or was reset
To maintain state during suspend, the relevant GDSCs need to stay in retention mode, like they do on other similar SoCs. Change the mode to PWRSTS_RET_ON to fix.
--- drivers/clk/qcom/gcc-qcs8300.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/gcc-qcs8300.c +2 -2
@@ -3305,7 +3305,7 @@ static struct gdsc gcc_usb20_prim_gdsc = { .pd = { .name = "gcc_usb20_prim_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = RETAIN_FF_ENABLE | POLL_CFG_GDSCR, };
@@ -3317,7 +3317,7 @@ static struct gdsc gcc_usb30_prim_gdsc = { .pd = { .name = "gcc_usb30_prim_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = RETAIN_FF_ENABLE | POLL_CFG_GDSCR, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 266/1815 perf record: fix poll storm when monitored threads exit
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawei Sun <[email protected]>
[ Upstream commit f94563fac26912ef5a51fd16ae1d83f17b24b19d ]
When perf record samples a multi-threaded process and one of the target threads exits during the session, perf itself may start burning 100% CPU (up to 200% across two cores) until the session ends. A single dead fd is sufficient to trigger this; it can be reproduced with 15 pthreads in a compute loop where one thread exits halfway through.
The root cause is two independent instances of the same defect: dead perf_event ring-buffer fds are left in a pollfd array. When a monitored thread exits, the kernel closes its ring-buffer fd, which then returns POLLHUP. POSIX specifies that poll() always reports POLLHUP and POLLERR regardless of the events mask, so any dead fd left in the array makes poll() return immediately every time, spinning in a tight loop:
3 seconds: 256,600 poll() calls, 0 context switches, only 21 write() Woken up count goes from ~0 to 1,300,000+
There are two affected poll paths, fixed together here:
1. Record main loop, via fdarray__filter() (tools/lib/api/fd/array.c). Since commit 59b4412f27f1 ("libperf: Avoid internal moving of fdarray fds") it only zeroes events/revents without setting fd to -1, so poll() keeps reporting POLLHUP for the entry. Setting fd = -1 makes poll() skip it, matching the pattern already used in the control-fd path at tools/perf/builtin-record.c:1673.
2. BPF sideband thread, perf_evlist__poll_thread() (tools/perf/util/sideband_evlist.c). This thread polls for PERF_RECORD_BPF_EVENT but, unlike the main record loop, never calls fdarray__filter() at all, so dead fds accumulate forever and it spins at 100% CPU:
Before fix: dJiffies=101, wchan=0 (running)
After fix: dJiffies=0, wchan=do_sys_poll (blocking)
Fixed by calling the existing evlist__filter_pollfd() helper after evlist__poll(), mirroring the main record loop. <poll.h> is included for the POLLERR/POLLHUP macros (previously unused there).
The two fixes compose: fix 1 makes poll() ignore dead fds (fd=-1); fix 2 ensures the sideband thread actually performs the filtering. Both paths are affected in all kernels from v5.1/v5.9 to the current master (7.2-rc1); the source of both functions is byte-identical across them.
BPF event recording is preserved: after the fix, perf.data still contains PERF_RECORD_BPF_EVENT records and bpf_prog_info entries.
Verified on perf 6.1.76, 6.6.143 and 7.2-rc1 with a minimal reproducer (Woken up 1,300,000 -> 3, CPU 100% -> 0%) and an A/B orthogonal test:
keeping the unpatched binary but preventing the target thread from exiting also makes the storm disappear, confirming the trigger.
--- tools/lib/api/fd/array.c | 6 ++++++ tools/perf/util/sideband_evlist.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+)
tools/lib/api/fd/array.c +6 -0
@@ -122,6 +122,12 @@ int fdarray__filter(struct fdarray *fda, short revents,if (entry_destructor)entry_destructor (fda, fd, arg); +/* +* Set fd to -1 so poll() ignores this entry; otherwise +* POLLHUP/POLLERR are still reported for events=0 fds +* (POSIX: always checked), causing a poll storm. +*/ + fda->entries[fd].fd =-1 ; fda->entries[fd].revents = fda->entries[fd].events =0 ;continue ; }
tools/perf/util/sideband_evlist.c +14 -0
@@ -8,6 +8,7 @@#include <perf/mmap.h> #include <linux/perf_event.h> #include <limits.h> +#include <poll.h> #include <pthread.h> #include <sched.h> #include <stdbool.h>
@@ -55,6 +56,19 @@ static void *perf_evlist__poll_thread(void *arg)if (!draining)evlist__poll (evlist,1000 ); +/* +* When a thread of the monitored target exits, its per-cpu +* ring-buffer fd is closed and starts returning POLLHUP. Such +* dead fds are never requested for POLLIN, but poll() reports +* POLLHUP/POLLERR unconditionally, so leaving them in the +* pollfd array makes the following evlist__poll() return +* immediately forever, spinning this thread at 100% CPU. +* +* Filter them out here, mirroring what the 'perf record' main +* loop does after fdarray__poll(). +*/ +evlist__filter_pollfd (evlist,POLLERR |POLLHUP ); +for (i =0 ; i <evlist__core (evlist)->nr_mmaps; i++) {struct mmap *map = &evlist__mmap (evlist)[i];union perf_event *event;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 267/1815 perf data convert json: Fix trace_seq memory leak in process_sample_event()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tanushree Shah <[email protected]>
[ Upstream commit dcb87c88952046ef43cb5ba3a5b95eb29c362a16 ]
Unlike the in-kernel trace_seq which uses a statically allocated buffer, the userspace traceevent library's trace_seq uses a dynamically allocated one. Therefore, every trace_seq_init() call must be paired with a trace_seq_destroy(), otherwise it produces a memory leak.
In process_sample_event(), a trace_seq is initialized for each field when formatting tracepoint raw_data, but the matching trace_seq_destroy() is never called, leaking memory for every field of every sample processed.
Add the missing trace_seq_destroy() after using the trace_seq buffer to properly free the allocated memory.
Detected with Valgrind on a perf.data file with 2,729 tracepoint samples:
Before: definitely lost: 55,537,664 bytes in 13,559 blocks
After: definitely lost: 0 bytes in 0 blocks
--- tools/perf/util/data-convert-json.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/data-convert-json.c +1 -0
@@ -258,6 +258,7 @@ static int process_sample_event(const struct perf_tool *tool,trace_seq_init (&s);tep_print_field (&s, sample->raw_data, fields[i]);output_json_key_string (out, true,3 , fields[i]->name, s.buffer); +trace_seq_destroy (&s); i++; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 268/1815 bpf: Reject writes through untrusted BTF pointers
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Dudar <[email protected]>
[ Upstream commit ac65c710cc643cbc52b899627577357867249530 ]
check_ptr_to_btf_access() lets program-type btf_struct_access callbacks validate writes before the default BTF access path rejects non-read accesses. That bypasses the read-only policy for untrusted BTF pointers created by helpers such as bpf_rdonly_cast().
Reject non-read accesses through PTR_UNTRUSTED BTF pointers at the common entry point, before the callback branch to handle all cases.
--- kernel/bpf/verifier.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +6 -2
@@ -5790,6 +5790,11 @@ static int check_ptr_to_btf_access(struct bpf_verifier_env *env,return -EACCES ; } +if (atype !=BPF_READ && (type_flag (reg->type) &PTR_UNTRUSTED )) { +verbose (env,"only read is supported\n" ); +return -EACCES ; + } +if (env->ops->btf_struct_access && !type_is_alloc (reg->type) && atype ==BPF_WRITE ) {if (!btf_is_kernel (reg->btf)) {verifier_bug (env,"reg->btf must be kernel btf" );
@@ -5802,8 +5807,7 @@ static int check_ptr_to_btf_access(struct bpf_verifier_env *env, reg_arg_name(env, argno), tname, off, size); }else {/* Writes are permitted with default btf_struct_access for -* program allocated objects (which always have id > 0), -* but not for untrusted PTR_TO_BTF_ID | MEM_ALLOC. +* program allocated objects (which always have id > 0). */ if (atype !=BPF_READ && !type_is_ptr_alloc_obj (reg->type)) {verbose (env,"only read is supported\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 269/1815 staging: media: ipu7: fix pm_runtime refcount leak in ipu7_init_fw_code_region_by_sys()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidhu Sarwal <[email protected]>
[ Upstream commit 843644e1c3347670498d247d7cd20dff1569181c ]
ipu7_init_fw_code_region_by_sys() calls pm_runtime_get_sync() before accessing the firmware code region. If resuming the device fails, pm_runtime_get_sync() leaves the runtime PM usage count incremented, but the error path returns without dropping the reference.
Use pm_runtime_resume_and_get() instead, which balances the usage count automatically on failure and avoids the leak.
The ipu6 driver uses pm_runtime_resume_and_get() in the equivalent location.
--- drivers/staging/media/ipu7/ipu7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu7/ipu7.c +1 -1
@@ -2343,7 +2343,7 @@ static int ipu7_init_fw_code_region_by_sys(struct ipu7_bus_device *sys,return ret; } - ret =pm_runtime_get_sync (dev); + ret =pm_runtime_resume_and_get (dev);if (ret <0 ) {dev_err (dev,"Failed to get runtime PM\n" );return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 270/1815 staging: media: ipu7: fix pm_runtime refcount leak in ipu7_resume()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidhu Sarwal <[email protected]>
[ Upstream commit b298b80814dd0fc3cb1c8c0e0082fc14fdb5fecf ]
ipu7_resume() calls pm_runtime_get_sync() before resuming the device. If the runtime PM resume fails, the usage count remains incremented, but the error path returns without dropping the reference.
Use pm_runtime_resume_and_get() instead, which balances the usage count on failure and avoids the leak. Keep returning 0 on error, as resume callbacks should not propagate failures to the PM core, matching the behaviour of the ipu6 driver.
--- drivers/staging/media/ipu7/ipu7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu7/ipu7.c +1 -1
@@ -2702,7 +2702,7 @@ static int ipu7_resume(struct device *dev)if (ret)dev_err (dev,"IPC reset protocol failed!\n" ); - ret =pm_runtime_get_sync (&isp->psys->auxdev.dev); + ret =pm_runtime_resume_and_get (&isp->psys->auxdev.dev);if (ret <0 ) {dev_err (dev,"Failed to get runtime PM\n" );return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 271/1815 thermal/drivers/rcar: Fix error checking in probe()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit dd04ad1cdabcad51e34b74b4e91b9aeb7180d05d ]
This code accidentally calls thermal_zone_device_enable() before checking whether thermal_zone_device_register_with_trips() failed. Move the call until later to avoid an error pointer dereference of "priv->zone".
The driver works differently depending on if we are using OF thermal or not. We use thermal_add_hwmon_sysfs() if we are using OF thermal and call thermal_zone_device_enable() if not. We can share same error check for if either of these fail.
Moving the thermal_zone_device_enable() call is a bit cleaner as well. The original code used a three step process to cleanup:
1. Call thermal_zone_device_unregister() to cleanup.
2. Set priv->zone to an error pointer to preserve the error code.
3. Set priv->zone to NULL to avoid a second call to thermal_zone_device_unregister() in the rcar_thermal_remove() function.
Now we can just do a direct goto error_unregister and rcar_thermal_remove() handles the cleanup properly.
--- drivers/thermal/renesas/rcar_thermal.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/thermal/renesas/rcar_thermal.c +5 -10
@@ -492,12 +492,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)"rcar_thermal" , trips,ARRAY_SIZE (trips), priv, &rcar_thermal_zone_ops,NULL ,0 , idle); - - ret =thermal_zone_device_enable (priv->zone); -if (ret) { -thermal_zone_device_unregister (priv->zone); - priv->zone =ERR_PTR (ret); - } }if (IS_ERR (priv->zone)) {dev_err (dev,"can't register thermal zone\n" );
@@ -506,11 +500,12 @@ static int rcar_thermal_probe(struct platform_device *pdev) goto error_unregister; } -if (chip->use_of_thermal) { +if (chip->use_of_thermal) ret =thermal_add_hwmon_sysfs (priv->zone); -if (ret) - goto error_unregister; - } +else + ret =thermal_zone_device_enable (priv->zone); +if (ret) + goto error_unregister;rcar_thermal_irq_enable (priv);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 272/1815 usb: typec: ucsi: unregister debugfs entries on teardown
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Andersson <[email protected]>
[ Upstream commit eed73a65ab609b79d53de88cccc34b36dfe753c4 ]
ucsi_register() creates per-instance debugfs entries, but ucsi_unregister() keeps them around until ucsi_destroy().
Drivers like ucsi_glink that unregister/register the same UCSI instance across remoteproc restart then try to create an already existing debugfs directory and log:
debugfs: 'pmic_glink.ucsi.0' already exists in 'ucsi'
Unregister debugfs entries as part of ucsi_unregister(), and clear ucsi->debugfs after freeing it so repeated unregister paths remain safe.
--- drivers/usb/typec/ucsi/debugfs.c | 1 + drivers/usb/typec/ucsi/ucsi.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/usb/typec/ucsi/debugfs.c +1 -0
@@ -162,6 +162,7 @@ void ucsi_debugfs_unregister(struct ucsi *ucsi)debugfs_remove_recursive (ucsi->debugfs->dentry);kfree (ucsi->debugfs); + ucsi->debugfs =NULL ; }void ucsi_debugfs_init (void )
drivers/usb/typec/ucsi/ucsi.c +2 -0
@@ -2367,6 +2367,8 @@ void ucsi_unregister(struct ucsi *ucsi)cancel_delayed_work_sync (&ucsi->work);cancel_work_sync (&ucsi->resume_work); +ucsi_debugfs_unregister (ucsi); +/* Disable notifications */ ucsi->ops->async_control (ucsi, cmd);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 273/1815 usb: gadget: r8a66597: avoid double free of ep0_req in probe error path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongyan Xu <[email protected]>
[ Upstream commit 41d541e3718db01668a4cd29815ee4b3b55f76d2 ]
If usb_add_gadget_udc() fails, r8a66597_probe() jumps to err_add_udc and frees ep0_req, then falls through to clean_up2 where ep0_req is freed again when it is non-NULL.
Remove the redundant free from err_add_udc and keep the cleanup in clean_up2 so the request is released exactly once.
Issue found using a prototype static analysis tool and confirmed by code review.
--- drivers/usb/gadget/udc/r8a66597-udc.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/gadget/udc/r8a66597-udc.c +0 -1
@@ -1951,7 +1951,6 @@ static int r8a66597_probe(struct platform_device *pdev)return 0 ; err_add_udc: -r8a66597_free_request (&r8a66597->ep[0 ].ep, r8a66597->ep0_req); clean_up2:if (r8a66597->pdata->on_chip)clk_disable_unprepare (r8a66597->clk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 274/1815 udf: Mark LVID buffer as uptodate before marking it dirty
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Nogikh <[email protected]>
[ Upstream commit fb0601134c7e51728bd098abc6909315de1e5d86 ]
When an I/O error occurs while writing the Logical Volume Integrity Descriptor (LVID) buffer to the block device, the block layer's completion handler (end_buffer_write_sync()) clears the BH_Uptodate flag on the buffer. However, the buffer still contains valid LVID data in memory. If the filesystem is subsequently remounted read-write or synced, udf_open_lvid() or udf_sync_fs() will modify the LVID buffer and call mark_buffer_dirty(). This triggers a spurious WARN_ON_ONCE(!buffer_uptodate(bh)) warning in mark_buffer_dirty() because the buffer is not marked uptodate, even though its in-memory contents are valid and are about to be overwritten.
To prevent this spurious warning, unconditionally set the BH_Uptodate flag before calling mark_buffer_dirty() in udf_open_lvid() and udf_sync_fs(). This acknowledges that the in-memory buffer is valid and matches the workaround previously applied to udf_close_lvid() in commit 853a0c25baf9 ("udf: Mark LVID buffer as uptodate before marking it dirty"). Extending this workaround ensures consistent behavior across all LVID updates.
Buffer I/O error on dev loop0, logical block 128, lost sync page write
------------[ cut here ]------------ !buffer_uptodate(bh) WARNING: fs/buffer.c:1087 at mark_buffer_dirty+0x299/0x410 fs/buffer.c:1087 ... Call Trace: <TASK> udf_open_lvid+0x369/0x5b0 fs/udf/super.c:2078 udf_reconfigure+0x336/0x540 fs/udf/super.c:679 reconfigure_super+0x232/0x8f0 fs/super.c:1080 vfs_cmd_reconfigure fs/fsopen.c:268 [inline] vfs_fsconfig_locked+0x171/0x320 fs/fsopen.c:297 __do_sys_fsconfig fs/fsopen.c:463 [inline] __se_sys_fsconfig+0x6b9/0x810 fs/fsopen.c:350 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94 </TASK>
--- fs/udf/super.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
fs/udf/super.c +14 -9
@@ -2054,6 +2054,17 @@ static int udf_load_vrs(struct super_block *sb, struct udf_options *uopt,return 0 ; } +static void udf_mark_buffer_dirty (struct buffer_head *bh) +{ +/* +* We set buffer uptodate unconditionally here to avoid spurious +* warnings from mark_buffer_dirty() when previous EIO has marked +* the buffer as !uptodate +*/ +set_buffer_uptodate (bh); +mark_buffer_dirty (bh); +} +static void udf_finalize_lvid (struct logicalVolIntegrityDesc *lvid) {struct timespec64 ts;
@@ -2089,7 +2100,7 @@ static void udf_open_lvid(struct super_block *sb)UDF_SET_FLAG (sb,UDF_FLAG_INCONSISTENT );udf_finalize_lvid (lvid); -mark_buffer_dirty (bh); +udf_mark_buffer_dirty (bh); sbi->s_lvid_dirty =0 ;mutex_unlock (&sbi->s_alloc_mutex);/* Make opening of filesystem visible on the media immediately */
@@ -2122,14 +2133,8 @@ static void udf_close_lvid(struct super_block *sb)if (!UDF_QUERY_FLAG (sb,UDF_FLAG_INCONSISTENT )) lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_CLOSE ); -/* -* We set buffer uptodate unconditionally here to avoid spurious -* warnings from mark_buffer_dirty() when previous EIO has marked -* the buffer as !uptodate -*/ -set_buffer_uptodate (bh);udf_finalize_lvid (lvid); -mark_buffer_dirty (bh); +udf_mark_buffer_dirty (bh); sbi->s_lvid_dirty =0 ;mutex_unlock (&sbi->s_alloc_mutex);/* Make closing of filesystem visible on the media immediately */
@@ -2411,7 +2416,7 @@ static int udf_sync_fs(struct super_block *sb, int wait)* Blockdevice will be synced later so we don't have to submit * the buffer for IO */ -mark_buffer_dirty (bh); +udf_mark_buffer_dirty (bh); sbi->s_lvid_dirty =0 ; }mutex_unlock (&sbi->s_alloc_mutex);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 275/1815 bpftool: Check EVP_Digest when computing excl_prog_hash
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 576bcaa1f5c208af0f590c9622247da87b49c05f ]
bpftool_prog_sign() ignores the return value of EVP_Digest(). If the digest computation fails (context allocation failure, or a digest fetch failure under OpenSSL), EVP_Digest() returns 0 and leaves the output buffer untouched, but the function still reports success.
--- tools/bpf/bpftool/sign.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/bpf/bpftool/sign.c +5 -2
@@ -175,8 +175,11 @@ int bpftool_prog_sign(struct bpf_load_and_run_opts *opts) goto cleanup; } -EVP_Digest (opts->insns, opts->insns_sz, opts->excl_prog_hash, - &opts->excl_prog_hash_sz,EVP_sha256 (),NULL ); +if (EVP_Digest (opts->insns, opts->insns_sz, opts->excl_prog_hash, + &opts->excl_prog_hash_sz,EVP_sha256 (),NULL ) !=1 ) { + err = -EIO ; + goto cleanup; + } bd_out =BIO_new (BIO_s_mem ());if (!bd_out) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 276/1815 drm/amdgpu/mes: Fix hung_queue_db_array loop limit for multi-XCC
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geoffrey McRae <[email protected]>
[ Upstream commit 2c256086a363f01f9840a57949506eccf5c990a6 ]
The loop iterated only AMDGPU_MAX_MES_PIPES times, leaving entries uninitialized for multi-XCC GPUs. This causes null pointer dereferences when accessing arrays indexed by XCC ID >= 2. Extend the loop to cover all XCCs (AMDGPU_MAX_MES_PIPES * num_xcc), matching other per-XCC arrays.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +1 -1
@@ -237,7 +237,7 @@ int amdgpu_mes_init(struct amdgpu_device *adev) }if (adev->mes.hung_queue_db_array_size) { -for (i =0 ; i <AMDGPU_MAX_MES_PIPES ; i++) { +for (i =0 ; i <AMDGPU_MAX_MES_PIPES * num_xcc; i++) { r = amdgpu_bo_create_kernel(adev, adev->mes.hung_queue_db_array_size * sizeof(u32), PAGE_SIZE,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 277/1815 perf vendor events amd: Reintroduce deprecated Zen 5 core events
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandipan Das <[email protected]>
[ Upstream commit eda39f98bbc5ce8b7b0be10193d2de38ed59da6c ]
Maintain backward compatibility by reintroducing the events that were previously removed by commit 047979af3bf6 ("perf vendor events amd:
Update Zen 5 core events"). Also set the deprecated flag and update the descriptions to point users to the correct alternative.
--- .../arch/x86/amdzen5/floating-point.json | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+)
tools/perf/pmu-events/arch/x86/amdzen5/floating-point.json +42 -0
@@ -383,6 +383,13 @@ "BriefDescription": "Retired MMX integer VNNI ops.", "UMask": "0x0c" }, + { + "EventName": "sse_avx_ops_retired.mmx_pack", + "EventCode": "0x0b", + "BriefDescription": "This event is deprecated. Refer to new event sse_avx_ops_retired.mmx_vnni", + "Deprecated": "1", + "UMask": "0x0c" + }, { "EventName": "sse_avx_ops_retired.mmx_logical", "EventCode": "0x0b",
@@ -449,6 +456,13 @@ "BriefDescription": "Retired SSE and AVX integer convert or pack ops.", "UMask": "0x80" }, + { + "EventName": "sse_avx_ops_retired.sse_avx_clm", + "EventCode": "0x0b", + "BriefDescription": "This event is deprecated. Refer to new event sse_avx_ops_retired.sse_avx_cvt", + "Deprecated": "1", + "UMask": "0x80" + }, { "EventName": "sse_avx_ops_retired.sse_avx_shift", "EventCode": "0x0b",
@@ -473,6 +487,13 @@ "BriefDescription": "Retired SSE and AVX integer VNNI ops.", "UMask": "0xc0" }, + { + "EventName": "sse_avx_ops_retired.sse_avx_pack", + "EventCode": "0x0b", + "BriefDescription": "This event is deprecated. Refer to new event sse_avx_ops_retired.sse_avx_vnni", + "Deprecated": "1", + "UMask": "0xc0" + }, { "EventName": "sse_avx_ops_retired.sse_avx_logical", "EventCode": "0x0b",
@@ -731,6 +752,13 @@ "BriefDescription": "Retired 128-bit packed integer convert or pack ops.", "UMask": "0x08" }, + { + "EventName": "packed_int_op_type.int128_clm", + "EventCode": "0x0d", + "BriefDescription": "This event is deprecated. Refer to new event packed_int_op_type.int128_cvt", + "Deprecated": "1", + "UMask": "0x08" + }, { "EventName": "packed_int_op_type.int128_shift", "EventCode": "0x0d",
@@ -755,6 +783,13 @@ "BriefDescription": "Retired 128-bit packed integer VNNI ops.", "UMask": "0x0c" }, + { + "EventName": "packed_int_op_type.int128_pack", + "EventCode": "0x0d", + "BriefDescription": "This event is deprecated. Refer to new event packed_int_op_type.int128_vnni", + "Deprecated": "1", + "UMask": "0x0c" + }, { "EventName": "packed_int_op_type.int128_logical", "EventCode": "0x0d",
@@ -845,6 +880,13 @@ "BriefDescription": "Retired 256-bit packed integer VNNI ops.", "UMask": "0xc0" }, + { + "EventName": "packed_int_op_type.int256_pack", + "EventCode": "0x0d", + "BriefDescription": "This event is deprecated. Refer to new event packed_int_op_type.int256_vnni", + "Deprecated": "1", + "UMask": "0xc0" + }, { "EventName": "packed_int_op_type.int256_logical", "EventCode": "0x0d",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 278/1815 perf dso: Fix kallsyms DSO detection with fallback logic
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tanushree Shah <[email protected]>
[ Upstream commit 8c5f60344b07f839267c0c835962e2206143be85 ]
The current kallsyms detection in dso__is_kallsyms() uses the dso_binary_type enum which fixes the issue of kallsyms being cached in the build-id cache for out-of-tree modules.
However, during build-id injection in perf record/inject, dso_binary_type has not been explicitly set yet,so dso__binary_type() returns DSO_BINARY_TYPE__NOT_FOUND instead of DSO_BINARY_TYPE__KALLSYMS for the kernel DSO. The current check then fails to identify it as kallsyms, causing build-id symlinks to not be created in ~/.debug/.build-id/ and perf archive to fail with "Cannot stat" errors.
Steps to reproduce the issue:
1. rm -rf ~/.debug/.build-id
2. perf record sleep 1
3. perf archive
Fix by falling back to matching long_name against the known kallsyms strings explicitly when binary_type is not yet set
(== DSO_BINARY_TYPE__NOT_FOUND). Use strcmp() for exact matching of fixed names and strict validation for guest kallsyms with embedded PID to prevent path traversal attacks.
--- tools/perf/util/dso.h | 57 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-)
tools/perf/util/dso.h +56 -1
@@ -9,6 +9,7 @@#include <stdbool.h> #include <stdio.h> #include <linux/bitops.h> +#include <string.h> #include "build-id.h" #include "debuginfo.h" #include "mutex.h"
@@ -20,6 +21,40 @@ struct perf_env;#define DSO__NAME_KALLSYMS "[kernel.kallsyms]"#define DSO__NAME_KCORE "[kernel.kcore]" +#define DSO__NAME_GUEST_KALLSYMS "[guest.kernel.kallsyms]" +#define DSO__NAME_GUEST_KALLSYMS_PID_PREFIX "[guest.kernel.kallsyms." + +/* +* Validate names of the form "[guest.kernel.kallsyms.<pid>]", where +* <pid> is the PID of the guest VM and varies per guest, so it +* cannot be matched with strcmp() against a fixed string. +* +* Every character after the fixed prefix must be a decimal digit, +* with ']' immediately terminating the digit run and nothing +* following it. This rules out '/', "..", or any other character +* being smuggled into the name. +*/ +static inline bool is_guest_kallsyms_pid_name (const char *name) +{ +const size_t prefix_len =sizeof (DSO__NAME_GUEST_KALLSYMS_PID_PREFIX ) -1 ; +size_t digits; + +if (strncmp (name,DSO__NAME_GUEST_KALLSYMS_PID_PREFIX , prefix_len) !=0 ) +return false; + + digits =strspn (name + prefix_len,"0123456789" ); +if (digits ==0 ) +return false; + +/* ']' must terminate the digit run, with nothing trailing it */ +if (name[prefix_len + digits] !=']' ) +return false; + +if (name[prefix_len + digits +1 ] !='\0' ) +return false; + +return true; +}/** * enum dso_binary_type - The kind of DSO generally associated with a memory
@@ -924,8 +959,28 @@ static inline bool dso__is_kcore(const struct dso *dso)static inline bool dso__is_kallsyms (const struct dso *dso) {enum dso_binary_type bt =dso__binary_type (dso); +const char *name; + +if (bt ==DSO_BINARY_TYPE__KALLSYMS || bt ==DSO_BINARY_TYPE__GUEST_KALLSYMS ) +return true; + +if (bt !=DSO_BINARY_TYPE__NOT_FOUND ) +return false; + +if (!dso__kernel (dso)) +return false; + + name =dso__long_name (dso); +if (!name) +return false; + +if (!strcmp (name,DSO__NAME_KALLSYMS )) +return true; + +if (!strcmp (name,DSO__NAME_GUEST_KALLSYMS )) +return true; -return bt ==DSO_BINARY_TYPE__KALLSYMS || bt ==DSO_BINARY_TYPE__GUEST_KALLSYMS ; +return is_guest_kallsyms_pid_name (name); }bool dso__is_object_file (const struct dso *dso);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 279/1815 bpf: Fix vmlinux BTF prep race in bpf_get_btf_vmlinux
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 92863e678070f57c17c868e4bfa2441a5c61ad2b ]
bpf_get_btf_vmlinux() lazily parses the vmlinux BTF under the bpf_verifier_lock, but publishes the result through a plain store and re-checks it through a plain lockless load. Nothing orders the stores initializing the struct btf inside btf_parse_vmlinux() against the store publishing the pointer: On a weakly ordered arch, a concurrent first-time caller taking the lockless fast path could in principle observe the pointer before the parsed contents are visible. The mutex_unlock() does not help such a reader given it only synchronizes with a later acquisition of the same lock. Thus, publish the pointer with smp_store_release() and read it on the fast path with smp_load_acquire().
Acquire semantics are needed rather than a dependency-ordered READ_ONCE(): btf_parse_vmlinux() also populates globals outside the returned object (e.g. bpf_ctx_convert.t). An address dependency would only order accesses performed through the pointer and not cover other globals.
--- kernel/bpf/verifier.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
kernel/bpf/verifier.c +16 -4
@@ -19490,13 +19490,25 @@ int bpf_check_attach_btf_id_multi(struct btf *btf, struct bpf_prog *prog, u32 btstruct btf *bpf_get_btf_vmlinux (void ) { -if (!btf_vmlinux &&IS_ENABLED (CONFIG_DEBUG_INFO_BTF )) { +/* Pairs with the smp_store_release() on the parse path below. */ +struct btf *btf =smp_load_acquire (&btf_vmlinux); + +if (!btf &&IS_ENABLED (CONFIG_DEBUG_INFO_BTF )) {mutex_lock (&bpf_verifier_lock); -if (!btf_vmlinux) - btf_vmlinux =btf_parse_vmlinux (); + btf = btf_vmlinux; +if (!btf) { + btf =btf_parse_vmlinux (); +/* +* Order the parsed BTF contents and the globals the +* parse populated (e.g. bpf_ctx_convert.t) before +* the pointer publication. Pairs with the acquire +* on the lockless fast path above. +*/ +smp_store_release (&btf_vmlinux, btf); + }mutex_unlock (&bpf_verifier_lock); } -return btf_vmlinux; +return btf; }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 280/1815 efi: fix stale reference to efi_recover_from_page_fault()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 718ee46ba4d95d28d50d3f6437afbbe2be531175 ]
efi_recover_from_page_fault() was renamed to efi_crash_gracefully_on_page_fault(), but the comment above enum efi_rts_ids was not updated. Use the current name.
--- include/linux/efi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/efi.h +2 -2
@@ -1212,8 +1212,8 @@ efi_call_acpi_prm_handler(efi_status_t (__efiapi *handler_addr)(u64, void *),/* * efi_runtime_service() function identifiers. -* "NONE" is used by efi_recover_from_page_fault() to check if the page -* fault happened while executing an efi runtime service. +* "NONE" is used by efi_crash_gracefully_on_page_fault() to check if the +* page fault happened while executing an efi runtime service. */ enum efi_rts_ids {EFI_NONE ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 281/1815 bpf: Fix use-after-free on mm_struct in bpf_find_vma()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sanghyun Park <[email protected]>
[ Upstream commit 47b079e2117a2ee52e21f8b72935900c702fc0b5 ]
bpf_find_vma() reads task->mm and calls mmap_read_trylock(mm) without holding a reference on the mm. On a foreign task, a concurrent exit_mm() can free the mm_struct between the lockless read and the trylock, resulting in a use-after-free. mm_struct is not SLAB_TYPESAFE_BY_RCU.
For the current task, task->mm is stable. For a foreign task, pin the mm under task->alloc_lock and release it with mmput_async(), mirroring commit d8e27d2d22b6 ("bpf: fix mm lifecycle in open-coded task_vma iterator"). Use spin_trylock() instead of get_task_mm() so BPF context does not block on alloc_lock. Reject irqs-disabled contexts and !CONFIG_MMU on the foreign-task path because dropping the mm reference is not safe there.
Race:
CPU0 (BPF program) CPU1 (exiting task)
============================ ==========================
bpf_find_vma(foreign_task):
mm = task->mm
exit_mm():
task->mm = NULL
mmput(mm) -> frees mm_struct
mmap_read_trylock(mm)
// UAF on mm--- kernel/bpf/task_iter.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-)
kernel/bpf/task_iter.c +33 -3
@@ -756,6 +756,7 @@ BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start,struct mmap_unlock_irq_work *work =NULL ;struct vm_area_struct *vma;bool irq_work_busy = false; +bool __maybe_unused mmput_needed = false;struct mm_struct *mm;int ret = -ENOENT ;
@@ -765,14 +766,38 @@ BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start,if (!task)return -ENOENT ; - mm = task->mm; +if (task == current) { + mm = task->mm; + }else { +/* +* Foreign task: pin task->mm against a concurrent exit_mm(). +* Use trylock on alloc_lock instead of get_task_mm()'s +* blocking task_lock() to avoid deadlocking the target task. +*/ +if (!IS_ENABLED (CONFIG_MMU )) +return -EOPNOTSUPP ; +if (irqs_disabled ()) +return -EBUSY ; +if (!spin_trylock (&task->alloc_lock)) +return -EBUSY ; + mm = task->mm; +if (mm && !(task->flags &PF_KTHREAD )) { +mmget (mm); + mmput_needed = true; + }else { + mm =NULL ; + } +spin_unlock (&task->alloc_lock); + }if (!mm)return -ENOENT ; irq_work_busy =bpf_mmap_unlock_get_irq_work (&work); -if (irq_work_busy || !mmap_read_trylock (mm)) -return -EBUSY ; +if (irq_work_busy || !mmap_read_trylock (mm)) { + ret = -EBUSY ; + goto out; + } vma =find_vma (mm, start);
@@ -782,6 +807,11 @@ BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start, ret =0 ; }bpf_mmap_unlock_mm (work, mm); +out: +#ifdef CONFIG_MMU +if (mmput_needed) +mmput_async (mm); +#endif return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 282/1815 bus: mhi: ep: Fix device refcount leak in the error path of MHI device creation
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit 6f12862600bb70e599a614d706a095ea5f8f9858 ]
mhi_ep_create_device() takes one device reference for the UL channel and another for the DL channel after allocating the transfer device. These references are normally released by mhi_ep_destroy_device() before the device itself is removed.
If dev_set_name() or device_add() fails, the error path currently drops only one reference. The remaining channel references keep the device from being released and leave the channels associated with a device that was never registered.
Route both failures through a common unwind path that drops the DL channel reference, the UL channel reference, and the initial reference from device_initialize().
--- drivers/bus/mhi/ep/main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/bus/mhi/ep/main.c +10 -5
@@ -1340,14 +1340,19 @@ static int mhi_ep_create_device(struct mhi_ep_cntrl *mhi_cntrl, u32 ch_id) ret =dev_set_name (&mhi_dev->dev,"%s_%s" ,dev_name (&mhi_cntrl->mhi_dev->dev), mhi_dev->name); -if (ret) { -put_device (&mhi_dev->dev); -return ret; - } +if (ret) + goto err_put_channels; ret =device_add (&mhi_dev->dev);if (ret) -put_device (&mhi_dev->dev); + goto err_put_channels; + +return 0 ; + +err_put_channels: +put_device (&mhi_dev->dev);/* DL channel reference */ +put_device (&mhi_dev->dev);/* UL channel reference */ +put_device (&mhi_dev->dev);/* device_initialize() reference */ return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 283/1815 bpf: Introduce jit_required flag and remove bpf_prog_has_kfunc_call()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
[ Upstream commit 9a6df65d5c6a9947ddab4e563e329720f44b8747 ]
Introduce a 'jit_required' bitfield flag in struct bpf_prog to track whether a BPF program strictly requires the JIT compiler to run. This prevents a dangerous runtime fallback to the interpreter for features that are only implemented in the JIT compiler.
Currently, bpf_prog_has_kfunc_call() is used only for kernel function calls, replace the kfunc-specific helper with the new 'jit_required' flag. This makes it easy to support other JIT-only BPF features, such as inlined helpers.
Stable-dep-of: f1c27922576e ("bpf: Reject programs with inlined helpers if JIT is not available")
--- include/linux/bpf.h | 9 ++------- kernel/bpf/core.c | 7 ++----- kernel/bpf/fixups.c | 5 ++--- kernel/bpf/verifier.c | 7 ++----- 4 files changed, 8 insertions(+), 20 deletions(-)
include/linux/bpf.h +2 -7
@@ -1865,8 +1865,9 @@ struct bpf_prog_aux {struct bpf_prog {u16 pages;/* Number of allocated pages */ -u16 jited:1 ,/* Is our filter JIT'ed? */ +u32 jited:1 ,/* Is our filter JIT'ed? */ jit_requested:1 ,/* archs need to JIT the prog */ + jit_required:1 ,/* program strictly requires JIT compiler */ gpl_compatible:1 ,/* Is filter GPL compatible? */ cb_access:1 ,/* Is control block accessed? */ dst_needed:1, /* Do we need dst entry? */
@@ -3170,7 +3171,6 @@ const struct bpf_func_proto *bpf_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog);void bpf_task_storage_free (struct task_struct *task);void bpf_cgrp_storage_free (struct cgroup *cgroup); -bool bpf_prog_has_kfunc_call (const struct bpf_prog *prog);const struct btf_func_model *bpf_jit_find_kfunc_model (const struct bpf_prog *prog,const struct bpf_insn *insn);
@@ -3509,11 +3509,6 @@ static inline void bpf_task_storage_free(struct task_struct *task) { } -static inline bool bpf_prog_has_kfunc_call (const struct bpf_prog *prog) -{ -return false; -} -static inline const struct btf_func_model *bpf_jit_find_kfunc_model (const struct bpf_prog *prog,const struct bpf_insn *insn)
kernel/bpf/core.c +2 -5
@@ -126,6 +126,7 @@ struct bpf_prog *bpf_prog_alloc_no_stats(unsigned int size, gfp_t gfp_extra_flag fp->aux->main_prog_aux = aux; fp->aux->prog = fp; fp->jit_requested =ebpf_jit_enabled (); + fp->jit_required =IS_ENABLED (CONFIG_BPF_JIT_ALWAYS_ON ); fp->blinding_requested =bpf_jit_blinding_enabled (fp);#ifdef CONFIG_CGROUP_BPF aux->cgroup_atype =CGROUP_BPF_ATTACH_TYPE_INVALID ;
@@ -2670,15 +2671,11 @@ struct bpf_prog *__bpf_prog_select_runtime(struct bpf_verifier_env *env, struct/* In case of BPF to BPF calls, verifier did all the prep * work with regards to JITing, etc. */ -bool jit_needed = false; +bool jit_needed = fp->jit_required;if (fp->bpf_func) goto finalize; -if (IS_ENABLED (CONFIG_BPF_JIT_ALWAYS_ON ) || -bpf_prog_has_kfunc_call (fp)) - jit_needed = true; -if (!bpf_prog_select_interpreter (fp)) jit_needed = true;
kernel/bpf/fixups.c +2 -3
@@ -1378,7 +1378,6 @@ int bpf_fixup_call_args(struct bpf_verifier_env *env)#ifndef CONFIG_BPF_JIT_ALWAYS_ON struct bpf_prog *prog = env->prog;struct bpf_insn *insn = prog->insnsi; -bool has_kfunc_call =bpf_prog_has_kfunc_call (prog);int depth;#endif int i, err =0 ;
@@ -1404,8 +1403,8 @@ int bpf_fixup_call_args(struct bpf_verifier_env *env)return err; }#ifndef CONFIG_BPF_JIT_ALWAYS_ON -if (has_kfunc_call) { -verbose (env,"calling kernel functions are not allowed in non-JITed programs\n" ); +if (prog->jit_required) { +verbose (env,"program requires BPF JIT compiler but it is not available\n" );return -EINVAL ; }for (i =0 ; i < env->subprog_cnt; i++) {
kernel/bpf/verifier.c +2 -5
@@ -2715,6 +2715,8 @@ int bpf_add_kfunc_call(struct bpf_verifier_env *env, u32 func_id, u16 offset) prog_aux->kfunc_tab = tab; } + env->prog->jit_required =1 ; +/* func_id == 0 is always invalid, but instead of returning an error, be * conservative and wait until the code elimination pass before returning * error, so that invalid calls that get pruned out can be in BPF programs
@@ -2769,11 +2771,6 @@ int bpf_add_kfunc_call(struct bpf_verifier_env *env, u32 func_id, u16 offset)return 0 ; } -bool bpf_prog_has_kfunc_call (const struct bpf_prog *prog) -{ -return !!prog->aux->kfunc_tab; -} -static int add_subprog_and_kfunc (struct bpf_verifier_env *env) {struct bpf_subprog_info *subprog = env->subprog_info;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 284/1815 bpf: Reject programs with inlined helpers if JIT is not available
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
[ Upstream commit f1c27922576edccb99d0257827d09bd05c0304a6 ]
When an architecture (such as LoongArch, ARM64, and RISC-V) implements bpf_jit_inlines_helper_call(), the verifier skips rewriting the helper call offset (insn->imm) in bpf_do_misc_fixups(). This is because the helper is expected to be inlined by the JIT compiler later. Therefore, insn->imm remains as the raw helper enum ID.
However, if JIT is disabled at runtime (net.core.bpf_jit_enable=0) or if JIT compilation fails dynamically (e.g., due to OOM), the program falls back to the BPF interpreter.
When the interpreter executes (__bpf_call_base + insn->imm) with the unpatched raw ID, it jumps into an invalid address space, triggering an instruction alignment fault or a kernel panic.
Although these helpers have valid C implementations in the kernel, the omission of offset rewriting makes runtime interpreter fallback fatal.
Fix this by setting 'prog->jit_required = 1' when helper call rewriting is skipped for JIT inlining. This ensures that such programs are safely rejected if JIT is not available, preventing the runtime kernel panic.
--- kernel/bpf/fixups.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/bpf/fixups.c +3 -1
@@ -1840,8 +1840,10 @@ int bpf_do_misc_fixups(struct bpf_verifier_env *env) }/* Skip inlining the helper call if the JIT does it. */ -if (bpf_jit_inlines_helper_call (insn->imm)) +if (bpf_jit_inlines_helper_call (insn->imm)) { + prog->jit_required =1 ; goto next_insn; + }if (insn->imm == BPF_FUNC_get_route_realm) prog->dst_needed =1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 285/1815 iommu/mediatek-v1: Fix off-by-one in MT2701_LARB_NR_MAX
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akari Tsuyukusa <[email protected]>
[ Upstream commit aebaa93f3da1572877579c2e15ebf27be2dcc7fb ]
The mt2701_m4u_in_larb[] array contains 4 (for LARB0 to LARB3) elements, meaning mt2701_m4u_to_larb() can legitimately return 3. The current check if (larbid >= MT2701_LARB_NR_MAX) incorrectly rejects valid LARB3 with -EINVAL.
Fix this off-by-one error by updating MT2701_LARB_NR_MAX to 4.
Note that this does not cause immediate issues with the current mt2701.dtsi and mt7623n.dtsi because it only defines 3 LARBs:
mediatek,larbs = <&larb0 &larb1 &larb2>;
Thus, larbid never reaches 3 in the existing upstream device tree.
--- drivers/iommu/mtk_iommu_v1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/mtk_iommu_v1.c +1 -1
@@ -88,7 +88,7 @@ struct dma_iommu_mapping {/* MTK generation one iommu HW only support 4K size mapping */ #define MT2701_IOMMU_PAGE_SHIFT 12#define MT2701_IOMMU_PAGE_SIZE (1UL << MT2701_IOMMU_PAGE_SHIFT) -#define MT2701_LARB_NR_MAX 3 +#define MT2701_LARB_NR_MAX 4/* * MTK m4u support 4GB iova address space, and only support 4K page
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 286/1815 bpf: Fix security_bpf_map_create error handling
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 36ffa86c42f91c8a57071e024afc4ffb51a8958f ]
Commit 5816bf4273ed ("lsm,selinux: Add LSM blob support for BPF objects") made the LSM hook wrappers for BPF object creation clean up the LSM state internally upon denial, e.g. security_bpf_map_create() internally calls security_bpf_map_free() when the bpf_map_create hook returns an error. map_create() however still routes a denial to its free_map_sec label, which invokes security_bpf_map_free() a second time, so the bpf_map_free hook fires twice for a single denied map.
In-tree LSMs are unaffected in practice since the blob kfree() inside security_bpf_map_free() is NULL-safe and idempotent and none of them implement bpf_map_free, but a BPF LSM program attached to that hook observes double invocations. Route the denial to free_map instead.
--- kernel/bpf/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/syscall.c +1 -1
@@ -1657,7 +1657,7 @@ static int map_create(union bpf_attr *attr, bpfptr_t uattr, struct bpf_common_at err =security_bpf_map_create (map, attr, token, uattr.is_kernel);if (err) - goto free_map_sec; + goto free_map; err =bpf_map_alloc_id (map);if (err)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 287/1815 iommu/msm: Return -ENOMEM on memory allocation failure in probe
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Zapolskiy <[email protected]>
[ Upstream commit b0d50c9016c4c2959dfa61bf9549cf98f9aa19cd ]
If dynamic memory allocation in driver's probe function execution fails, it should be reported to the driver's framework with -ENOMEM error code.
--- drivers/iommu/msm_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/msm_iommu.c +1 -1
@@ -720,7 +720,7 @@ static int msm_iommu_probe(struct platform_device *pdev) iommu =devm_kzalloc (&pdev->dev,sizeof (*iommu),GFP_KERNEL );if (!iommu) -return -ENODEV ; +return -ENOMEM ; iommu->dev = &pdev->dev;INIT_LIST_HEAD (&iommu->ctx_list);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 288/1815 iommu/amd: Prevent SB IOAPIC from overriding IVRS validation errors
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Wang <[email protected]>
[ Upstream commit 854056480f9217568e3ab5edd81a9347a173ea79 ]
The check_ioapic_information() function validates IOAPICs against the IVRS table to safely disable Interrupt Remapping (IR) if the BIOS provides a broken topology.
Currently, the validation loop contains a bug: If an unmapped secondary IOAPIC is encountered, 'ret' is set to false. But if the Southbridge (SB) IOAPIC is enumerated after it in the MADT, the loop overwrites 'ret' to true.
This bypasses the validation failure and leaves IR enabled. When devices attached to the unmapped secondary IOAPIC fire interrupts, the IOMMU drops them due to the missing Requestor ID, leading to localized device hangs.
Fix this by initializing 'ret' to true and only toggling it to false upon encountering a validation error, ensuring failures are never erased.
--- drivers/iommu/amd/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/amd/init.c +2 -2
@@ -3098,7 +3098,7 @@ static bool __init check_ioapic_information(void)int idx; has_sb_ioapic = false; - ret = false; + ret = true;/* * If we have map overrides on the kernel command line the
@@ -3123,7 +3123,6 @@ static bool __init check_ioapic_information(void) boot_cpu_data.x86_model <= 0xf && devid == IOAPIC_SB_DEVID_FAM18H_M4H)) { has_sb_ioapic = true; - ret = true; } }
@@ -3137,6 +3136,7 @@ static bool __init check_ioapic_information(void)* device id for the IOAPIC in the system. */ pr_err ("%s: No southbridge IOAPIC found\n" , fw_bug); + ret = false; }if (!ret)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 289/1815 iommu/amd: Fix false positive in SB IOAPIC IVRS validation
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Wang <[email protected]>
[ Upstream commit 04fee302fac762a242ff1ad6810cff90c2a350ba ]
The check_ioapic_information() function is designed to prevent boot hangs by ensuring the Southbridge (SB) IOAPIC is properly mapped in the IVRS table before enabling Interrupt Remapping.
Currently, this check passes if *any* enumerated IOAPIC matches the expected SB IOAPIC device ID. If a buggy BIOS incorrectly assigns the SB IOAPIC's device ID to a secondary IOAPIC in the IVRS, while scrambling the true SB IOAPIC's mapping, the check hits a false positive and succeeds.
This erroneously enables Interrupt Remapping. Consequently, the IOMMU blocks unmapped interrupts from the actual SB IOAPIC, dropping the system timer and leading to a silent kernel boot hang.
Tighten the validation to verify the device ID specifically against the SB IOAPIC by matching their APIC IDs first. This prevents the validation check from being bypassed via device ID aliasing.
--- drivers/iommu/amd/init.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-)
drivers/iommu/amd/init.c +28 -4
@@ -3091,11 +3091,25 @@ static void __init free_iommu_resources(void)/* SB IOAPIC for Hygon family 18h model 4h is on the device 0xb */ #define IOAPIC_SB_DEVID_FAM18H_M4H ((0x00 << 8) | PCI_DEVFN(0xb, 0)) +/* +* The Southbridge IOAPIC is assigned a GSI Base of 0 (handling interrupts +* 0 through 23). +*/ +static int __init get_sb_ioapic_id (void ) +{ +int idx =mp_find_ioapic (0 ); + +if (idx <0 ) +return -ENODEV ; + +return mpc_ioapic_id (idx); +} +static bool __init check_ioapic_information (void ) {const char *fw_bug =FW_BUG ;bool ret, has_sb_ioapic; -int idx; +int idx, sb_apicid; has_sb_ioapic = false; ret = true;
@@ -3108,6 +3122,16 @@ static bool __init check_ioapic_information(void)if (cmdline_maps) fw_bug ="" ; + sb_apicid =get_sb_ioapic_id (); +if (sb_apicid <0 ) { +/* +* Lack of SB IOAPIC registration is not a firmware bug, +* e.g. kernel booted with noapic or noacpi. +*/ + fw_bug ="" ; + goto out; + } +for (idx =0 ; idx < nr_ioapics; idx++) {int devid, id =mpc_ioapic_id (idx);
@@ -3116,16 +3140,16 @@ static bool __init check_ioapic_information(void)pr_err ("%s: IOAPIC[%d] not in IVRS table\n" , fw_bug, id); ret = false; - }else if (devid ==IOAPIC_SB_DEVID || + }else if (id == sb_apicid && (devid ==IOAPIC_SB_DEVID || (boot_cpu_data.x86_vendor ==X86_VENDOR_HYGON && boot_cpu_data.x86 ==0x18 && boot_cpu_data.x86_model >=0x4 && boot_cpu_data.x86_model <=0xf && - devid ==IOAPIC_SB_DEVID_FAM18H_M4H )) { + devid ==IOAPIC_SB_DEVID_FAM18H_M4H ))) { has_sb_ioapic = true; } } - +out:if (!has_sb_ioapic) {/* * We expect the SB IOAPIC to be listed in the IVRS
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 290/1815 arm64: dts: mediatek: tungsten-smarc: Remove unnecessary cells
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit dee885034faf7c9b265987407ab303b464ed0058 ]
Remove unnecessary address and size cells from both the disp_dsi0 and the xhci2's ethernet usb device subnode to fix a dtbs_check warning for avoid_unnecessary_addr_size.
--- arch/arm64/boot/dts/mediatek/mt8390-tungsten-smarc.dtsi | 4 ---- 1 file changed, 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt8390-tungsten-smarc.dtsi +0 -4
@@ -265,8 +265,6 @@ &disp_pwm0 { }; &disp_dsi0 { - #address-cells = <1>; - #size-cells = <0>; status = "okay"; ports {
@@ -1049,8 +1047,6 @@ &xhci2 { ethernet@1 { compatible = "usb424,7850"; reg = <1>; - #address-cells = <1>; - #size-cells = <0>; mdio { #address-cells = <1>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 291/1815 leds: pca9532: Fix inverted GPIO output polarity
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmo Chou <[email protected]>
[ Upstream commit 65a38a28a0b04af19a5e1fbf3869051412eeac96 ]
The pca9532_gpio_set_value() function incorrectly mapped the requested value to PCA9532_ON and PCA9532_OFF, inverting the GPIO output polarity. A requested logical high (val=1) incorrectly enabled the LED output driver, which on this open-drain device pulls the pin low, while a requested logical low (val=0) released the pin.
Correct the mapping so that val=1 yields PCA9532_OFF (pin released / high-impedance) and val=0 yields PCA9532_ON (pin driven low).
pca9532_gpio_direction_input() is also updated to pass val=1 to pca9532_gpio_set_value() to align with the corrected polarity mapping, ensuring the pin remains not driven when configured as an input.
--- drivers/leds/leds-pca9532.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/leds/leds-pca9532.c +3 -3
@@ -327,9 +327,9 @@ static int pca9532_gpio_set_value(struct gpio_chip *gc, unsigned int offset,struct pca9532_led *led = &data->leds[offset];if (val) - led->state =PCA9532_ON ; -else led->state =PCA9532_OFF ; +else + led->state =PCA9532_ON ;pca9532_setled (led);
@@ -349,7 +349,7 @@ static int pca9532_gpio_get_value(struct gpio_chip *gc, unsigned offset)static int pca9532_gpio_direction_input (struct gpio_chip *gc,unsigned offset) {/* To use as input ensure pin is not driven */ -pca9532_gpio_set_value (gc, offset,0 ); +pca9532_gpio_set_value (gc, offset,1 );return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 292/1815 leds: st1202: Stop pattern sequence before reprogramming
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Fombuena <[email protected]>
[ Upstream commit 9c019a8cb95d820e0bd03e75cfbad2c5b13941b7 ]
The LED1202 datasheet (section 4.8) states that modifications to the Pattern Sequence Repetition register (PAT_REP) and pattern duration registers are only applied after the sequence has completed or been stopped. When the device is running in infinite loop mode (PAT_REP = 0xFF) the sequence never completes on its own, so these writes are silently ignored by the hardware.
Neither pattern_clear() nor pattern_set() stop the running sequence before modifying pattern registers, causing any subsequent pattern reprogramming to have no effect when the previous pattern was set to infinite repeat.
Fix this by clearing PATS in the Configuration register before touching any pattern registers in both functions, ensuring the hardware accepts the new values immediately.
Note that the LED1202 has a single global pattern sequencer shared by all channels: PATS, PATSR, the duration registers, and PAT_REP are chip-wide. Stopping the sequencer in pattern_clear() therefore halts any pattern running on other channels. This is an inherent hardware constraint; pattern_set() restarts the sequencer when a new pattern is programmed.
--- drivers/leds/leds-st1202.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/leds/leds-st1202.c +8 -0
@@ -200,6 +200,10 @@ static int st1202_led_pattern_clear(struct led_classdev *ldev)guard (mutex)(&chip->lock); + ret =st1202_write_reg (chip,ST1202_CONFIG_REG ,ST1202_CONFIG_REG_SHFT ); +if (ret !=0 ) +return ret; +for (int patt =0 ; patt <ST1202_MAX_PATTERNS ; patt++) { ret =st1202_pwm_pattern_write (chip, led->led_num, patt,LED_OFF );if (ret !=0 )
@@ -226,6 +230,10 @@ static int st1202_led_pattern_set(struct led_classdev *ldev,guard (mutex)(&chip->lock); + ret =st1202_write_reg (chip,ST1202_CONFIG_REG ,ST1202_CONFIG_REG_SHFT ); +if (ret !=0 ) +return ret; +for (int patt =0 ; patt < len; patt++) {if (pattern[patt].delta_t <ST1202_MILLIS_PATTERN_DUR_MIN || pattern[patt].delta_t >ST1202_MILLIS_PATTERN_DUR_MAX )
Signature · 1 line
2.53.0
Re: [PATCH 7.2 0292/1815] leds: st1202: Stop pattern sequence before reprogramming
Quoted 9 lines · Greg Kroah-Hartman
7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Fombuena <[email protected]>
[ Upstream commit
9c019a8cb95d820e0bd03e75cfbad2c5b13941b7]
Please note that this patch was part of the following series:
The testing I carried out on real hardware included the complete series, including upstream commit fd2529ba8fb44cd4b56f1069363b949644b42cec, "leds: st1202: Validate pattern input before stopping the sequence".
That patch did not carry a Fixes: tag, as I considered it an improvement rather than a fix in its own right.
I do not anticipate any issues with the series being applied without that commit, but I have not tested that configuration. I therefore wanted to make you aware of this, in case you consider it advisable to backport fd2529ba8f as well.
The same applies to all of the following proposed backports, including this one. I am not going to respond to each individually, to avoid unnecessary mailing list traffic:
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
Signature · 1 line
Manuel Fombuena
Sasha Levin
maintainerRe: [PATCH 7.2 0292/1815] leds: st1202: Stop pattern sequence before reprogramming
Quoted 4 lines
I do not anticipate any issues with the series being applied without that commit, but I have not tested that configuration. I therefore wanted to make you aware of this, in case you consider it advisable to backport
fd2529ba8fas well.
Thanks for flagging it. fd2529ba8fb4 ("leds: st1202: Validate pattern input before stopping the sequence") is queued for 7.2 and 6.18 alongside the rest of the series, so both trees match the configuration you actually tested. No older tree is taking this series.
Signature · 2 lines
Thanks, Sasha
Greg Kroah-Hartman
maintainerPATCH 293/1815 leds: st1202: Fix pattern duration prescaler and pattern_clear skip marker
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Fombuena <[email protected]>
[ Upstream commit d32f8bdc2b417a3013e1316a54a0b314f973bbc1 ]
The PATy_DUR register encodes duration as N × 22.2 ms, with register value 0 reserved as a pattern skip indicator (§7.10). The driver incorrectly subtracted 1 from the register value:
value / ST1202_MILLIS_PATTERN_DUR_MIN - 1
This caused two problems:
- All programmed durations were off by one step (~22 ms too short).
- Writing the minimum duration (22 ms) produced register value 0, silently skipping the pattern step instead of setting a 22 ms duration.
The maximum duration constant was also wrong at 5660 ms. The 8-bit register saturates at 255, giving a maximum of 5610 ms (22 ms × 255). Values above 5653 ms were already producing a uint8_t overflow and writing 0 to the hardware.
Fix the formula by removing the erroneous subtraction, and derive the maximum from the register width so the relationship is explicit. Update the documentation to reflect the correct maximum.
This exposes a secondary issue: pattern_clear() was calling st1202_duration_pattern_write() with ST1202_MILLIS_PATTERN_DUR_MIN to reset unused slots, accidentally relying on the broken formula to produce register value 0. With the corrected formula, the same call writes 0x01 (22 ms), leaving unused slots as valid 22 ms zero-PWM steps and making the LED appear off for 7 × 22 ms out of every cycle.
Write 0 directly to the duration registers in pattern_clear() so unused slots are always explicitly marked as skip, independently of the conversion formula.
--- Documentation/leds/leds-st1202.rst | 2 +- drivers/leds/leds-st1202.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
Documentation/leds/leds-st1202.rst +1 -1
@@ -17,7 +17,7 @@ To be compatible with the hardware pattern format, maximum 8 tuples of brightness (PWM) and duration must be written to hw_pattern. - Min pattern duration: 22 ms -- Max pattern duration: 5660 ms +- Max pattern duration: 5610 ms The format of the hardware pattern values should be: "brightness duration brightness duration ..."
drivers/leds/leds-st1202.c +3 -3
@@ -31,7 +31,7 @@#define ST1202_ILED_REG0 0x09#define ST1202_MAX_LEDS 12#define ST1202_MAX_PATTERNS 8 -#define ST1202_MILLIS_PATTERN_DUR_MAX 5660 +#define ST1202_MILLIS_PATTERN_DUR_MAX (ST1202_MILLIS_PATTERN_DUR_MIN * U8_MAX)#define ST1202_MILLIS_PATTERN_DUR_MIN 22#define ST1202_PATTERN_DUR 0x16#define ST1202_PATTERN_PWM 0x1E
@@ -85,7 +85,7 @@ static int st1202_write_reg(struct st1202_chip *chip, int reg, uint8_t val)static uint8_t st1202_prescalar_to_miliseconds (unsigned int value) { -return value /ST1202_MILLIS_PATTERN_DUR_MIN -1 ; +return value /ST1202_MILLIS_PATTERN_DUR_MIN ; } static int st1202_pwm_pattern_write(struct st1202_chip *chip, int led_num,
@@ -209,7 +209,7 @@ static int st1202_led_pattern_clear(struct led_classdev *ldev)if (ret !=0 )return ret; - ret =st1202_duration_pattern_write (chip, patt,ST1202_MILLIS_PATTERN_DUR_MIN ); + ret =st1202_write_reg (chip,ST1202_PATTERN_DUR + patt,0 );if (ret !=0 )return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 294/1815 leds: st1202: Fix spurious pattern sequence start in setup
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Fombuena <[email protected]>
[ Upstream commit dcc31246aaf0d330a3ba9a725f56c33e6d634caa ]
st1202_setup() writes PATS and PATSR to the Configuration register as its final step, which starts the hardware pattern sequencer during device probe before any patterns have been programmed. This causes the device to run a sequence with whatever values happen to be in the pattern registers at the time.
Remove the write. The device reset at the start of setup restores all registers to their power-on defaults, leaving PATS and PATSR cleared.
--- drivers/leds/leds-st1202.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/leds/leds-st1202.c +0 -5
@@ -330,11 +330,6 @@ static int st1202_setup(struct st1202_chip *chip)if (ret <0 )return ret; - ret =st1202_write_reg (chip,ST1202_CONFIG_REG , -ST1202_CONFIG_REG_PATS |ST1202_CONFIG_REG_PATSR ); -if (ret <0 ) -return ret; -return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 295/1815 leds: st1202: Set all pattern PWM slots to full after clearing pattern
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Fombuena <[email protected]>
[ Upstream commit d2ca0e2b6d6430f9c60bb2e0ee0b2b3dc4e5d86a ]
pattern_clear() sets all PWM registers for the channel to LED_OFF (0). In static mode (PATS=0), the LED output is ILED x Pattern0_PWM / 4095; with Pattern0 at zero the LED remains dark regardless of the ILED value.
The LED1202 has a single global sequencer shared across all channels. If another channel starts the sequencer after this one has been cleared, the cleared channel runs through all 8 steps at zero duty cycle and stays dark regardless of ILED.
Set all 8 PWM slots to ST1202_PATTERN_PWM_FULL so that ILED alone controls the channel brightness in both static and sequencer modes.
Stable-dep-of: 7cbe470366bd ("leds: st1202: Fix brightness having no effect while pattern mode is active")
--- drivers/leds/leds-st1202.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/leds/leds-st1202.c +2 -1
@@ -35,6 +35,7 @@#define ST1202_MILLIS_PATTERN_DUR_MIN 22#define ST1202_PATTERN_DUR 0x16#define ST1202_PATTERN_PWM 0x1E +#define ST1202_PATTERN_PWM_FULL 0x0FFF#define ST1202_PATTERN_REP 0x15struct st1202_led {
@@ -205,7 +206,7 @@ static int st1202_led_pattern_clear(struct led_classdev *ldev)return ret;for (int patt =0 ; patt <ST1202_MAX_PATTERNS ; patt++) { - ret =st1202_pwm_pattern_write (chip, led->led_num, patt,LED_OFF ); + ret =st1202_pwm_pattern_write (chip, led->led_num, patt,ST1202_PATTERN_PWM_FULL );if (ret !=0 )return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 296/1815 leds: st1202: Fix brightness having no effect while pattern mode is active
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Fombuena <[email protected]>
[ Upstream commit 7cbe470366bdd43c7e8114fb2c4d74fa69093121 ]
Once a hardware pattern is running (PATS=1), writing to the brightness sysfs attribute only updates the ILED register. The visible output is ILED x Pattern_PWM / 4095, so the change has little effect and the LED never returns to steady static operation as the user expects.
The LED1202 has a single global sequencer shared across all channels. Stopping it in brightness_set() to force static mode would halt running patterns on all other active LEDs.
Instead, set all 8 PWM slots for the channel to ST1202_PATTERN_PWM_FULL before writing ILED. With every step at full duty cycle, the output is ILED x FULL / 4095 = ILED regardless of the sequencer state, without disturbing other channels.
This also enables basic LED operation without the pattern trigger: with the trigger set to none, the brightness sysfs attribute fully controls the LED as a simple on/off device.
--- drivers/leds/leds-st1202.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/leds/leds-st1202.c +2 -0
@@ -136,6 +136,8 @@ static void st1202_brightness_set(struct led_classdev *led_cdev,guard (mutex)(&chip->lock); +for (int patt =0 ; patt <ST1202_MAX_PATTERNS ; patt++) +st1202_pwm_pattern_write (chip, led->led_num, patt,ST1202_PATTERN_PWM_FULL );st1202_write_reg (chip,ST1202_ILED_REG0 + led->led_num, value); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 297/1815 leds: st1202: Disable channel when brightness is set to zero
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Fombuena <[email protected]>
[ Upstream commit 0767335233a8cbab00bbe260a4e4bd380c7677fd ]
When brightness_set() is called with LED_OFF, only the ILED register is zeroed; the channel enable bit is left set from probe time. A hardware channel enabled with ILED=0 still draws a small residual current, causing a dim glow even when the LED is supposed to be off.
Fix this by splitting st1202_channel_set() into a lockless inner function __st1202_channel_set() and a locking wrapper, then calling the inner function from brightness_set() while it already holds the mutex. The channel is now disabled when value is zero and re-enabled when non-zero, in the same lock region as the ILED write.
--- drivers/leds/leds-st1202.c | 68 ++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 29 deletions(-)
drivers/leds/leds-st1202.c +39 -29
@@ -128,39 +128,11 @@ static int st1202_duration_pattern_write(struct st1202_chip *chip, int pattern, st1202_prescalar_to_miliseconds(value)); } -static void st1202_brightness_set (struct led_classdev *led_cdev, -enum led_brightness value) -{ -struct st1202_led *led =cdev_to_st1202_led (led_cdev); -struct st1202_chip *chip = led->chip; - -guard (mutex)(&chip->lock); - -for (int patt =0 ; patt <ST1202_MAX_PATTERNS ; patt++) -st1202_pwm_pattern_write (chip, led->led_num, patt,ST1202_PATTERN_PWM_FULL ); -st1202_write_reg (chip,ST1202_ILED_REG0 + led->led_num, value); -} - -static enum led_brightness st1202_brightness_get (struct led_classdev *led_cdev) -{ -struct st1202_led *led =cdev_to_st1202_led (led_cdev); -struct st1202_chip *chip = led->chip; -u8 value =0 ; - -guard (mutex)(&chip->lock); - -st1202_read_reg (chip,ST1202_ILED_REG0 + led->led_num, &value); - -return value; -} - -static int st1202_channel_set (struct st1202_chip *chip,int led_num,bool active) +static int __st1202_channel_set (struct st1202_chip *chip,int led_num,bool active) {u8 chan_low, chan_high;int ret; -guard (mutex)(&chip->lock); -if (led_num <=7 ) { ret =st1202_read_reg (chip,ST1202_CHAN_ENABLE_LOW , &chan_low);if (ret <0 )
@@ -188,6 +160,40 @@ static int st1202_channel_set(struct st1202_chip *chip, int led_num, bool activereturn 0 ; } +static int st1202_channel_set (struct st1202_chip *chip,int led_num,bool active) +{ +guard (mutex)(&chip->lock); + +return __st1202_channel_set (chip, led_num, active); +} + +static void st1202_brightness_set (struct led_classdev *led_cdev, +enum led_brightness value) +{ +struct st1202_led *led =cdev_to_st1202_led (led_cdev); +struct st1202_chip *chip = led->chip; + +guard (mutex)(&chip->lock); + +for (int patt =0 ; patt <ST1202_MAX_PATTERNS ; patt++) +st1202_pwm_pattern_write (chip, led->led_num, patt,ST1202_PATTERN_PWM_FULL ); +st1202_write_reg (chip,ST1202_ILED_REG0 + led->led_num, value); +__st1202_channel_set (chip, led->led_num, !!value); +} + +static enum led_brightness st1202_brightness_get (struct led_classdev *led_cdev) +{ +struct st1202_led *led =cdev_to_st1202_led (led_cdev); +struct st1202_chip *chip = led->chip; +u8 value =0 ; + +guard (mutex)(&chip->lock); + +st1202_read_reg (chip,ST1202_ILED_REG0 + led->led_num, &value); + +return value; +} +static int st1202_led_set (struct led_classdev *ldev,enum led_brightness value) {struct st1202_led *led =cdev_to_st1202_led (ldev);
@@ -255,6 +261,10 @@ static int st1202_led_pattern_set(struct led_classdev *ldev,if (ret !=0 )return ret; + ret =__st1202_channel_set (chip, led->led_num, true); +if (ret !=0 ) +return ret; + ret =st1202_write_reg (chip,ST1202_CONFIG_REG , (ST1202_CONFIG_REG_PATSR |ST1202_CONFIG_REG_PATS |ST1202_CONFIG_REG_SHFT ));if (ret !=0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 298/1815 leds: st1202: Validate LED reg property against channel count
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Fombuena <[email protected]>
[ Upstream commit cf197514bdfd3877f42b5dce1efd40b7b686547e ]
The reg property from the device tree is used directly as an array index into chip->leds[] without bounds checking. A value >= ST1202_MAX_LEDS would cause an out-of-bounds write during probe.
--- drivers/leds/leds-st1202.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/leds/leds-st1202.c +7 -1
@@ -277,13 +277,19 @@ static int st1202_dt_init(struct st1202_chip *chip) {struct device *dev = &chip->client->dev;struct st1202_led *led; -int err, reg; +int err; +u32 reg;for_each_available_child_of_node_scoped (dev_of_node (dev), child) { err =of_property_read_u32 (child,"reg" , ®);if (err)return dev_err_probe (dev, err,"Invalid register\n" ); +if (reg >=ST1202_MAX_LEDS ) +return dev_err_probe (dev, -EINVAL , +"LED reg %u out of range [0, %d]\n" , + reg,ST1202_MAX_LEDS -1 ); + led = &chip->leds[reg]; led->is_active = true; led->fwnode =of_fwnode_handle (child);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 299/1815 printk: Fix possible console use-after-free
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
[ Upstream commit 36630cafbeede0b64c370edb2f7b4094327ee1e0 ]
When emitting a record via legacy printing, it is possible that a handover to another legacy printing context occurs. When a context has performed a handover, the console SRCU read lock is released and the pointer to the console struct might now be invalid. Therefore, after calling nbcon_legacy_emit_next_record() or console_emit_next_record(), it is necessary to check if a handover occurred _before_ further @con usage.
Sashiko pointed out that console_flush_one_record() was not doing this.
In console_flush_one_record(), after emitting a record, move the further usage of @con after the handover check.
--- kernel/printk/printk.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
kernel/printk/printk.c +9 -2
@@ -3264,10 +3264,8 @@ static bool console_flush_one_record(bool do_cond_resched, u64 *next_seq, bool *if (flags &CON_NBCON ) { progress =nbcon_legacy_emit_next_record (con, handover, cookie, !do_cond_resched); - printk_seq =nbcon_seq_read (con); }else { progress =console_emit_next_record (con, handover, cookie); - printk_seq = con->seq; }/*
@@ -3277,6 +3275,15 @@ static bool console_flush_one_record(bool do_cond_resched, u64 *next_seq, bool *if (*handover) goto fail; +/* +* @con can be used here now that it is certain that this +* context is still holding the SRCU read lock. +*/ +if (flags &CON_NBCON ) + printk_seq =nbcon_seq_read (con); +else + printk_seq = con->seq; +/* Track the next of the highest seq flushed. */ if (printk_seq > *next_seq) *next_seq = printk_seq;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 300/1815 ACPI: RISC-V: Fix riscv_acpi_irq_get_dep() loop termination
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Pieralisi <[email protected]>
[ Upstream commit 64ae310bffa477cd11029c818bec489f4b8a845e ]
In riscv_acpi_add_irq_dep() the main loop condition would currently stop the loop if an interrupt descriptor contains an interrupt for which the respective GSI handle is NULL, which is not correct because subsequent interrupts in the interrupt descriptor might still have a GSI dependency that must not be skipped.
Rework riscv_acpi_add_irq_dep() and the riscv_acpi_irq_get_dep() call chain to fix it - by not forcing the loop to stop in order to guarantee dependency detection for all the interrupt entries in the CRS descriptor.
--- drivers/acpi/riscv/irq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/acpi/riscv/irq.c +6 -4
@@ -299,6 +299,7 @@ static acpi_status riscv_acpi_irq_get_parent(struct acpi_resource *ares, void *creturn AE_OK ; ctx->handle =riscv_acpi_get_gsi_handle (eirq->interrupts[ctx->index]); + ctx->rc =0 ;return AE_CTRL_TERMINATE ; }
@@ -314,10 +315,8 @@ static int riscv_acpi_irq_get_dep(acpi_handle handle, unsigned int index, acpi_hacpi_walk_resources (handle,METHOD_NAME__CRS , riscv_acpi_irq_get_parent, &ctx); *gsi_handle = ctx.handle; -if (*gsi_handle) -return 1 ; -return 0 ; +return ctx.rc; }static u32 riscv_acpi_add_prt_dep (acpi_handle handle)
@@ -381,8 +380,11 @@ static u32 riscv_acpi_add_irq_dep(acpi_handle handle)int i;for (i =0 ; -riscv_acpi_irq_get_dep (handle, i, &gsi_handle); + !riscv_acpi_irq_get_dep (handle, i, &gsi_handle); i++) { +if (!gsi_handle) +continue ; + dep_devices.count =1 ; dep_devices.handles =kzalloc_objs (*dep_devices.handles,1 );if (!dep_devices.handles) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 301/1815 ACPI: RISC-V: Check acpi_get_handle() status in riscv_acpi_add_prt_dep()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Pieralisi <[email protected]>
[ Upstream commit 20435bda13f1219891ed0ce41207e320a916ff9c ]
In riscv_acpi_add_prt_dep(), the acpi_get_handle() call can fail which would leave link_handle uninitialized.
Fix it by checking the acpi_get_handle() return status and skip the entry if it fails.
--- drivers/acpi/riscv/irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/riscv/irq.c +3 -1
@@ -339,7 +339,9 @@ static u32 riscv_acpi_add_prt_dep(acpi_handle handle) entry = buffer.pointer;while (entry && (entry->length >0 )) {if (entry->source[0 ]) { -acpi_get_handle (handle, entry->source, &link_handle); + status =acpi_get_handle (handle, entry->source, &link_handle); +if (ACPI_FAILURE (status)) +continue ; dep_devices.count =1 ; dep_devices.handles =kzalloc_objs (*dep_devices.handles,1 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 302/1815 ACPI: RISC-V: Fix riscv_acpi_add_prt_dep() loop handling
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Pieralisi <[email protected]>
[ Upstream commit 3a56321d0aceee2a0bd80d23366401c131ff8350 ]
The loop in riscv_acpi_add_prt_dep() includes error conditions that are handled in a dubious - if not outright wrong - way, by continuining the loop (which skips and misses the entry pointer update to point to the next entry).
Rewrite the loop as a for loop (that handles the continuation correctly) and wrap the condition and update statements using helper functions to make it cleaner.
--- drivers/acpi/riscv/irq.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/acpi/riscv/irq.c +15 -4
@@ -319,6 +319,20 @@ static int riscv_acpi_irq_get_dep(acpi_handle handle, unsigned int index, acpi_hreturn ctx.rc; } +static bool acpi_prt_entry_valid (void *prt_entry) +{ +struct acpi_pci_routing_table *entry = prt_entry; + +return entry && entry->length >0 ; +} + +static void *acpi_prt_next_entry (void *prt_entry) +{ +struct acpi_pci_routing_table *entry = prt_entry; + +return prt_entry + entry->length; +} +static u32 riscv_acpi_add_prt_dep (acpi_handle handle) {struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL };
@@ -337,7 +351,7 @@ static u32 riscv_acpi_add_prt_dep(acpi_handle handle) } entry = buffer.pointer; -while (entry && (entry->length >0 )) { +for (;acpi_prt_entry_valid (entry); entry =acpi_prt_next_entry (entry)) {if (entry->source[0 ]) { status =acpi_get_handle (handle, entry->source, &link_handle);if (ACPI_FAILURE (status))
@@ -365,9 +379,6 @@ static u32 riscv_acpi_add_prt_dep(acpi_handle handle) dep_devices.handles[0 ] = gsi_handle; count +=acpi_scan_add_dep (handle, &dep_devices); } - - entry = (struct acpi_pci_routing_table *) - ((unsigned long )entry + entry->length); }kfree (buffer.pointer);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 303/1815 platform/x86: dell-privacy: Fix race condition
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit ca9338dbc64759b30741b12017c050b33c94dfa2 ]
Accessing priv->features_present needs to happen with the list mutex being held, otherwise priv can be freed at any moment.
--- drivers/platform/x86/dell/dell-wmi-privacy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-wmi-privacy.c +2 -2
@@ -92,11 +92,11 @@ bool dell_privacy_has_mic_mute(void) {struct privacy_wmi_data *priv; -mutex_lock (&list_mutex); +guard (mutex)(&list_mutex); + priv =list_first_entry_or_null (&wmi_list, struct privacy_wmi_data, list); -mutex_unlock (&list_mutex);return priv && (priv->features_present &BIT (DELL_PRIVACY_TYPE_AUDIO )); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 304/1815 platform/x86: dell-wmi-base: Fix resource leak on module load failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 072841e02cf9c00a7e8a9c567a14239e02ca47ad ]
We need to properly clean up the SMBIOS request and the privacy driver when the module load fails.
--- drivers/platform/x86/dell/dell-wmi-base.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-wmi-base.c +15 -2
@@ -843,9 +843,22 @@ static int __init dell_wmi_init(void) err =dell_privacy_register_driver ();if (err) -return err; + goto out_smbios; -return wmi_driver_register (&dell_wmi_driver); + err =wmi_driver_register (&dell_wmi_driver); +if (err) + goto out_privacy; + +return 0 ; + +out_privacy: +dell_privacy_unregister_driver (); + +out_smbios: +if (wmi_requires_smbios_request) +dell_wmi_events_set_enabled (false); + +return err; }late_initcall (dell_wmi_init);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 305/1815 platform/x86: dell-wmi-base: Fix handling of ultra performance key
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit adfd6846bea13667ff28f8aaf00c32fbd69825ab ]
The commit message of commit 5fbd827eb9c2 ("platform/x86: dell-wmi: Recognise or support new switches") states that the ultra performance key contains additional data
after the type and code fields. The event data passed todell_wmi_process_key() is already parsed, so "buffer" already
starts after those two fields.
Use the correct index for accessing the first data field to avoid a potential buffer overread.
--- drivers/platform/x86/dell/dell-wmi-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/dell/dell-wmi-base.c +1 -1
@@ -456,7 +456,7 @@ static int dell_wmi_process_key(struct wmi_device *wdev, int type, int code, __l key++; used =1 ; }else if (type ==0x0012 && code ==0x000d && remaining >0 ) { - value = (le16_to_cpu (buffer[2 ]) ==2 ); + value = (le16_to_cpu (buffer[0 ]) ==2 ); used =1 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 306/1815 platform/x86: lg-laptop: Fix LED resource handling
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 3e91964aa74ab261aa15d9d96318eded2fd9d22a ]
The event notification callback might access kbd_backlight even when it was not successfully registered with the LED subsystem. The same happens inside acpi_remove(), where the LED devices are unregistered unconditionally.
Fix this by tracking the availability of the kbd_backlight LED device and use devm_led_classdev_register() to let devres take care of unregistering the LED devices during removal. For this the parent device of the LED devices is changed to the native platform device.
--- drivers/platform/x86/lg-laptop.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/platform/x86/lg-laptop.c +14 -7
@@ -100,6 +100,7 @@ static u32 inited;#define INIT_SPARSE_KEYMAP 0x80static int battery_limit_use_wmbb; +static bool kbd_backlight_available;static struct led_classdev kbd_backlight;static enum led_brightness get_kbd_backlight_level (struct device *dev);
@@ -214,6 +215,7 @@ static union acpi_object *lg_wmbb(struct device *dev, u32 method_id, u32 arg1, ustatic void wmi_notify (union acpi_object *obj,void *context) {long data = (long )context; +unsigned int brightness;pr_debug ("event guid %li\n" , data);if (!obj)
@@ -224,8 +226,11 @@ static void wmi_notify(union acpi_object *obj, void *context)struct key_entry *key;if (eventcode ==0x10000000 ) { -led_classdev_notify_brightness_hw_changed ( - &kbd_backlight,get_kbd_backlight_level (kbd_backlight.dev->parent)); +if (kbd_backlight_available) { + brightness =get_kbd_backlight_level (kbd_backlight.dev->parent); +led_classdev_notify_brightness_hw_changed (&kbd_backlight, + brightness); + } }else { key =sparse_keymap_entry_from_scancode ( wmi_input_dev, eventcode);
@@ -865,8 +870,13 @@ static int acpi_probe(struct platform_device *pdev) goto out_platform_device;/* LEDs are optional */ -led_classdev_register (&pf_device->dev, &kbd_backlight); -led_classdev_register (&pf_device->dev, &tpad_led); + ret =devm_led_classdev_register (&pdev->dev, &kbd_backlight); +if (ret <0 ) + kbd_backlight_available = false; +else + kbd_backlight_available = true; + +devm_led_classdev_register (&pdev->dev, &tpad_led);wmi_input_setup ();battery_hook_register (&battery_hook);
@@ -884,9 +894,6 @@ static void acpi_remove(struct platform_device *pdev) {sysfs_remove_group (&pf_device->dev.kobj, &dev_attribute_group); -led_classdev_unregister (&tpad_led); -led_classdev_unregister (&kbd_backlight); -battery_hook_unregister (&battery_hook);wmi_input_destroy ();platform_device_unregister (pf_device);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 307/1815 bpf: Drop scalar id on sign-extending narrowing stack fills
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 2cb5f4ca695ebe552647e5ba4aad6934d6a43bae ]
When a spilled scalar is filled back with a sign-extending narrowing load (BPF_MEMSX), check_stack_read_fixed_off() copies the spilled register including its scalar id, but coerce_reg_to_size_sx() then sign-extends the filled register's value. If the same slot is also filled with a plain zero-extending load (BPF_MEM), both destination registers share the id yet hold different values. A later 'if <zext-reg> == const' then refines the sign-extended register through sync_linked_regs() to a value it does not have at runtime (e.g. the verifier believes 0x80000000 while the register is 0xffffffff80000000), which can be turned into an out-of-bounds access.
Drop the shared scalar id at the sign-extension site in check_mem_access() when sign extension actually changes the value, mirroring the BPF_MOVSX handling in check_alu_op() (no_sext = reg_umax < 2^(size*8-1)).
--- kernel/bpf/verifier.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +14 -2
@@ -6328,11 +6328,23 @@ static int check_mem_access(struct bpf_verifier_env *env, int insn_idx, struct bif (!err && size <BPF_REG_SIZE && value_regno >=0 && t ==BPF_READ && regs[value_regno].type ==SCALAR_VALUE ) { -if (!is_ldsx) +if (!is_ldsx) {/* b/h/w load zero-extends, mark upper bits as known 0 */ coerce_reg_to_size (®s[value_regno], size); -else + }else { +/* +* Sign-extension can change the register value relative +* to a scalar it is linked with by id (e.g. a zero- +* extending fill of the same spilled stack slot), thus +* drop the shared id in that case. +*/ +bool no_sext =reg_umax (®s[value_regno]) < + (1ULL << (size *BITS_PER_BYTE -1 )); +coerce_reg_to_size_sx (®s[value_regno], size); +if (!no_sext) +clear_scalar_id (®s[value_regno]); + } }return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 308/1815 remoteproc: qcom_q6v5_adsp: Fix reference leak for device node
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit 8c952807c2cebd5e9e9b37146c9383229794c129 ]
When calling of_parse_phandle_with_args(), the caller is responsible to call of_node_put() to release the reference of device node. In adsp_map_carveout, it does not release the reference.
--- drivers/remoteproc/qcom_q6v5_adsp.c | 1 + 1 file changed, 1 insertion(+)
drivers/remoteproc/qcom_q6v5_adsp.c +1 -0
@@ -355,6 +355,7 @@ static int adsp_map_carveout(struct rproc *rproc)return ret; sid = args.args[0 ] &SID_MASK_DEFAULT ; +of_node_put (args.np);/* Add SID configuration for ADSP Firmware to SMMU */ iova = adsp->mem_phys | (sid <<32 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 309/1815 remoteproc: qcom_wcnss: Fix handling the lack of PD regulators in v3
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 3dbc90b9c22ea96e37bf55f6011e63b5123ec668 ]
The changes introduced to handle single power domain platforms have swapped the info pointer increment from num_pd_vregs to num_pds, which would shift the info pointer past the end of the array for pronto-v3, which does not list power domain regulators in vregs.
This showed up as a difference between GCC- and LLVM-compiled kernels on SDM632 devices, where only with LLVM one would get the "regulator request with no identifier" error, because the out-of-bounds memory ended up being zeroed. Fix by skipping the increment when there are more power domains than regulators.
--- drivers/remoteproc/qcom_wcnss.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/remoteproc/qcom_wcnss.c +14 -9
@@ -441,25 +441,31 @@ static void wcnss_release_pds(struct qcom_wcnss *wcnss) }static int wcnss_init_regulators (struct qcom_wcnss *wcnss, -const struct wcnss_vreg_info *info, -int num_vregs,int num_pd_vregs) +const struct wcnss_data *data) { +const struct wcnss_vreg_info *info = data->vregs;struct regulator_bulk_data *bulk; +size_t i, possible_pds =0 , num_vregs = data->num_vregs;int ret; -int i; + +for (i =0 ; i <WCNSS_MAX_PDS ; i++) +if (data->pd_names[i]) + possible_pds++;/* * If attaching the power domains suceeded we can skip requesting * the regulators for the power domains. For old device trees we need to * reserve extra space to manage them through the regulator interface. */ -if (wcnss->num_pds) { +if (possible_pds >= num_vregs) { +/* Do nothing if vregs do not include PD regulators (pronto-v3) */ + }else if (wcnss->num_pds) { info += wcnss->num_pds;/* Handle single power domain case */ -if (wcnss->num_pds < num_pd_vregs) - num_vregs += num_pd_vregs - wcnss->num_pds; +if (wcnss->num_pds < data->num_pd_vregs) + num_vregs += data->num_pd_vregs - wcnss->num_pds; }else { - num_vregs += num_pd_vregs; + num_vregs += data->num_pd_vregs; } bulk = devm_kcalloc(wcnss->dev,
@@ -607,8 +613,7 @@ static int wcnss_probe(struct platform_device *pdev)if (ret && (ret != -ENODATA || !data->num_pd_vregs))return ret; - ret =wcnss_init_regulators (wcnss, data->vregs, data->num_vregs, - data->num_pd_vregs); + ret =wcnss_init_regulators (wcnss, data);if (ret) goto detach_pds;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 310/1815 bpf: Reject rdonly/rdwr_buf_size kfunc arguments that exceed u32 max
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Dudar <[email protected]>
[ Upstream commit 2aaf67f0516fde29620d0edfc29c01b9ea7ad430 ]
check_kfunc_args() detects a kfunc argument named rdonly_buf_size or rdwr_buf_size and stores reg->var_off.value into meta->r0_size, a u64, and does not bound it. check_kfunc_call() later copies that value into the returned register's mem_size field:
meta->r0_size = reg->var_off.value; ... regs[BPF_REG_0].mem_size = meta.r0_size;
regs[BPF_REG_0].mem_size is u32. A constant whose upper 32 bits are set gets truncated instead of causing a load-time rejection, so the verifier records a PTR_TO_MEM register with an approximately 4 GiB mem_size for whatever allocation the kfunc returned. A later access check against that register uses the truncated, wrong bound.
Reject rdonly_buf_size/rdwr_buf_size values that exceed U32_MAX at the point meta->r0_size is set.
--- kernel/bpf/verifier.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/bpf/verifier.c +5 -0
@@ -12049,6 +12049,11 @@ static int check_kfunc_args(struct bpf_verifier_env *env, struct bpf_kfunc_call_ } meta->r0_size = reg->var_off.value; +if (meta->r0_size >U32_MAX ) { +verbose (env,"%s rdonly/rdwr_buf_size exceeds u32 max\n" , +reg_arg_name (env, argno)); +return -EINVAL ; + }if (regno >=0 ) ret =mark_chain_precision (env, regno);else
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 311/1815 hwspinlock: propagate errno when registering single lock
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit e088ffa9a00eaaaf90da74763e774ca160969c26 ]
hwspin_lock_register_single() always returns 0 despite checking the result from radix_tree_insert(). Propagate the errno to make sanity checks in callers of this function actually meaningful.
--- drivers/hwspinlock/hwspinlock_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwspinlock/hwspinlock_core.c +1 -1
@@ -472,7 +472,7 @@ static int hwspin_lock_register_single(struct hwspinlock *hwlock, int id) out:mutex_unlock (&hwspinlock_tree_lock); -return 0 ; +return ret; }static struct hwspinlock *hwspin_lock_unregister_single (unsigned int id)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 312/1815 selftests/sched_ext: Fix bpf_link leak on early return in prog_run
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liang Luo <[email protected]>
[ Upstream commit e655c1f1bd14804f398df7da029c4a7e3f9ccd7f ]
In prog_run's run(), the bpf_link is attached early but only destroyed on the success path. The three SCX_EQ assertions between attach and destroy expand to a direct 'return SCX_TEST_FAIL', so if any of them triggers, bpf_link__destroy() is never reached and the BPF scheduler stays loaded. All subsequent tests then fail to attach because SCX is not in the DISABLED state.
Convert those assertions to explicit checks that jump to a unified 'out' label which always runs the cleanup, matching the pattern used in cyclic_kick_wait.c.
--- tools/testing/selftests/sched_ext/prog_run.c | 34 +++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-)
tools/testing/selftests/sched_ext/prog_run.c +26 -8
@@ -28,7 +28,8 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct prog_run *skel = ctx; -struct bpf_link *link; +struct bpf_link *link =NULL ; +enum scx_test_status status =SCX_TEST_PASS ;int prog_fd, err =0 ; prog_fd =bpf_program__fd (skel->progs.prog_run_syscall);
@@ -42,23 +43,40 @@ static enum scx_test_status run(void *ctx) link =bpf_map__attach_struct_ops (skel->maps.prog_run_ops);if (!link) {SCX_ERR ("Failed to attach scheduler" ); -close (prog_fd); -return SCX_TEST_FAIL ; + status =SCX_TEST_FAIL ; + goto out; } err =bpf_prog_test_run_opts (prog_fd, &topts); -SCX_EQ (err,0 ); +if (err) { +SCX_ERR ("BPF_PROG_RUN failed (%d)" , err); + status =SCX_TEST_FAIL ; + goto out; + }/* Assumes uei.kind is written last */ while (skel->data->uei.kind ==EXIT_KIND (SCX_EXIT_NONE ))sched_yield (); -SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_UNREG_BPF )); -SCX_EQ (skel->data->uei.exit_code,0xdeadbeef ); +if (skel->data->uei.kind !=EXIT_KIND (SCX_EXIT_UNREG_BPF )) { +SCX_ERR ("Unexpected exit kind: %llu" , + (unsigned long long )skel->data->uei.kind); + status =SCX_TEST_FAIL ; + goto out; + } +if (skel->data->uei.exit_code !=0xdeadbeef ) { +SCX_ERR ("Unexpected exit code: %lld" , + (long long )skel->data->uei.exit_code); + status =SCX_TEST_FAIL ; + goto out; + } + +out:close (prog_fd); -bpf_link__destroy (link); +if (link) +bpf_link__destroy (link); -return SCX_TEST_PASS ; +return status; }static void cleanup (void *ctx)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 313/1815 perf capstone: Fix kernel map reference count leak
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tengda Wu <[email protected]>
[ Upstream commit d3c9fca531e2465f3a8f585965f3d10e1a6595ff ]
In print_capstone_detail(), maps__find() is used to locate the kernel map. This function increments the reference count of the found map object. However, the current implementation fails to call map__put() after the map is no longer needed, leading to a reference count leak.
Fix this by adding a map__put(map) call to properly release the reference after use.
--- tools/perf/util/capstone.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
tools/perf/util/capstone.c +9 -4
@@ -302,6 +302,7 @@ static void print_capstone_detail(struct cs_insn *insn, char *buf, size_t len,for (i =0 ; i < insn->detail->x86.op_count; i++) {struct cs_x86_op *op = &insn->detail->x86.operands[i];u64 orig_addr; +struct map *found_map =NULL ;if (op->type !=X86_OP_MEM )continue ;
@@ -317,19 +318,22 @@ static void print_capstone_detail(struct cs_insn *insn, char *buf, size_t len,if (dso__kernel (map__dso (map))) {/* * The kernel maps can be split into sections, let's -* find the map first and the search the symbol. +* find the map first and then search the symbol. */ - map =maps__find (map__kmaps (map), addr); -if (map ==NULL ) + found_map =maps__find (map__kmaps (map), addr); +if (found_map ==NULL )continue ; + map = found_map; }/* convert it to map-relative address for search */ addr =map__map_ip (map, addr); sym =map__find_symbol (map, addr); -if (sym ==NULL ) +if (sym ==NULL ) { +map__put (found_map);continue ; + }if (addr == sym->start) { scnprintf(buf, len, "\t# %"PRIx64" <%s>",
@@ -338,6 +342,7 @@ static void print_capstone_detail(struct cs_insn *insn, char *buf, size_t len,scnprintf (buf, len,"\t# %" PRIx64" <%s+%#" PRIx64">" , orig_addr, sym->name, addr - sym->start); } +map__put (found_map);break ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 314/1815 platform/x86: asus-wireless: Fail probe when there is no ACPI match
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linmao Li <[email protected]>
[ Upstream commit 4aefd66ef7822cf7d3f53146dcee0b71021ed2b7 ]
Every platform driver can be forced to match a device that does not match its list of device IDs because of device_match_driver_override(), so platform drivers that rely on the existence of a device ACPI companion object need to verify its presence.
asus_wireless_probe() returns success when acpi_match_acpi_device() finds no match, leaving behind an input device that never reports anything because the notify handler is not installed. Worse, when the driver is force-bound to a device without an ACPI companion, probe still succeeds and stores a NULL companion pointer, which asus_wireless_remove() later passes to acpi_dev_remove_notify_handler(), leading to a NULL pointer dereference on unbind.
Return -ENODEV when the device does not match the ID table. This also covers the missing-companion case, because acpi_match_acpi_device() rejects a NULL device. Perform the check before allocating any driver state, instead of after the input device has already been registered.
--- drivers/platform/x86/asus-wireless.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/platform/x86/asus-wireless.c +5 -6
@@ -132,6 +132,10 @@ static int asus_wireless_probe(struct platform_device *pdev)const struct acpi_device_id *id;int err; + id =acpi_match_acpi_device (device_ids, adev); +if (!id) +return -ENODEV ; + data =devm_kzalloc (&pdev->dev,sizeof (*data),GFP_KERNEL );if (!data)return -ENOMEM ;
@@ -139,6 +143,7 @@ static int asus_wireless_probe(struct platform_device *pdev)platform_set_drvdata (pdev, data); data->adev = adev; + data->hswc_params = (const struct hswc_params *)id->driver_data; data->idev =devm_input_allocate_device (&pdev->dev);if (!data->idev)
@@ -153,12 +158,6 @@ static int asus_wireless_probe(struct platform_device *pdev)if (err)return err; - id =acpi_match_acpi_device (device_ids, adev); -if (!id) -return 0 ; - - data->hswc_params = (const struct hswc_params *)id->driver_data; - data->wq =create_singlethread_workqueue ("asus_wireless_workqueue" );if (!data->wq)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 315/1815 spi: qcom-geni: Fix missing error check on pm_runtime_get_sync()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Praveen Talari <[email protected]>
[ Upstream commit d8e9ea989acb54508477e4a8c9d9eaf8217e0081 ]
spi_geni_init() calls pm_runtime_get_sync() to power up the device before accessing hardware registers, but never checks the return value. If the runtime resume fails, the function silently proceeds to read and write hardware registers on a device that may not be powered up, leading to register access faults.
Fix this by replacing pm_runtime_get_sync() with the PM_RUNTIME_ACQUIRE_IF_ENABLED() macro and checking the result via PM_RUNTIME_ACQUIRE_ERR(), propagating any error back to the caller immediately before any hardware access occurs.
Since the macro handles its own cleanup on failure, the out_pm label and the corresponding pm_runtime_put() call are no longer needed. Replace all goto out_pm paths with direct return ret statements and remove the label entirely.
--- drivers/spi/spi-geni-qcom.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/spi/spi-geni-qcom.c +10 -7
@@ -613,25 +613,30 @@ static int spi_geni_init(struct spi_geni_master *mas)u32 spi_tx_cfg, fifo_disable;int ret = -ENXIO ; -pm_runtime_get_sync (mas->dev); +PM_RUNTIME_ACQUIRE_IF_ENABLED (mas->dev, pm); + ret =PM_RUNTIME_ACQUIRE_ERR (&pm); +if (ret <0 ) { +dev_err (mas->dev,"Failed to resume and get %d\n" , ret); +return ret; + } proto =geni_se_read_proto (se);if (spi->target) {if (proto !=GENI_SE_SPI_SLAVE ) {dev_err (mas->dev,"Invalid proto %d\n" , proto); - goto out_pm; +return ret; }spi_slv_setup (mas); }else if (proto ==GENI_SE_INVALID_PROTO ) { ret =geni_load_se_firmware (se,GENI_SE_SPI );if (ret) {dev_err (mas->dev,"spi master firmware load failed ret: %d\n" , ret); - goto out_pm; +return ret; } }else if (proto !=GENI_SE_SPI ) {dev_err (mas->dev,"Invalid proto %d\n" , proto); - goto out_pm; +return ret; } mas->tx_fifo_depth =geni_se_get_tx_fifo_depth (se);
@@ -664,7 +669,7 @@ static int spi_geni_init(struct spi_geni_master *mas)dev_dbg (mas->dev,"Using GPI DMA mode for SPI\n" );break ; }else if (ret == -EPROBE_DEFER ) { - goto out_pm; +return ret; }/* * in case of failure to get gpi dma channel, we can still do the
@@ -693,8 +698,6 @@ static int spi_geni_init(struct spi_geni_master *mas)writel (spi_tx_cfg, se->base +SE_SPI_TRANS_CFG ); } -out_pm: -pm_runtime_put (mas->dev);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 316/1815 media: platform: amd: use refcount_t instead of atomic_t
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 0baf8f42110b7c361bb3f6a8a78c0958a23e4e32 ]
We are using the refcnt variable for refcounting. Use the refcount_t type instead, as it has support for saturation and underflow.
This also makes cocci happier, as it will fix the following warning:
./platform/amd/isp4/isp4_subdev.c:394:6-25: WARNING: atomic_dec_and_test variation before object free at line 395.
--- drivers/media/platform/amd/isp4/isp4_interface.c | 4 ++-- drivers/media/platform/amd/isp4/isp4_interface.h | 2 +- drivers/media/platform/amd/isp4/isp4_subdev.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/amd/isp4/isp4_interface.c +2 -2
@@ -375,7 +375,7 @@ static int isp4if_send_fw_cmd(struct isp4_interface *ispif, u32 cmd_id,return -ENOMEM ;/* Get two references: one for the resp thread, one for us */ -atomic_set (&ele->refcnt,2 ); +refcount_set (&ele->refcnt,2 );init_completion (&ele->cmd_done); }
@@ -455,7 +455,7 @@ static int isp4if_send_fw_cmd(struct isp4_interface *ispif, u32 cmd_id, put_ele_ref:/* Don't free the command if we didn't put the last reference */ -if (ele &&atomic_dec_return (&ele->refcnt)) +if (ele && !refcount_dec_and_test (&ele->refcnt)) ele =NULL ; free_ele:
drivers/media/platform/amd/isp4/isp4_interface.h +1 -1
@@ -68,7 +68,7 @@ struct isp4if_cmd_element {u32 seq_num;u32 cmd_id;struct completion cmd_done; -atomic_t refcnt; +refcount_t refcnt; };struct isp4_interface {
drivers/media/platform/amd/isp4/isp4_subdev.c +1 -1
@@ -391,7 +391,7 @@ static void isp4sd_fw_resp_cmd_done(struct isp4_subdev *isp_subdev,if (ele) {complete (&ele->cmd_done); -if (atomic_dec_and_test (&ele->refcnt)) +if (refcount_dec_and_test (&ele->refcnt))kfree (ele); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 317/1815 serial: 8250: Clear CON_PRINTBUFFER on port re-registration
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fushuai Wang <[email protected]>
[ Upstream commit d338ab1d90603f875c4f7ed223406535378173a5 ]
When two PnP devices map to the same physical port, the serial8250 driver removes and re-registers the console structure for the same port.
During re-registration, the console structure still has CON_PRINTBUFFER set from the initial registration, which causes console_init_seq() to set console->seq to syslog_seq. This results in re-printing the entire system log buffer, which may lead to RCU stall on slow serial consoles.
Clear CON_PRINTBUFFER when re-registering a port to prevent duplicate log printing.
--- drivers/tty/serial/8250/8250_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +5 -1
@@ -720,8 +720,12 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)/* Preserve specified console flow control. */ cons_flow =uart_cons_flow_enabled (&uart->port); -if (uart->port.dev) +if (uart->port.dev) { +if (uart_console (&uart->port)) + uart->port.cons->flags &= ~CON_PRINTBUFFER ; +uart_remove_one_port (&serial8250_reg, &uart->port); + } uart->port.ctrl_id = up->port.ctrl_id; uart->port.port_id = up->port.port_id;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 318/1815 serial: ma35d1: Fix OF node reference leaks in console init
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit 8dfea56f350b3dc826f35711802ad6ae8fae0748 ]
ma35d1serial_console_init_port() stores matching UART device nodes in ma35d1serial_uart_nodes[] with an extra of_node_get() so that console setup can later read the "reg" property. However, the stored references are never released after console setup has finished using them.
Drop the stored node reference after ma35d1serial_console_setup() reads the "reg" property, and clear the array slot to avoid leaving a stale pointer behind. Also release the iterator reference before breaking out of for_each_matching_node(), since the normal iterator advance will not run in that path.
--- drivers/tty/serial/ma35d1_serial.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/tty/serial/ma35d1_serial.c +10 -2
@@ -608,8 +608,14 @@ static int __init ma35d1serial_console_setup(struct console *co, char *options)if (!np || !p)return -ENODEV ; -if (of_property_read_u32_array (np,"reg" , val32,ARRAY_SIZE (val32)) !=0 ) +if (of_property_read_u32_array (np,"reg" , val32,ARRAY_SIZE (val32)) !=0 ) { +of_node_put (np); + ma35d1serial_uart_nodes[co->index] =NULL ;return -EINVAL ; + } + +of_node_put (np); + ma35d1serial_uart_nodes[co->index] =NULL ; p->port.iobase = val32[1 ]; p->port.membase =ioremap (p->port.iobase,MA35_UART_REG_SIZE );
@@ -648,8 +654,10 @@ static void ma35d1serial_console_init_port(void)of_node_get (np); ma35d1serial_uart_nodes[i] = np; i++; -if (i ==MA35_UART_NR ) +if (i ==MA35_UART_NR ) { +of_node_put (np);break ; + } } } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 319/1815 serial: qcom-geni: do not advance stale DMA completions
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
[ Upstream commit 7ea38c49e7178960926657863299face6dc0e1b0 ]
The qcom GENI serial DMA TX completion path advances the transmit fifo by the number of bytes recorded in port->tx_remaining.
If uart_flush_buffer() runs after the hardware has completed a DMA transfer but before the DMA completion interrupt has been handled, the serial core resets the transmit fifo while port->tx_remaining still describes the old DMA transfer.
A previous fix avoided advancing an empty fifo by checking that the fifo length is at least tx_remaining. That still does not distinguish the old DMA payload from new bytes written after the flush. If userspace writes new data before the stale DMA completion interrupt is handled, the fifo can again contain at least tx_remaining bytes and the stale completion can advance and discard those new bytes.
Mark an in-flight DMA transfer stale when the transmit fifo is flushed. The later completion still unprepares the original DMA mapping using the saved length, but it no longer advances the transmit fifo.
--- drivers/tty/serial/qcom_geni_serial.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/tty/serial/qcom_geni_serial.c +9 -1
@@ -143,6 +143,7 @@ struct qcom_geni_serial_port {unsigned int tx_remaining;unsigned int tx_queued; +bool tx_dma_stale;int wakeup_irq;bool rx_tx_swap;bool cts_rts_swap;
@@ -697,6 +698,7 @@ static void qcom_geni_serial_start_tx_dma(struct uart_port *uport) } port->tx_remaining = xmit_size; + port->tx_dma_stale = false; }static void qcom_geni_serial_start_tx_fifo (struct uart_port *uport)
@@ -1029,6 +1031,7 @@ static void qcom_geni_serial_handle_tx_dma(struct uart_port *uport)struct qcom_geni_serial_port *port =to_dev_port (uport);struct tty_port *tport = &uport->state->port;unsigned int fifo_len =kfifo_len (&tport->xmit_fifo); +bool tx_dma_stale = port->tx_dma_stale;/* * Only advance the kfifo if it still contains the bytes that were
@@ -1039,12 +1042,13 @@ static void qcom_geni_serial_handle_tx_dma(struct uart_port *uport)* kfifo->in, making kfifo_len() wrap to UART_XMIT_SIZE - tx_remaining * and triggering a spurious large DMA transfer of stale data. */ -if (fifo_len >= port->tx_remaining) +if (!tx_dma_stale && fifo_len >= port->tx_remaining)uart_xmit_advance (uport, port->tx_remaining);geni_se_tx_dma_unprep (&port->se, port->tx_dma_addr, port->tx_remaining); port->tx_dma_addr =0 ; port->tx_remaining =0 ; + port->tx_dma_stale = false;if (!kfifo_is_empty (&tport->xmit_fifo))qcom_geni_serial_start_tx_dma (uport);
@@ -1182,6 +1186,10 @@ static void qcom_geni_serial_shutdown(struct uart_port *uport)static void qcom_geni_serial_flush_buffer_fifo (struct uart_port *uport) { +struct qcom_geni_serial_port *port =to_dev_port (uport); + +if (port->tx_dma_addr) + port->tx_dma_stale = true;qcom_geni_serial_cancel_tx_cmd (uport); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 320/1815 usb: gadget: uac: validate rate list length before storing
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qing Ming <[email protected]>
[ Upstream commit 844d83d5964b87919b958ff48405188c6ddae9cc ]
UAC1 and UAC2 configfs rate-list attributes parse a comma-separated list of sampling rates and store each parsed value in fixed-size arrays. The arrays have UAC_MAX_RATES entries, but the store paths do not check that the input contains at most that many tokens before writing through opts->name##s[i++].
Writing more than ten rates therefore writes past the end of the p_srates[] or c_srates[] array in struct f_uac1_opts or struct f_uac2_opts.
With CONFIG_UBSAN_BOUNDS enabled, writing an 11-entry rate list to the UAC1 p_srate attribute reports:
UBSAN: array-index-out-of-bounds drivers/usb/gadget/function/f_uac1.c:1669:1 index 10 is out of range for type 'int [10]' __ubsan_handle_out_of_bounds.cold f_uac1_opts_p_srate_store configfs_write_iter vfs_write ksys_write do_syscall_64
The same reproducer against the UAC2 p_srate attribute reports:
UBSAN: array-index-out-of-bounds drivers/usb/gadget/function/f_uac2.c:2087:1 index 10 is out of range for type 'int [10]' __ubsan_handle_out_of_bounds.cold f_uac2_opts_p_srate_store configfs_write_iter vfs_write ksys_write do_syscall_64
Reject additional tokens once UAC_MAX_RATES entries have been parsed. Also keep the original kstrdup() pointer for kfree(), because strsep() advances the parsing cursor. Freeing the advanced cursor leaks the original buffer on successful parses and can free an interior pointer on some error paths.
--- drivers/usb/gadget/function/f_uac1.c | 13 +++++++++---- drivers/usb/gadget/function/f_uac2.c | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-)
drivers/usb/gadget/function/f_uac1.c +9 -4
@@ -1594,7 +1594,8 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \ const char *page, size_t len) \ { \struct f_uac1_opts *opts =to_f_uac1_opts (item); \ -char *split_page =NULL ; \ +char *buf =NULL ; \ +char *split_page; \int ret = -EINVAL ; \char *token; \u32 num; \
@@ -1608,18 +1609,22 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \ \ i =0 ; \ memset(opts->name##s, 0x00, sizeof(opts->name##s)); \ - split_page = kstrdup(page, GFP_KERNEL); \ + buf = kstrdup(page, GFP_KERNEL); \ + split_page = buf; \ while ((token = strsep(&split_page, ",")) != NULL) { \ ret = kstrtou32(token, 0, &num); \ if (ret) \ goto end; \ - \ + if (i >= UAC_MAX_RATES) { \ + ret = -EINVAL; \ + goto end; \ + } \ opts->name##s[i++] = num; \ ret = len; \ }; \ \ end: \ - kfree(split_page); \ + kfree(buf); \ mutex_unlock(&opts->lock); \ return ret; \ } \
drivers/usb/gadget/function/f_uac2.c +9 -4
@@ -2012,7 +2012,8 @@ static ssize_t f_uac2_opts_##name##_store(struct config_item *item, \ const char *page, size_t len) \ { \struct f_uac2_opts *opts =to_f_uac2_opts (item); \ -char *split_page =NULL ; \ +char *buf =NULL ; \ +char *split_page; \int ret = -EINVAL ; \char *token; \u32 num; \
@@ -2026,18 +2027,22 @@ static ssize_t f_uac2_opts_##name##_store(struct config_item *item, \ \ i =0 ; \ memset(opts->name##s, 0x00, sizeof(opts->name##s)); \ - split_page = kstrdup(page, GFP_KERNEL); \ + buf = kstrdup(page, GFP_KERNEL); \ + split_page = buf; \ while ((token = strsep(&split_page, ",")) != NULL) { \ ret = kstrtou32(token, 0, &num); \ if (ret) \ goto end; \ - \ + if (i >= UAC_MAX_RATES) { \ + ret = -EINVAL; \ + goto end; \ + } \ opts->name##s[i++] = num; \ ret = len; \ }; \ \ end: \ - kfree(split_page); \ + kfree(buf); \ mutex_unlock(&opts->lock); \ return ret; \ } \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 321/1815 usb: gadget: f_fs: Fix fence cleanup in ffs_dmabuf_transfer() error paths
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nuno Sá <[email protected]>
[ Upstream commit 621707dc67c9846fd876d7579ec951d92aa033f1 ]
The error paths for endpoint-disabled (ESHUTDOWN) and request-allocation failure (ENOMEM) in ffs_dmabuf_transfer() jump to err_fence_put which calls dma_fence_put() on the fence. However, at that point the fence has only been kmalloc'd — dma_fence_init() has not been called yet, so the refcount and the fence ops are uninitialized. Calling dma_fence_put() on such an object leads to undefined behavior.
Use kfree() instead, since the fence is just a plain allocation at this stage, and rename the label to err_fence_free to reflect the actual cleanup action.
--- drivers/usb/gadget/function/f_fs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/function/f_fs.c +4 -4
@@ -1705,13 +1705,13 @@ static int ffs_dmabuf_transfer(struct file *file,/* In the meantime, endpoint got disabled or changed. */ if (epfile->ep != ep) { ret = -ESHUTDOWN ; - goto err_fence_put; + goto err_fence_free; } usb_req =usb_ep_alloc_request (ep->ep,GFP_ATOMIC );if (!usb_req) { ret = -ENOMEM ; - goto err_fence_put; + goto err_fence_free; }/*
@@ -1760,9 +1760,9 @@ static int ffs_dmabuf_transfer(struct file *file,return ret; -err_fence_put: +err_fence_free:spin_unlock_irq (&epfile->ffs->eps_lock); -dma_fence_put (&fence->base); +kfree (fence); err_resv_unlock:dma_resv_unlock (dmabuf->resv); err_attachment_put:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 322/1815 usb: gadget: configfs: fix out-of-bounds read of qw_sign
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
[ Upstream commit f63edb54d8f738f9c21e2068c777ae1c097df6b7 ]
os_desc_qw_sign_show() passes OS_STRING_QW_SIGN_LEN as the input length to utf16s_to_utf8s(), but that argument counts UTF-16 code units while OS_STRING_QW_SIGN_LEN (14) is the byte size of qw_sign[]. The array holds only OS_STRING_QW_SIGN_LEN / 2 (7) code units, so the conversion reads up to 7 units (14 bytes) past the end of qw_sign[] into the following members of struct gadget_info when the stored signature fills the array without a NUL terminator, exposing those bytes through the configfs attribute.
The store path halves the count for its input bound but passes the full byte count as the utf8s_to_utf16s() output limit; use the destination code-unit count in both directions.
--- drivers/usb/gadget/configfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/configfs.c +2 -2
@@ -1177,7 +1177,7 @@ static ssize_t os_desc_qw_sign_show(struct config_item *item, char *page)struct gadget_info *gi =os_desc_item_to_gadget_info (item);int res; - res =utf16s_to_utf8s ((wchar_t *) gi->qw_sign,OS_STRING_QW_SIGN_LEN , + res =utf16s_to_utf8s ((wchar_t *) gi->qw_sign,OS_STRING_QW_SIGN_LEN /2 ,UTF16_LITTLE_ENDIAN , page,PAGE_SIZE -1 ); page[res++] ='\n' ;
@@ -1199,7 +1199,7 @@ static ssize_t os_desc_qw_sign_store(struct config_item *item, const char *page,mutex_lock (&gi->lock); res =utf8s_to_utf16s (page, l,UTF16_LITTLE_ENDIAN , (wchar_t *) gi->qw_sign, -OS_STRING_QW_SIGN_LEN ); +OS_STRING_QW_SIGN_LEN /2 );if (res >0 ) res = len;mutex_unlock (&gi->lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 323/1815 usb: typec: tcpm: fix EPR AVS APDO maximum voltage decoding
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Rao <[email protected]>
[ Upstream commit 29741ca40b7b780ba14c4c3ffef190f908864fe9 ]
pdo_epr_avs_apdo_max_voltage_mv() extracts the EPR AVS minimum-voltage field instead of the maximum-voltage field. As a result, an EPR AVS APDO with different minimum and maximum voltages is decoded as having identical limits. The currently visible effect is that tcpm_log_source_caps() reports a min-min voltage range.
Extract PDO_EPR_AVS_APDO_MAX_VOLT in the maximum-voltage accessor.
--- include/linux/usb/pd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/usb/pd.h +1 -1
@@ -493,7 +493,7 @@ static inline unsigned int pdo_epr_avs_apdo_min_voltage_mv(u32 pdo)static inline unsigned int pdo_epr_avs_apdo_max_voltage_mv (u32 pdo) { -return FIELD_GET (PDO_EPR_AVS_APDO_MIN_VOLT , pdo) *100 ; +return FIELD_GET (PDO_EPR_AVS_APDO_MAX_VOLT , pdo) *100 ; }static inline unsigned int pdo_epr_avs_apdo_pdp_w (u32 pdo)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 324/1815 usb: ljca: bound bank_num in ljca_enumerate_gpio()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maoyi Xie <[email protected]>
[ Upstream commit dd9483726d0f16c1a56879c3edb65128259a4e2b ]
ljca_enumerate_gpio() reads desc->bank_num from the device and loops valid_pin[i] = get_unaligned_le32(...) for i < bank_num. valid_pin[] holds only LJCA_MAX_GPIO_NUM / 32 = 2 entries.
Two checks run before the loop. The reply length must match struct_size(desc, bank_desc, bank_num). The product pins_per_bank * bank_num must not exceed LJCA_MAX_GPIO_NUM. Neither one bounds bank_num against the size of valid_pin[]. The reply is capped at LJCA_MAX_PAYLOAD_SIZE (60) bytes, so the struct_size check limits bank_num to 9. A device that reports bank_num 9 with pins_per_bank 7 still passes both checks. gpio_num is 63 and the reply is 56 bytes. The loop then writes nine u32 into the two entry array and overruns valid_pin[] on the stack.
A broken or malicious LJCA device can therefore overflow the stack. Reject a bank_num that does not fit valid_pin[].
--- drivers/usb/misc/usb-ljca.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/misc/usb-ljca.c +3 -0
@@ -595,6 +595,9 @@ static int ljca_enumerate_gpio(struct ljca_adapter *adap)if (gpio_num >LJCA_MAX_GPIO_NUM )return -EINVAL ; +if (desc->bank_num >ARRAY_SIZE (valid_pin)) +return -EINVAL ; +/* construct platform data */ gpio_info =kzalloc_obj (*gpio_info);if (!gpio_info)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 325/1815 usb: gadget: aspeed_udc: check endpoint DMA allocation
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 97cee53a94be3bd4fd8fbed6071bd2f32dad1ab1 ]
ast_udc_probe() allocates a coherent DMA buffer used as the backing store for endpoint buffers. ast_udc_init_ep() derives per-endpoint buffer pointers from udc->ep0_buf, so a failed allocation is dereferenced during probe.
Check the allocation before endpoint setup. The existing probe error path called ast_udc_remove(), which unregisters the gadget unconditionally and is not safe before usb_add_gadget_udc() succeeds. Add a local cleanup helper for probe failures so pre-registration failures only unwind the resources that were actually initialized.
This was found by a local static analysis checker for unchecked allocator returns while scanning Linux 6.16. The change was checked by applying it to current mainline and by running checkpatch. I do not have access to Aspeed UDC hardware, so no runtime testing was performed.
--- drivers/usb/gadget/udc/aspeed_udc.c | 50 ++++++++++++++++++----------- 1 file changed, 32 insertions(+), 18 deletions(-)
drivers/usb/gadget/udc/aspeed_udc.c +32 -18
@@ -1431,25 +1431,12 @@ static void ast_udc_init_hw(struct ast_udc_dev *udc)ast_udc_write (udc,0 ,AST_UDC_EP0_CTRL ); } -static void ast_udc_remove (struct platform_device *pdev) +static void ast_udc_cleanup (struct platform_device *pdev) {struct ast_udc_dev *udc =platform_get_drvdata (pdev);unsigned long flags;u32 ctrl; -usb_del_gadget_udc (&udc->gadget); -if (udc->driver) { -/* -* This is broken as only some cleanup is skipped, *udev is -* freed and the register mapping goes away. Any further usage -* probably crashes. Also the device is unbound, so the skipped -* cleanup is never catched up later. -*/ -dev_alert (&pdev->dev, -"Driver is busy and still going away. Fasten your seat belts!\n" ); -return ; - } -spin_lock_irqsave (&udc->lock, flags);/* Disable upstream port connection */
@@ -1469,6 +1456,26 @@ static void ast_udc_remove(struct platform_device *pdev) udc->ep0_buf =NULL ; } +static void ast_udc_remove (struct platform_device *pdev) +{ +struct ast_udc_dev *udc =platform_get_drvdata (pdev); + +usb_del_gadget_udc (&udc->gadget); +if (udc->driver) { +/* +* This is broken as only some cleanup is skipped, *udev is +* freed and the register mapping goes away. Any further usage +* probably crashes. Also the device is unbound, so the skipped +* cleanup is never catched up later. +*/ +dev_alert (&pdev->dev, +"Driver is busy and still going away. Fasten your seat belts!\n" ); +return ; + } + +ast_udc_cleanup (pdev); +} +static int ast_udc_probe (struct platform_device *pdev) {enum usb_device_speed max_speed;
@@ -1521,6 +1528,12 @@ static int ast_udc_probe(struct platform_device *pdev)AST_UDC_NUM_ENDPOINTS , &udc->ep0_buf_dma, GFP_KERNEL); +if (!udc->ep0_buf) { +clk_disable_unprepare (udc->clk); + rc = -ENOMEM ; + goto err; + } + udc->gadget.speed =USB_SPEED_UNKNOWN ; udc->gadget.max_speed =USB_SPEED_HIGH ; udc->creq = udc->reg +AST_UDC_SETUP0 ;
@@ -1550,20 +1563,20 @@ static int ast_udc_probe(struct platform_device *pdev) udc->irq =platform_get_irq (pdev,0 );if (udc->irq <0 ) { rc = udc->irq; - goto err; + goto err_cleanup; } rc =devm_request_irq (&pdev->dev, udc->irq, ast_udc_isr,0 ,KBUILD_MODNAME , udc);if (rc) {dev_err (&pdev->dev,"Failed to request interrupt\n" ); - goto err; + goto err_cleanup; } rc =usb_add_gadget_udc (&pdev->dev, &udc->gadget);if (rc) {dev_err (&pdev->dev,"Failed to add gadget udc\n" ); - goto err; + goto err_cleanup; } dev_info(&pdev->dev, "Initialized udc in USB%s mode\n",
@@ -1571,9 +1584,10 @@ static int ast_udc_probe(struct platform_device *pdev)return 0 ; +err_cleanup: +ast_udc_cleanup (pdev); err:dev_err (&pdev->dev,"Failed to udc probe, rc:0x%x\n" , rc); -ast_udc_remove (pdev);return rc; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 326/1815 usb: fix UAF when probe runs concurrent to dyn ID removal
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary Guo <[email protected]>
[ Upstream commit ef8154d8b52d60338c1fd8d793cd8e891c604c14 ]
Dynamic IDs are only guaranteed to be valid when usb_dynids_lock is held, as remove_id_store can free the node. Thus, make a copy in usb_probe_interface. Clarify the documentation that the id parameter is only valid during the probe.
USB serial has the same pattern, but it does not need fixing as the IDs cannot be removed via sysfs.
--- drivers/usb/core/driver.c | 12 ++++++++---- include/linux/usb.h | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-)
drivers/usb/core/driver.c +8 -4
@@ -228,14 +228,16 @@ static void usb_free_dynids(struct usb_driver *usb_drv) }static const struct usb_device_id *usb_match_dynamic_id (struct usb_interface *intf, -const struct usb_driver *drv) +const struct usb_driver *drv, +struct usb_device_id *id_copy) {struct usb_dynid *dynid;guard (mutex)(&usb_dynids_lock);list_for_each_entry (dynid, &drv->dynids.list, node) {if (usb_match_one_id (intf, &dynid->id)) { -return &dynid->id; + *id_copy = dynid->id; +return id_copy; } }return NULL ;
@@ -321,6 +323,7 @@ static int usb_probe_interface(struct device *dev)struct usb_interface *intf =to_usb_interface (dev);struct usb_device *udev =interface_to_usbdev (intf);const struct usb_device_id *id; +struct usb_device_id id_copy;int error = -ENODEV ;int lpm_disable_error = -ENODEV ;
@@ -340,7 +343,7 @@ static int usb_probe_interface(struct device *dev)return error; } - id =usb_match_dynamic_id (intf, driver); + id =usb_match_dynamic_id (intf, driver, &id_copy);if (!id) id =usb_match_id (intf, driver->id_table);if (!id)
@@ -892,6 +895,7 @@ static int usb_device_match(struct device *dev, const struct device_driver *drv)struct usb_interface *intf;const struct usb_driver *usb_drv;const struct usb_device_id *id; +struct usb_device_id id_copy;/* device drivers never match interfaces */ if (is_usb_device_driver (drv))
@@ -904,7 +908,7 @@ static int usb_device_match(struct device *dev, const struct device_driver *drv)if (id)return 1 ; - id =usb_match_dynamic_id (intf, usb_drv); + id =usb_match_dynamic_id (intf, usb_drv, &id_copy);if (id)return 1 ; }
include/linux/usb.h +2 -1
@@ -1185,7 +1185,8 @@ extern ssize_t usb_show_dynids(struct usb_dynids *dynids, char *buf);* interface. It may also use usb_set_interface() to specify the * appropriate altsetting. If unwilling to manage the interface, * return -ENODEV, if genuine IO errors occurred, an appropriate -* negative errno value. +* negative errno value. The usb_device_id parameter is only valid during +* probe. * @disconnect: Called when the interface is no longer accessible, usually * because its device has been (or is being) disconnected or the * driver module is being unloaded.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 327/1815 platform/x86: asus-wmi: fix resource leaks on probe failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Scardovi <[email protected]>
[ Upstream commit ef3daa2b84a2b8499ce9e2ce1c865dca36d39f95 ]
During driver initialization in asus_wmi_add(), various subsystems are registered sequentially. However, the error path labels are out of order relative to the registration sequence.
Specifically:
1. If asus_wmi_custom_fan_curve_init() fails, the driver jumps to fail_custom_fan_curve. Because this label is placed below fail_sysfs, it bypasses the cleanup calls for the input device and sysfs groups, which were successfully registered before, leaking those resources.
2. If asus_screenpad_init() fails, the driver jumps to fail_screenpad. Because fail_screenpad is placed below fail_backlight, it bypasses the cleanup calls for backlight and rfkill, leaking those resources.
Fix these resource leaks by reordering the error path labels in asus_wmi_add() to match the exact reverse order of the resource allocations.
--- drivers/platform/x86/asus-wmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/platform/x86/asus-wmi.c +3 -3
@@ -5244,20 +5244,20 @@ static int asus_wmi_add(struct platform_device *pdev)return 0 ; fail_wmi_handler: +asus_screenpad_exit (asus); +fail_screenpad:asus_wmi_backlight_exit (asus); fail_backlight:asus_wmi_rfkill_exit (asus); -fail_screenpad: -asus_screenpad_exit (asus); fail_rfkill:asus_wmi_led_exit (asus); fail_leds: +fail_custom_fan_curve: fail_hwmon:asus_wmi_input_exit (asus); fail_input:asus_wmi_sysfs_exit (asus->platform_device); fail_sysfs: -fail_custom_fan_curve: fail_platform_profile_setup: fail_fan_boost_mode: fail_platform:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 328/1815 platform/mellanox: mlxbf-pmc: Check ACPI_COMPANION() against NULL
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linmao Li <[email protected]>
[ Upstream commit c38cce70adef874c2a7b5132c14d6c221401deff ]
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence.
mlxbf_pmc_probe() passes the result of ACPI_COMPANION() to acpi_device_hid(), which dereferences it, so force-binding the driver to a device without an ACPI companion leads to a NULL pointer dereference.
Accordingly, add a requisite ACPI_COMPANION() check against NULL to the mlxbf-pmc driver and return -ENODEV when the companion is missing.
--- drivers/platform/mellanox/mlxbf-pmc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/platform/mellanox/mlxbf-pmc.c +8 -2
@@ -2262,13 +2262,19 @@ static int mlxbf_pmc_map_counters(struct device *dev)static int mlxbf_pmc_probe (struct platform_device *pdev) { -struct acpi_device *acpi_dev =ACPI_COMPANION (&pdev->dev); -const char *hid =acpi_device_hid (acpi_dev);struct device *dev = &pdev->dev; +struct acpi_device *acpi_dev;struct arm_smccc_res res; +const char *hid;guid_t guid;int ret; + acpi_dev =ACPI_COMPANION (&pdev->dev); +if (!acpi_dev) +return -ENODEV ; + + hid =acpi_device_hid (acpi_dev); +/* Ensure we have the UUID we expect for this service. */ arm_smccc_smc (MLXBF_PMC_SIP_SVC_UID ,0 ,0 ,0 ,0 ,0 ,0 ,0 , &res);guid_parse (mlxbf_pmc_svc_uuid_str, &guid);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 329/1815 platform/surface: acpi-notify: Check ACPI companion before use
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linmao Li <[email protected]>
[ Upstream commit 2b3a5dabe89e330413af403246b648c1890f368f ]
Since every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override(), platform drivers that rely on the existence of a device's ACPI companion object should verify its presence.
san_probe() dereferences the result of ACPI_COMPANION() when installing the GSBUS address space handler, so force-binding the driver to a device without an ACPI companion leads to a NULL pointer dereference. The dereference was introduced when the probe function was switched from ACPI_HANDLE() to ACPI_COMPANION().
Check the ACPI companion against NULL and return -ENODEV when it is missing, like commit e4865a56d013 ("ACPI: driver: Check ACPI_COMPANION() against NULL during probe") does for the core ACPI platform drivers.
--- drivers/platform/surface/surface_acpi_notify.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/surface/surface_acpi_notify.c +5 -1
@@ -777,12 +777,16 @@ static int san_consumer_links_setup(struct platform_device *pdev)static int san_probe (struct platform_device *pdev) { -struct acpi_device *san =ACPI_COMPANION (&pdev->dev);struct ssam_controller *ctrl; +struct acpi_device *san;struct san_data *data;acpi_status astatus;int status; + san =ACPI_COMPANION (&pdev->dev); +if (!san) +return -ENODEV ; + ctrl =ssam_client_bind (&pdev->dev);if (IS_ERR (ctrl))return PTR_ERR (ctrl) == -ENODEV ? -EPROBE_DEFER :PTR_ERR (ctrl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 330/1815 usb: mtu3: allow system suspend during active gadget connection
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fei Shao <[email protected]>
[ Upstream commit e69027c25361b6044c7928715667586cc5469063 ]
When operating in gadget mode connected to a USB host, system suspend fails with -EBUSY because active peripheral connections block suspend entry.
Fix this by restricting the -EBUSY check to runtime autosuspend (PMSG_IS_AUTO). For system suspend (!PMSG_IS_AUTO), perform soft disconnect to disconnect from the bus and allow MAC sleep.
--- drivers/usb/mtu3/mtu3_core.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/usb/mtu3/mtu3_core.c +10 -1
@@ -1037,9 +1037,14 @@ int ssusb_gadget_suspend(struct ssusb_mtk *ssusb, pm_message_t msg)if (!mtu->gadget_driver)return 0 ; -if (mtu->connected) +/* Prevent runtime suspend when active connection exists */ +if (mtu->connected &&PMSG_IS_AUTO (msg))return -EBUSY ; +/* Perform soft disconnect for system suspend */ +if (mtu->softconnect && !PMSG_IS_AUTO (msg)) +mtu3_dev_on_off (mtu,0 ); +mtu3_dev_suspend (mtu);synchronize_irq (mtu->irq);
@@ -1055,5 +1060,9 @@ int ssusb_gadget_resume(struct ssusb_mtk *ssusb, pm_message_t msg)mtu3_dev_resume (mtu); +/* Restore soft connect for system resume */ +if (mtu->softconnect && !PMSG_IS_AUTO (msg)) +mtu3_dev_on_off (mtu,1 ); +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 331/1815 usb: renesas_usbhs: Fix power-off ordering on unbind
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Biju Das <[email protected]>
[ Upstream commit 589b9e6f96be6bd8dd0d45fda8e948c31dc2fe94 ]
Move the usbhsc_power_ctrl() call to before hardware_exit() and reset_control_assert() in usbhs_remove(), so the PHY is powered off while priv->phy is still valid, rather than after hardware_exit() has already cleared it.
--- drivers/usb/renesas_usbhs/common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/renesas_usbhs/common.c +3 -3
@@ -813,9 +813,6 @@ static void usbhs_remove(struct platform_device *pdev)flush_delayed_work (&priv->notify_hotplug_work); -usbhs_platform_call (priv, hardware_exit, pdev); -reset_control_assert (priv->rsts); -/* * Explicitly free the IRQ to ensure the interrupt handler is * disabled and synchronized before freeing resources.
@@ -832,6 +829,9 @@ static void usbhs_remove(struct platform_device *pdev)if (!usbhs_get_dparam (priv, runtime_pwctrl))usbhsc_power_ctrl (priv,0 ); +usbhs_platform_call (priv, hardware_exit, pdev); +reset_control_assert (priv->rsts); +usbhsc_clk_put (priv);pm_runtime_disable (&pdev->dev); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 332/1815 usb: typec: ucsi: gaokun: unwind notifier on UCSI register failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 2c5659a7064e7c4c0c51eb9356bcf6726a85773b ]
gaokun_ucsi_register_worker() registers the EC notifier before calling ucsi_register(). If ucsi_register() fails, the worker currently only logs the error and leaves the notifier registered. Later EC events can then call into an unpublished UCSI instance.
The remove path also unconditionally unregisters both the EC notifier and the UCSI device even if the delayed worker failed before both publication steps completed.
Unregister the notifier immediately when ucsi_register() fails, and track only the fully published state. The remove path then tears down the pair only if both publication steps completed.
--- drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c +12 -3
@@ -105,6 +105,7 @@ struct gaokun_ucsi {struct notifier_block nb;u16 version;u8 num_ports; +bool registered; };/* -------------------------------------------------------------------------- */
@@ -482,8 +483,13 @@ static void gaokun_ucsi_register_worker(struct work_struct *work) } ret =ucsi_register (ucsi); -if (ret) +if (ret) {dev_err_probe (ucsi->dev, ret,"ucsi register failed\n" ); +gaokun_ec_unregister_notify (uec->ec, &uec->nb); +return ; + } + + uec->registered = true; } static int gaokun_ucsi_probe(struct auxiliary_device *adev,
@@ -528,8 +534,11 @@ static void gaokun_ucsi_remove(struct auxiliary_device *adev)int i;disable_delayed_work_sync (&uec->work); -gaokun_ec_unregister_notify (uec->ec, &uec->nb); -ucsi_unregister (uec->ucsi); +if (uec->registered) { +gaokun_ec_unregister_notify (uec->ec, &uec->nb); +ucsi_unregister (uec->ucsi); + } +for (i =0 ; i < uec->num_ports; ++i)typec_mux_put (uec->ports[i].typec_mux);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 333/1815 usb: chipidea: imx: fix missing ret assignment for dev_err_probe
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
[ Upstream commit 1db5c6b0b9834aee2f14e39764becfcc29d09ccf ]
Assign the return value of dev_err_probe() to ret so that the correct error code is propagated when goto err_clk is taken.
--- drivers/usb/chipidea/ci_hdrc_imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/chipidea/ci_hdrc_imx.c +1 -1
@@ -528,7 +528,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)if (data->wakeup_irq >0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s:wakeup" , pdata.name);if (!irq_name) { -dev_err_probe (dev, -ENOMEM ,"failed to create irq_name\n" ); + ret =dev_err_probe (dev, -ENOMEM ,"failed to create irq_name\n" ); goto err_clk; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 334/1815 drm/panel: samsung-s6d16d0: Power off on prepare failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laxman Acharya Padhya <[email protected]>
[ Upstream commit a9f950adfe2147318d75e7a6eab5e814851802ac ]
If enabling tearing mode or exiting sleep mode fails after the regulator is enabled, s6d16d0_prepare() returns without asserting reset or disabling the supply. Since the DRM panel core leaves the panel unprepared, a later unprepare call skips the driver callback and the supply remains enabled.
Assert reset and disable the supply before returning the DSI command error.
--- drivers/gpu/drm/panel/panel-samsung-s6d16d0.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-samsung-s6d16d0.c +8 -2
@@ -88,16 +88,22 @@ static int s6d16d0_prepare(struct drm_panel *panel) MIPI_DSI_DCS_TEAR_MODE_VBLANK);if (ret) {dev_err (s6->dev,"failed to enable vblank TE (%d)\n" , ret); -return ret; + goto err_power_off; }/* Exit sleep mode and power on */ ret =mipi_dsi_dcs_exit_sleep_mode (dsi);if (ret) {dev_err (s6->dev,"failed to exit sleep mode (%d)\n" , ret); -return ret; + goto err_power_off; }return 0 ; + +err_power_off: +gpiod_set_value_cansleep (s6->reset_gpio,1 ); +regulator_disable (s6->supply); + +return ret; }static int s6d16d0_enable (struct drm_panel *panel)
Signature · 1 line
2.53.0