6.12.119-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 455/1756 kconfig: fix extra output from savedefconfig on out-of-range defaults
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Braha <[email protected]>
[ Upstream commit dbe1ae2304a3b02c3bf6ae82895ff232a29f3fee ]
The Kconfig interpreter currently allows defaults that are outside of the range bounds.
In these cases, the 'sym_validate_range' function will adjust the default value to the nearest range bound. For example, see this example:
config A
int
range 1 2
default 16
Here, since the default value of 16 is greater than the bounds, the effective default value gets adjusted down to the upper bound, 2.
However, 'savedefconfig' writes non-default values, and without being aware of the automatic adjustment to the range bound, it would write: A=2
This limitation is also documented in a comment: "The following fails to handle the situation where a default value is further limited by the valid range."
To resolve this, let's factor out the default-range adjustment logic from the existing 'sym_validate_range' function into its own 'sym_get_near_range_bound' function for 'savedefconfig' to use too, so that it compares against the effective value.
Adds tests, accordingly.
--- scripts/kconfig/symbol.c | 39 ++++++++---- .../kconfig/tests/savedefconfig_range/Kconfig | 60 +++++++++++++++++++ .../tests/savedefconfig_range/__init__.py | 8 +++ .../kconfig/tests/savedefconfig_range/config | 7 +++ .../savedefconfig_range/expected_defconfig | 0 5 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 scripts/kconfig/tests/savedefconfig_range/Kconfig create mode 100644 scripts/kconfig/tests/savedefconfig_range/__init__.py create mode 100644 scripts/kconfig/tests/savedefconfig_range/config create mode 100644 scripts/kconfig/tests/savedefconfig_range/expected_defconfig
scripts/kconfig/symbol.c +27 -12
@@ -145,7 +145,12 @@ static long long sym_get_range_val(struct symbol *sym, int base)return strtoll (sym->curr.val,NULL , base); } -static void sym_validate_range (struct symbol *sym) +/* +* Return the nearest range bound for an out-of-range default value. +* Return NULL if the value is valid or the symbol has no active range. +*/ +static struct symbol *sym_get_near_range_bound (struct symbol *sym, +const char *value) {struct property *prop;struct symbol *range_sym;
@@ -160,21 +165,31 @@ static void sym_validate_range(struct symbol *sym) base =16 ;break ;default : -return ; +return NULL ; } prop =sym_get_range_prop (sym);if (!prop) -return ; - val =strtoll (sym->curr.val,NULL , base); +return NULL ; + val =strtoll (value,NULL , base); range_sym = prop->expr->left.sym; val2 =sym_get_range_val (range_sym, base);if (val >= val2) { range_sym = prop->expr->right.sym; val2 =sym_get_range_val (range_sym, base);if (val <= val2) -return ; +return NULL ; } - sym->curr.val = range_sym->curr.val; + +return range_sym; +} + +static void sym_validate_range (struct symbol *sym) +{ +struct symbol *range_sym; + + range_sym =sym_get_near_range_bound (sym, sym->curr.val); +if (range_sym) + sym->curr.val = range_sym->curr.val; }static void sym_set_changed (struct symbol *sym)
@@ -778,7 +793,7 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)const char *sym_get_string_default (struct symbol *sym) {struct property *prop; -struct symbol *ds; +struct symbol *ds, *range_sym;const char *str ="" ;tristate val;
@@ -796,11 +811,6 @@ const char *sym_get_string_default(struct symbol *sym) val =EXPR_AND (expr_calc_value (prop->expr), prop->visible.tri);break ;default : -/* -* The following fails to handle the situation -* where a default value is further limited by -* the valid range. -*/ ds =prop_get_symbol (prop);if (ds !=NULL ) {sym_calc_value (ds);
@@ -844,6 +854,11 @@ const char *sym_get_string_default(struct symbol *sym)default :break ; } + + range_sym =sym_get_near_range_bound (sym, str); +if (range_sym) + str = range_sym->curr.val; +return str; }
scripts/kconfig/tests/savedefconfig_range/Kconfig new file +60 -0
60 lines not on this page · raw message
scripts/kconfig/tests/savedefconfig_range/__init__.py new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +"""Test savedefconfig with numerical defaults outside of ranges.""" + + +def test(conf): + assert conf._run_conf('--savedefconfig=defconfig', dot_config='config', + out_file='defconfig') == 0 + assert conf.config_matches('expected_defconfig')
scripts/kconfig/tests/savedefconfig_range/config new file +7 -0
@@ -0,0 +1,7 @@ +CONFIG_INT_DEFAULT_ABOVE_RANGE=1 +CONFIG_INT_DEFAULT_BELOW_RANGE=4 +CONFIG_INT_DYNAMIC_RANGE=3 +CONFIG_HEX_DEFAULT_ABOVE_RANGE=0x20 +CONFIG_INT_IMPLICIT_DEFAULT_ZERO=1 +CONFIG_INT_CONDITIONAL_RANGE=2 +CONFIG_INT_CONDITIONAL_DEFAULT=2
scripts/kconfig/tests/savedefconfig_range/expected_defconfig new file +0 -0
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 456/1756 cxl/pci: Skip reset detection for DVSEC emulated decoders
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixin Liu <[email protected]>
[ Upstream commit 17ff3a9fd8669ea53fe83a7013871f30214d5537 ]
HDM decoders are emulated from the DVSEC range registers in two cases:
(a) the component registers expose no HDM decoder capability, or (b) the capability is present but the DVSEC ranges were the ones in use at driver load.
After an FLR or SBR, __cxl_endpoint_decoder_reset_detected() reads the HDM decoder Committed bit for every decoder marked enabled, emulated ones included. In case (a) regs.hdm_decoder is NULL and the read oopses. In case
(b) the Committed bit was never set, so a reset gets reported that never happened.
Use the absence of cxld->commit to elide the check for emulated decoders.
Case (b) tested under QEMU: a reset on an endpoint driven down the DVSEC emulation path no longer reports a reset or strips the decoder flags.
--- drivers/cxl/core/pci.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/cxl/core/pci.c +9 -0
@@ -700,6 +700,15 @@ static int __cxl_endpoint_decoder_reset_detected(struct device *dev, void *data)if ((cxld->flags &CXL_DECODER_F_ENABLE ) ==0 )return 0 ; +/* +* Decoders emulated from the DVSEC range registers have no commit +* callback and no HDM decoder registers to consult. +*/ +if (!cxld->commit) { +dev_warn (dev,"DVSEC emulated decode may have been cleared by reset\n" ); +return 0 ; + } + cxlhdm =dev_get_drvdata (&port->dev); hdm = cxlhdm->regs.hdm_decoder; ctrl =readl (hdm +CXL_HDM_DECODER0_CTRL_OFFSET (cxld->id));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 457/1756 cxl/port: Fix uninitialized coordinates reported for RCDs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixin Liu <[email protected]>
[ Upstream commit 58b2b1ef28024093063de536c05aaea792226e24 ]
cxl_endpoint_get_perf_coordinates() returns success for a Restricted CXL Device without calculating coordinates, so the caller's output array is left uninitialized. Callers treat it as valid and can expose the stack residue as access coordinates.
Initialize the coordinates to zero before returning for an RCD. Zeroing in the helper rather than at the caller keeps the @coord output contract the exported function documents.
Reported by the Sashiko review bot.
--- drivers/cxl/core/port.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/cxl/core/port.c +3 -1
@@ -2198,8 +2198,10 @@ int cxl_endpoint_get_perf_coordinates(struct cxl_port *port,* Skip calculation for RCD. Expectation is HMAT already covers RCD case * since RCH does not support hotplug. */ -if (cxlmd->cxlds->rcd) +if (cxlmd->cxlds->rcd) { +memset (coord,0 ,sizeof (*coord) *ACCESS_COORDINATE_MAX );return 0 ; + }/* * Exit the loop when the parent port of the current iter port is cxl
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 458/1756 crypto: qat - fix active_devs leak on crypto alg registration failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahsan Atta <[email protected]>
[ Upstream commit 178829f1b5b259938188a10f4103fdb901b6435e ]
adf_dev_start() registered both alg sets in a single condition. If qat_algs_register() succeeds but qat_asym_algs_register() fails, ADF_STATUS_CRYPTO_ALGS_REGISTERED is left clear, so adf_dev_stop() skips qat_algs_unregister(): the skciphers and aeads stay registered with active_devs stuck at 1, pinning the module.
Both helpers leak active_devs internally as well - they increment it and return without decrementing when a crypto_register_*() call fails, and the asym path also leaves the already-registered akcipher behind.
Split the registration in adf_dev_start() so that an asym failure unregisters qat_algs, and unwind active_devs (and the akcipher) on the error paths of both register helpers. While at it, propagate the error code returned by the register helpers instead of a blanket -EFAULT.
--- .../crypto/intel/qat/qat_common/adf_init.c | 24 ++++++++++++----- .../crypto/intel/qat/qat_common/qat_algs.c | 15 ++++++----- .../intel/qat/qat_common/qat_asym_algs.c | 26 ++++++++++++++----- 3 files changed, 45 insertions(+), 20 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_init.c +17 -7
@@ -248,13 +248,23 @@ static int adf_dev_start(struct adf_accel_dev *accel_dev)clear_bit (ADF_STATUS_STARTING , &accel_dev->status);set_bit (ADF_STATUS_STARTED , &accel_dev->status); -if (!list_empty (&accel_dev->crypto_list) && - (qat_algs_register () ||qat_asym_algs_register ())) { -dev_err (&GET_DEV (accel_dev), -"Failed to register crypto algs\n" ); -set_bit (ADF_STATUS_STARTING , &accel_dev->status); -clear_bit (ADF_STATUS_STARTED , &accel_dev->status); -return -EFAULT ; +if (!list_empty (&accel_dev->crypto_list)) { + ret =qat_algs_register (); +if (ret) { +dev_err (&GET_DEV (accel_dev),"Failed to register crypto algs\n" ); +set_bit (ADF_STATUS_STARTING , &accel_dev->status); +clear_bit (ADF_STATUS_STARTED , &accel_dev->status); +return ret; + } + + ret =qat_asym_algs_register (); +if (ret) { +dev_err (&GET_DEV (accel_dev),"Failed to register crypto asym algs\n" ); +qat_algs_unregister (); +set_bit (ADF_STATUS_STARTING , &accel_dev->status); +clear_bit (ADF_STATUS_STARTED , &accel_dev->status); +return ret; + } }set_bit (ADF_STATUS_CRYPTO_ALGS_REGISTERED , &accel_dev->status);
drivers/crypto/intel/qat/qat_common/qat_algs.c +9 -6
@@ -1395,19 +1395,22 @@ int qat_algs_register(void) ret =crypto_register_skciphers (qat_skciphers,ARRAY_SIZE (qat_skciphers));if (ret) - goto unlock; + goto err_dec; ret =crypto_register_aeads (qat_aeads,ARRAY_SIZE (qat_aeads));if (ret) - goto unreg_algs; + goto err_unreg_skciphers; -unlock:mutex_unlock (&algs_lock); -return ret; +return 0 ; -unreg_algs: +err_unreg_skciphers:crypto_unregister_skciphers (qat_skciphers,ARRAY_SIZE (qat_skciphers)); - goto unlock; +err_dec: + active_devs--; +unlock: +mutex_unlock (&algs_lock); +return ret; }void qat_algs_unregister (void )
drivers/crypto/intel/qat/qat_common/qat_asym_algs.c +19 -7
@@ -1340,13 +1340,25 @@ int qat_asym_algs_register(void)int ret =0 ;mutex_lock (&algs_lock); -if (++active_devs ==1 ) { - rsa.base.cra_flags =0 ; - ret =crypto_register_akcipher (&rsa); -if (ret) - goto unlock; - ret =crypto_register_kpp (&dh); - } +if (++active_devs !=1 ) + goto unlock; + + rsa.base.cra_flags =0 ; + ret =crypto_register_akcipher (&rsa); +if (ret) + goto err_dec; + + ret =crypto_register_kpp (&dh); +if (ret) + goto err_unreg_akcipher; + +mutex_unlock (&algs_lock); +return 0 ; + +err_unreg_akcipher: +crypto_unregister_akcipher (&rsa); +err_dec: + active_devs--; unlock:mutex_unlock (&algs_lock);return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 459/1756 crypto: atmel-sha - reject initialization without a device
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Slavin Liu <[email protected]>
[ Upstream commit a9a2152d292fd0bc73814eb4a127278ee7dd3f6a ]
A transform may be initialized for the first time after the last device has been removed from the driver list. Return -ENODEV when the lookup is empty, before the debug message reads dd->dev.
Detected by static analysis and reviewed with AI-assisted source auditing.
--- drivers/crypto/atmel-sha.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/atmel-sha.c +3 -0
@@ -430,6 +430,9 @@ static int atmel_sha_init(struct ahash_request *req)struct atmel_sha_reqctx *ctx =ahash_request_ctx (req);struct atmel_sha_dev *dd =atmel_sha_find_dev (tctx); +if (!dd) +return -ENODEV ; + ctx->dd = dd; ctx->flags =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 460/1756 interconnect: exynos: Remove the PM QoS request on unbind
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit 601a54f00723b0b653d76caf26a2a78482d95f00 ]
The Exynos interconnect provider adds a minimum-frequency PM QoS request to its parent devfreq device. The request is embedded in the provider's device-managed private data.
The probe error path removes the request, but the remove callback does not. Unbinding the provider while the parent device remains registered therefore frees the private data with the request still on the parent's QoS list. The child's device cleanup does not remove requests registered against its parent.
Remove the request after deregistering the provider, before the private data is released.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/interconnect/samsung/exynos.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/samsung/exynos.c +1 -0
@@ -98,6 +98,7 @@ static void exynos_generic_icc_remove(struct platform_device *pdev)struct exynos_icc_priv *priv =platform_get_drvdata (pdev);icc_provider_deregister (&priv->provider); +dev_pm_qos_remove_request (&priv->qos_req);icc_nodes_remove (&priv->provider); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 461/1756 interconnect: qcom: icc-rpm: Handle icc_link_create() failures
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit b2079a6b8e8b92c6c45a22930e5b68a9c5c34645 ]
icc_link_create() can return errors. Don't ignore them.
--- drivers/interconnect/qcom/icc-rpm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/interconnect/qcom/icc-rpm.c +9 -2
@@ -581,8 +581,15 @@ int qnoc_probe(struct platform_device *pdev) node->data = qnodes[i];icc_node_add (node, provider); -for (j =0 ; j < qnodes[i]->num_links; j++) -icc_link_create (node, qnodes[i]->links[j]); +for (j =0 ; j < qnodes[i]->num_links; j++) { + ret =icc_link_create (node, qnodes[i]->links[j]); +if (ret) { +icc_nodes_remove (provider); +clk_bulk_disable_unprepare (qp->num_intf_clks, + qp->intf_clks); + goto err_disable_unprepare_clk; + } + }/* Set QoS registers (we only need to do it once, generally) */ if (qnodes[i]->qos.ap_owned &&
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 462/1756 interconnect: qcom: use 64-bit SMD RPM bus votes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 24e7422ce31189502d07279c083646aaca513311 ]
SMD RPM bus bandwidth requests carry a 64-bit bandwidth value. The interconnect proxy declared the KVP payload as u32, truncating votes above 4 GiB/s and advertising the wrong payload size to RPM.
Use a little-endian 64-bit payload and accept a u64 value in the proxy API. This has always been the right behavior, even on msm-3.10 and 32-bit SoCs.
--- drivers/interconnect/qcom/icc-rpm.h | 4 ++-- drivers/interconnect/qcom/smd-rpm.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/interconnect/qcom/icc-rpm.h +2 -2
@@ -30,7 +30,7 @@ enum qcom_icc_type {* @resource_type: RPM resource type of the clock resource * @clock_id: index of the clock resource of a specific resource type * @branch: whether the resource represents a branch clock -*/ +*/ struct rpm_clk_resource {u32 resource_type;u32 clock_id;
@@ -164,7 +164,7 @@ int qnoc_probe(struct platform_device *pdev);void qnoc_remove (struct platform_device *pdev);bool qcom_icc_rpm_smd_available (void ); -int qcom_icc_rpm_smd_send (int ctx,int rsc_type,int id,u32 val); +int qcom_icc_rpm_smd_send (int ctx,int rsc_type,int id,u64 val);int qcom_icc_rpm_set_bus_rate (const struct rpm_clk_resource *clk,int ctx,u32 rate);#endif
drivers/interconnect/qcom/smd-rpm.c +4 -4
@@ -21,7 +21,7 @@ static struct qcom_smd_rpm *icc_smd_rpm;struct icc_rpm_smd_req {__le32 key;__le32 nbytes; -__le32 value; +__le64 value; };bool qcom_icc_rpm_smd_available (void )
@@ -30,12 +30,12 @@ bool qcom_icc_rpm_smd_available(void) }EXPORT_SYMBOL_GPL (qcom_icc_rpm_smd_available); -int qcom_icc_rpm_smd_send (int ctx,int rsc_type,int id,u32 val) +int qcom_icc_rpm_smd_send (int ctx,int rsc_type,int id,u64 val) {struct icc_rpm_smd_req req = { .key =cpu_to_le32 (RPM_KEY_BW ), - .nbytes =cpu_to_le32 (sizeof (u32)), - .value =cpu_to_le32 (val), + .nbytes =cpu_to_le32 (sizeof (u64)), + .value =cpu_to_le64 (val), }; return qcom_rpm_smd_write(icc_smd_rpm, ctx, rsc_type, id, &req,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 463/1756 RDMA/core: Fix swapped list_add_tail() arguments in ib_add_sub_device()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit fad7b0dcb0821c0f201df3d85065145857a6f55b ]
ib_add_sub_device() links a new sub-device into its parent's sub-device list with:
list_add_tail(&parent->subdev_list_head, &sub->subdev_list);
list_add_tail(new, head) expects the node to insert as the first argument and the list head as the second, so the call above does the opposite of what was intended: it treats the parent's list head as the new node and the sub-device's node as the list head.
Because _ib_alloc_device() initialises subdev_list to a self-referencing empty head, the misplaced insertion does not crash, but it corrupts the parent->subdev_list_head list. After adding two or more sub-devices, only the last one is reachable through the parent's head, and ib_del_sub_device_and_put()'s list_del() on &sub->subdev_list rewrites the head pointers, potentially severing earlier sub-devices from the chain. During parent teardown, the reverse iteration over subdev_list_head then skips the orphaned sub-devices, so their del_sub_dev() callbacks are never invoked and ib_device_put() on the parent is never paired, leaking both the HW sub-devices and a refcount.
Swap the arguments to match the documented intent: insert the sub-device node into the parent's list head.
--- drivers/infiniband/core/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/device.c +1 -1
@@ -2846,7 +2846,7 @@ int ib_add_sub_device(struct ib_device *parent, sub->parent = parent;mutex_lock (&parent->subdev_lock); -list_add_tail (&parent->subdev_list_head, &sub->subdev_list); +list_add_tail (&sub->subdev_list, &parent->subdev_list_head);mutex_unlock (&parent->subdev_lock);return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 464/1756 RDMA/restrack: Dont set RESTRACK_DD mark after a failed xa_insert()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 391c5d826fd0a5dacad54613dbef74c50e966f5c ]
When adding a QP to the restrack xarray, rdma_restrack_add() does:
ret = xa_insert(&rt->xa, res->id, res, GFP_KERNEL); if (ret) res->id = 0; if (qp->qp_type >= IB_QPT_DRIVER) xa_set_mark(&rt->xa, res->id, RESTRACK_DD);
The xa_set_mark() call is not guarded by "!ret". When xa_insert() fails (possible on a qp_num collision or memory pressure), res->id is reset to 0, yet the mark is still applied to index 0. If a legitimate QP whose qp_num is 0 already occupies that slot - e.g. a normal QP or the SMI QP
- it is spuriously tagged as driver-private (RESTRACK_DD), and the netlink dump path res_get_common_dumpit() then hides it from "rdma res" output whenever the caller does not request driver details.
Only set the mark when the insertion actually succeeded by folding the mark into the non-failure branch.
--- drivers/infiniband/core/restrack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/core/restrack.c +1 -2
@@ -246,8 +246,7 @@ void rdma_restrack_add(struct rdma_restrack_entry *res) ret =xa_insert (&rt->xa, res->id, res,GFP_KERNEL );if (ret) res->id =0 ; - -if (qp->qp_type >=IB_QPT_DRIVER ) +else if (qp->qp_type >=IB_QPT_DRIVER )xa_set_mark (&rt->xa, res->id,RESTRACK_DD ); }else if (res->type ==RDMA_RESTRACK_COUNTER ) {/* Special case to ensure that cntn points to right counter */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 465/1756 RDMA/uverbs: Drop restrack ref on ib_init_ucontext() failure in GET_CONTEXT
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 9dcacdc41083cccff74292851bf9fde999e0731a ]
The UVERBS_METHOD_GET_CONTEXT handler allocates the ucontext via ib_alloc_ucontext(), which calls rdma_restrack_new() (initialising the kref to 1) and rdma_restrack_set_name(NULL), the latter attaching the current task and taking a task_struct reference. When ib_init_ucontext() subsequently fails, the error path only does:
kfree(attrs->context); attrs->context = NULL;
without first calling rdma_restrack_put() on &attrs->context->res. The kref therefore never reaches zero, restrack_release() is never invoked, and put_task_struct() is never called, so the task_struct reference taken during set_name is leaked permanently.
A local user with access to an RDMA device can repeat this path (e.g. by hitting an RDMA cgroup limit or supplying invalid ucaps) and leak one task_struct reference per attempt, eventually preventing those processes from being reaped or exhausting memory.
The legacy ib_uverbs_get_context() path already handles this correctly at its err_ucontext label, where rdma_restrack_put() precedes kfree(). Mirror that ordering here.
--- drivers/infiniband/core/uverbs_std_types_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/core/uverbs_std_types_device.c +1 -0
@@ -231,6 +231,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_GET_CONTEXT)(return ret; ret =ib_init_ucontext (attrs);if (ret) { +rdma_restrack_put (&attrs->context->res);kfree (attrs->context); attrs->context =NULL ;return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 466/1756 ACPI: CPPC: Validate the _CPC package header
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Loehle <[email protected]>
[ Upstream commit fb345025f161d17fe7c8a6048c7e80e467fa8ddf ]
The _CPC NumEntries field includes every package element, including NumEntries and Revision. acpi_cppc_processor_probe() nevertheless reads those first two elements before checking that they exist and trusts NumEntries when walking the remaining elements.
Reject packages with fewer than two elements and NumEntries values which exceed the package count before accessing Revision or iterating over register descriptors. Although the specification defines NumEntries as the number of package elements, tolerate additional trailing elements because ignoring them is safe and avoids rejecting padded firmware.
Revision is specified as a BYTE, but the parser assigns its 64-bit AML Integer to an unsigned int before validating it. Reject values above U8_MAX before conversion so, for example, 0x100000004 cannot truncate to revision 4.
--- drivers/acpi/cppc_acpi.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/acpi/cppc_acpi.c +18 -4
@@ -737,6 +737,11 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) } out_obj = (union acpi_object *) output.pointer; +if (out_obj->package.count <2 ) { +pr_debug ("Unexpected _CPC package count (%u) for CPU:%d\n" , + out_obj->package.count, pr->id); + goto out_buf_free; + } cpc_ptr =kzalloc (sizeof (struct cpc_desc ),GFP_KERNEL );if (!cpc_ptr) {
@@ -747,12 +752,15 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)/* First entry is NumEntries. */ cpc_obj = &out_obj->package.elements[0 ];if (cpc_obj->type ==ACPI_TYPE_INTEGER ) { - num_ent = cpc_obj->integer.value; -if (num_ent <=1 ) { -pr_debug ("Unexpected _CPC NumEntries value (%d) for CPU:%d\n" , - num_ent, pr->id); +if (cpc_obj->integer.value <2 || + cpc_obj->integer.value > out_obj->package.count) { +pr_debug ("Invalid _CPC NumEntries (%llu) for package count (%u) on CPU:%d\n" , + cpc_obj->integer.value, out_obj->package.count, + pr->id); goto out_free; } + + num_ent = cpc_obj->integer.value; }else {pr_debug ("Unexpected _CPC NumEntries entry type (%d) for CPU:%d\n" , cpc_obj->type, pr->id);
@@ -762,6 +770,12 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)/* Second entry should be revision. */ cpc_obj = &out_obj->package.elements[1 ];if (cpc_obj->type ==ACPI_TYPE_INTEGER ) { +if (cpc_obj->integer.value >U8_MAX ) { +pr_debug ("Invalid _CPC Revision (%llu) for CPU:%d\n" , + cpc_obj->integer.value, pr->id); + ret = -EINVAL ; + goto out_free; + } cpc_rev = cpc_obj->integer.value; }else { pr_debug("Unexpected _CPC Revision entry type (%d) for CPU:%d\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 467/1756 spi: mxic: fix ps_clk leak in runtime resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit 648e3c436032b675b339662ea9c0edd9221add76 ]
mxic_spi_runtime_resume() enables ps_clk before calling mxic_spi_clk_enable(). If the latter fails, ps_clk was not disabled.
Unwind ps_clk with clk_disable_unprepare() before returning the error.
--- drivers/spi/spi-mxic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-mxic.c +7 -1
@@ -734,7 +734,13 @@ static int __maybe_unused mxic_spi_runtime_resume(struct device *dev)return ret; } -return mxic_spi_clk_enable (mxic); + ret =mxic_spi_clk_enable (mxic); +if (ret) { +clk_disable_unprepare (mxic->ps_clk); +return ret; + } + +return 0 ; }static const struct dev_pm_ops mxic_spi_dev_pm_ops = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 468/1756 ACPI: HMAT: preserve hmat_adist_nb notifier block
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alejandro Lucero <[email protected]>
[ Upstream commit b1c75a77d494298b8dedf46062f2072239bbc33b ]
Remove __meminitdata from hmat_adist_nb declaration preserving it even when CONFIG_MEMORY_HOTPLUG is not set. Otherwise further notifier registrations using register_mt_adistance_algorithm() will find a notifier chain likely corrupted.
This is the case when cxl_region_probe() calls register_mt_adistance_algorithm() what can happen when CXL regions are dynamically created at any time from Type3 device(s) or when a Type2 device is initialized at its driver probe.
--- drivers/acpi/numa/hmat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/numa/hmat.c +1 -1
@@ -984,7 +984,7 @@ static int hmat_calculate_adistance(struct notifier_block *self,return NOTIFY_STOP ; } -static struct notifier_block hmat_adist_nb__meminitdata = { +static struct notifier_block hmat_adist_nb = { .notifier_call = hmat_calculate_adistance, .priority =100 , };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 469/1756 dt-bindings: vendor-prefixes: add ESS Technology
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Asseily <[email protected]>
[ Upstream commit beb56d1d3de522885b30bb97fee83825041d65c2 ]
Add the vendor prefix for ESS Technology, Inc., maker of the SABRE family of audio DACs. The prefix follows the company's domain, esstech.com.
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -480,6 +480,8 @@ patternProperties: description: Seiko Epson Corp. "^esp,.*": description: Espressif Systems Co. Ltd. + "^esstech,.*": + description: ESS Technology, Inc. "^est,.*": description: ESTeem Wireless Modems "^ettus,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 470/1756 clk: raspberrypi: Handle cpufreq device registration failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Triet Hoang <[email protected]>
[ Upstream commit e98e3d712023859af7cd78bb7fdb87ea3a9ffb83 ]
Check the return value of platform_device_register_data() when registering the raspberrypi-cpufreq device and propagate the error if registration fails.
This prevents the clock driver from reporting a successful probe when the cpufreq device could not be registered.
--- drivers/clk/bcm/clk-raspberrypi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/bcm/clk-raspberrypi.c +2 -0
@@ -437,6 +437,8 @@ static int raspberrypi_clk_probe(struct platform_device *pdev) rpi->cpufreq =platform_device_register_data (dev,"raspberrypi-cpufreq" ,-1 ,NULL ,0 ); +if (IS_ERR (rpi->cpufreq)) +return PTR_ERR (rpi->cpufreq);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 471/1756 clk: versatile: clk-icst: Fix node reference leak in of_syscon_icst_setup()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit c90a50d07f0c38c62ce13a60806ab5e3b841f70f ]
of_get_parent() takes a reference on the syscon parent node. The reference is intentionally kept on the success path, but the error paths return without dropping it, leaking the node reference. Release the reference before returning on the error paths.
--- drivers/clk/versatile/clk-icst.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/versatile/clk-icst.c +4 -0
@@ -498,16 +498,19 @@ static void __init of_syscon_icst_setup(struct device_node *np) map =syscon_node_to_regmap (parent);if (IS_ERR (map)) {pr_err ("no regmap for syscon ICST clock parent\n" ); +of_node_put (parent);return ; }if (of_property_read_u32 (np,"reg" , &icst_desc.vco_offset) &&of_property_read_u32 (np,"vco-offset" , &icst_desc.vco_offset)) {pr_err ("no VCO register offset for ICST clock\n" ); +of_node_put (parent);return ; }if (of_property_read_u32 (np,"lock-offset" , &icst_desc.lock_offset)) {pr_err ("no lock register offset for ICST clock\n" ); +of_node_put (parent);return ; }
@@ -534,6 +537,7 @@ static void __init of_syscon_icst_setup(struct device_node *np) ctype =ICST_INTEGRATOR_CP_CM_MEM ; }else {pr_err ("unknown ICST clock %pOF\n" , np); +of_node_put (parent);return ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 472/1756 clk: starfive: jh7110: reject oscillator lookup errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Slavin Liu <[email protected]>
[ Upstream commit 54d0b6903921d121fa750546f2b38cc3f5c7e64f ]
Clock lookup may fail while allocating a consumer reference. Return a notifier error rather than passing ERR_PTR as the new clock parent.
Detected by static analysis and reviewed with AI-assisted source auditing.
--- drivers/clk/starfive/clk-starfive-jh7110-sys.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/starfive/clk-starfive-jh7110-sys.c +3 -0
@@ -401,6 +401,9 @@ static int jh7110_pll0_clk_notifier_cb(struct notifier_block *nb,if (action ==PRE_RATE_CHANGE ) {struct clk *osc =clk_get (priv->dev,"osc" ); +if (IS_ERR (osc)) +return notifier_from_errno (PTR_ERR (osc)); + priv->original_clk =clk_get_parent (cpu_root); ret =clk_set_parent (cpu_root, osc);clk_put (osc);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 473/1756 bpf, lsm: Reject writes into the BPF LSM program context
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit c42da1d3ba9d5067cf3f0676b98bcb3f5f9e3ce1 ]
The verifier types a load from a tracing-style context by its offset
alone: btf_ctx_access() looks the offset up in the attach hook's prototype, and check_mem_access() stamps the resulting type onto the destination register. Nothing tracks what the slot actually holds. That is sound only as long as the context is read-only, and for BPF LSM it is not. lsm_verifier_ops wires ->is_valid_access() straight to btf_ctx_access(), which never looks at enum bpf_access_type, so a store into the context passes verification. Every other user of the helper either goes through bpf_tracing_btf_ctx_access() or open-codes the same type != BPF_READ test first; BPF LSM is the only one that does neither.
A program can therefore store a scalar of its choosing into a context slot, read the slot back, and get a register the verifier believes is a trusted pointer of the hook's argument type. Handing that to a kfunc or helper which dereferences a trusted argument turns it into an arbitrary kernel access. Route BPF LSM through bpf_tracing_btf_ctx_access() like everyone else.
--- kernel/bpf/bpf_lsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/bpf_lsm.c +2 -2
@@ -408,8 +408,8 @@ const struct bpf_prog_ops lsm_prog_ops = { };const struct bpf_verifier_ops lsm_verifier_ops = { - .get_func_proto = bpf_lsm_func_proto, - .is_valid_access = btf_ctx_access, + .get_func_proto = bpf_lsm_func_proto, + .is_valid_access = bpf_tracing_btf_ctx_access, };/* hooks return 0 or 1 */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 474/1756 pinctrl: fix PINCTRL_SPPCTL=m
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Gaylard <[email protected]>
[ Upstream commit 7dcf87d2dbbe8c9c1efb69fe9be728a3dfd51d3d ]
The PINCTRL_SPPCTL option is defined as a tristate in Kconfig, and the help text suggests that the user can build it as a module by setting to 'm'.
However, it cannot currently be set to 'm', because SOC_SP7021, the only platform that supports it, is a bool option that uses 'select' on it. Also, the SP7021 requires this driver to be built in, in order to boot.
Change the tristate to bool and fix the help text.
Tested on linux-next-2026-09-14 on a LTPP3G2 board.
This impossible tristate was detected by kconfirm, a static analysis tool for Kconfig, by Julian Braha <[email protected]>.
--- drivers/pinctrl/sunplus/Kconfig | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/pinctrl/sunplus/Kconfig +3 -5
@@ -4,8 +4,8 @@ # config PINCTRL_SPPCTL - tristate "Sunplus SP7021 PinMux and GPIO driver" - depends on SOC_SP7021 + bool "Sunplus SP7021 PinMux and GPIO driver" + depends on SOC_SP7021 || COMPILE_TEST depends on OF && HAS_IOMEM select GENERIC_PINCTRL_GROUPS select GENERIC_PINMUX_FUNCTIONS
@@ -17,6 +17,4 @@ config PINCTRL_SPPCTL help Say Y here to support Sunplus SP7021 pinmux controller. This driver requires the pinctrl framework. - GPIO is provided by the same driver. - To compile this driver as a module, choose M here. - The module will be called sppinctrl. + This driver also provides GPIO.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 475/1756 fs/ntfs3: check INDEX_ROOT resident size before use in ntfs_read_mft()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei (Microsoft) <[email protected]>
[ Upstream commit d0ac69ce3af4dbae01d4f064b7482f0c5440dbde ]
When ntfs_read_mft() parses an ATTR_ROOT attribute it computes
root = Add2Ptr(attr, roff);
using the on-disk resident data offset (roff = attr->res.data_off) and then dereferences root->type and root->rule, and later passes root on to indx_init(). Unlike the ATTR_STD and ATTR_NAME cases, which validate that the resident data is large enough (asize >= sizeof(struct X) + roff and rsize >= sizeof(struct X)) before accessing it, the ATTR_ROOT case has no such check.
mi_enum_attr() only guarantees data_off + data_size <= attribute size, so a crafted image can set data_off such that root lands at (or past) the end of the MFT record's slab allocation while still passing that check (e.g. data_size == 0). The subsequent read of root->type is then a slab-out-of-bounds read, reported by KASAN when mounting the image:
BUG: KASAN: slab-out-of-bounds in ntfs_iget5 (fs/ntfs3/inode.c:283) Read of size 4 at addr ffff88800c06a400 by task exploit/142 Call Trace: ... [KASAN report internals] ntfs_iget5 (fs/ntfs3/inode.c:283 fs/ntfs3/inode.c:542) ntfs_fill_super (fs/ntfs3/super.c:1690) get_tree_bdev_flags (fs/super.c:1634) vfs_get_tree (fs/super.c:1694) fc_mount (fs/namespace.c:1198) path_mount (fs/namespace.c:3765 ...) __x64_sys_mount (fs/namespace.c:4174 ...) do_syscall_64 (arch/x86/entry/syscall_64.c:63) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121) The buggy address is located 0 bytes to the right of allocated 1024-byte region [ffff88800c06a000, ffff88800c06a400) which belongs to the cache kmalloc-1k of size 1024
Validate the resident data size in the ATTR_ROOT case the same way the neighbouring cases do, so that a truncated or mis-offset INDEX_ROOT is rejected before root is dereferenced.
--- fs/ntfs3/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ntfs3/inode.c +3 -1
@@ -283,7 +283,9 @@ static struct inode *ntfs_read_mft(struct inode *inode,break ;case ATTR_ROOT : -if (attr->non_res) +if (attr->non_res || + asize <sizeof (struct INDEX_ROOT ) + roff || + rsize <sizeof (struct INDEX_ROOT )) goto out; root =Add2Ptr (attr, roff);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 476/1756 fs/ntfs3: fix valid_size not being updated in attr_allocate_frame()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhan Xusheng <[email protected]>
[ Upstream commit a1972501ffb15313f7ae598989bb2cd32829e625 ]
At the end of attr_allocate_frame() the on-disk valid_size is meant to be updated to the value passed in via @new_valid:
valid_size = le64_to_cpu(attr_b->nres.valid_size);
if (new_valid != valid_size) {
attr_b->nres.valid_size = cpu_to_le64(valid_size);
mi_b->dirty = true;
}but it writes back the old valid_size that was just read instead of new_valid, so the field is never actually changed even though the record is marked dirty -- the intended update is a no-op.
ni_update_parent() spells the same read-compare-write out correctly a few hundred lines away, storing the newly derived value:
valid_le = cpu_to_le64(new_valid);
if (valid_le != attr->nres.valid_size) {
attr->nres.valid_size = valid_le;In practice that path, reached from ni_write_inode(), re-derives nres.valid_size from ni->i_valid on inode write-back, which normally masks this, so the visible impact is limited. The assignment here is still wrong though; store @new_valid as intended.
--- fs/ntfs3/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/attrib.c +1 -1
@@ -1868,7 +1868,7 @@ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size, valid_size =le64_to_cpu (attr_b->nres.valid_size);if (new_valid != valid_size) { - attr_b->nres.valid_size =cpu_to_le64 (valid_size); + attr_b->nres.valid_size =cpu_to_le64 (new_valid); mi_b->dirty = true; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 477/1756 fs/ntfs3: validate EA entry layout against ef->size in ntfs_read_ea
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 01e56820ef52d14a5560fb7c0c6f2f75ef6f9393 ]
In ntfs_read_ea(), the ef->size branch only checks that the declared entry size fits the remaining buffer; unlike the zero-size branch it never verifies that the entry's own name and value fit inside ef->size. A crafted image can thus present an in-bounds ef->size with an arbitrary elength, which find_ea()/ntfs_get_ea() later use as the memcpy length, reading past the allocation and leaking adjacent heap memory:
BUG: KASAN: slab-out-of-bounds in ntfs_get_ea (fs/ntfs3/xattr.c:302) Read of size 65535 at addr ffff888010770b0f by task exploit/142 ... __asan_memcpy (mm/kasan/shadow.c:105) ntfs_get_ea (fs/ntfs3/xattr.c:302) ntfs_getxattr (fs/ntfs3/xattr.c:848) __vfs_getxattr (fs/xattr.c:446) vfs_getxattr (fs/xattr.c:479) do_getxattr (fs/xattr.c:808) filename_getxattr (fs/xattr.c:837) path_getxattrat (fs/xattr.c:876) do_syscall_64 (arch/x86/entry/syscall_64.c:94) ... The buggy address is located 15 bytes inside of allocated 20-byte region, cache kmalloc-32
Validate the name/value layout in the ef->size branch too, bounding it against ef->size, as the zero-size branch validates it against the buffer.
--- fs/ntfs3/xattr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ntfs3/xattr.c +2 -0
@@ -168,6 +168,8 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea, ea_size =le32_to_cpu (ef->size);if (ea_size > bytes || packed_size > ea_size) goto out1; +if (bytes < offsetof(struct EA_FULL , name)) + goto out1;continue ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 478/1756 fs/ntfs3: validate $SDH entry size in ntfs_insert_security
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
[ Upstream commit 5b76487f94dacc2884135ce9a7bda61ce7ffa209 ]
ntfs_insert_security() walks the $Secure::$SDH index and reads e->sec_hdr.size for every entry returned by indx_find()/indx_find_sort(). Those only guarantee the NTFS_DE envelope (e->size), so a crafted $SDH entry shorter than a full NTFS_DE_SDH at the tail of an index buffer makes the read of e->sec_hdr.size run past the allocation. Triggerable by an unprivileged setxattr(2) on a crafted NTFS image.
BUG: KASAN: slab-out-of-bounds in ntfs_insert_security (fs/ntfs3/fsntfs.c:2148) Read of size 4 at addr ffff88800fa1de00 by task exploit/142 ntfs_insert_security (fs/ntfs3/fsntfs.c:2148) ntfs_setxattr (fs/ntfs3/xattr.c:947) __vfs_setxattr (fs/xattr.c:223) __vfs_setxattr_noperm (fs/xattr.c:257) vfs_setxattr (fs/xattr.c:344) filename_setxattr (fs/xattr.c:690) path_setxattrat (fs/xattr.c:734) __x64_sys_setxattr (fs/xattr.c:764) [...] The buggy address is located 0 bytes to the right of allocated 512-byte region [ffff88800fa1dc00, ffff88800fa1de00)
Stop the scan when an entry is too small to hold a SECURITY_HDR.
--- fs/ntfs3/fsntfs.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ntfs3/fsntfs.c +3 -0
@@ -2160,6 +2160,9 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, goto out;while (e) { +if (le16_to_cpu (e->de.size) <SIZEOF_SDH_DIRENTRY ) +break ; +if (le32_to_cpu (e->sec_hdr.size) == new_sec_size) { err = ntfs_read_run_nb(sbi, &ni->file.run, le64_to_cpu(e->sec_hdr.off),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 479/1756 pmdomain: imx: Propagate SCU provider registration failures
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit d3efba7921f3ebebd91fc481910a428c78414fd8 ]
imx_scu_init_pm_domains() ignores of_genpd_add_provider_onecell() and returns success even when none of the initialized domains are published to DT consumers.
Return the provider error and remove the initialized domains in reverse order before devm releases their backing storage on probe failure.
The issue was found by our static-analysis tool and manually reviewed.
--- drivers/pmdomain/imx/scu-pd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pmdomain/imx/scu-pd.c +8 -2
@@ -474,7 +474,7 @@ static int imx_scu_init_pm_domains(struct device *dev,struct genpd_onecell_data *pd_data;struct imx_sc_pm_domain *sc_pd;u32 count =0 ; -int i, j; +int i, j, ret;for (i =0 ; i < pd_soc->num_ranges; i++) count += pd_ranges[i].num;
@@ -503,7 +503,13 @@ static int imx_scu_init_pm_domains(struct device *dev, pd_data->num_domains = count; pd_data->xlate = imx_scu_pd_xlate; -of_genpd_add_provider_onecell (dev->of_node, pd_data); + ret =of_genpd_add_provider_onecell (dev->of_node, pd_data); +if (ret) { +while (count) +pm_genpd_remove (domains[--count]); + +return ret; + }return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 480/1756 dt-bindings: vendor-prefixes: add vendor prefix for Nexperia B.V.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Armstrong <[email protected]>
[ Upstream commit 819a3e62d37a2fe73c1e7f241f2ac086042e7757 ]
Document the vendor prefix for the semiconductor company Nexperia B.V.
The company website is https://www.nexperia.com/
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1041,6 +1041,8 @@ patternProperties: description: New Vision Display (Shenzhen) Co., Ltd. "^nexbox,.*": description: Nexbox + "^nexperia,.*": + description: Nexperia B.V. "^nextthing,.*": description: Next Thing Co. "^ni,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 481/1756 bpftool: Using the right format specifiers
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 17c3dc50294ba445ddc7d50020df6452e93d38b2 ]
Fixed some formatting specifiers errors, such as using %d for int and %u for unsigned int, as well as other byte-length types.
Stable-dep-of: a885470df10b ("bpftool: Compute map size of light skeletons at runtime")
--- tools/bpf/bpftool/gen.c | 12 ++++++------ tools/bpf/bpftool/link.c | 14 +++++++------- tools/bpf/bpftool/main.c | 8 ++++---- tools/bpf/bpftool/map.c | 10 +++++----- 4 files changed, 22 insertions(+), 22 deletions(-)
tools/bpf/bpftool/gen.c +6 -6
@@ -670,7 +670,7 @@ static void codegen_destroy(struct bpf_object *obj, const char *obj_name)continue ;if (bpf_map__is_internal (map) && (bpf_map__map_flags (map) &BPF_F_MMAPABLE )) -printf ("\tskel_free_map_data(skel->%1$s, skel->maps.%1$s.initial_value, %2$zd);\n" , +printf ("\tskel_free_map_data(skel->%1$s, skel->maps.%1$s.initial_value, %2$zu);\n" , ident,bpf_map_mmap_sz (map)); codegen("\ \n\
@@ -984,7 +984,7 @@ static int walk_st_ops_shadow_vars(struct btf *btf, const char *ident, offset = m->offset /8 ;if (next_offset < offset) -printf ("\t\t\tchar __padding_%d[%d];\n" , i, offset - next_offset); +printf ("\t\t\tchar __padding_%d[%u];\n" , i, offset - next_offset);switch (btf_kind (member_type)) {case BTF_KIND_INT :
@@ -1052,7 +1052,7 @@ static int walk_st_ops_shadow_vars(struct btf *btf, const char *ident,/* Cannot fail since it must be a struct type */ size =btf__resolve_size (btf, map_type_id);if (next_offset < (__u32 )size) -printf ("\t\t\tchar __padding_end[%d];\n" , size - next_offset); +printf ("\t\t\tchar __padding_end[%u];\n" , size - next_offset); out:btf_dump__free (d);
@@ -2095,7 +2095,7 @@ btfgen_mark_type(struct btfgen_info *info, unsigned int type_id, bool follow_poibreak ;/* tells if some other type needs to be handled */ default : -p_err ("unsupported kind: %s (%d)" ,btf_kind_str (btf_type), type_id); +p_err ("unsupported kind: %s (%u)" ,btf_kind_str (btf_type), type_id);return -EINVAL ; }
@@ -2147,7 +2147,7 @@ static int btfgen_record_field_relo(struct btfgen_info *info, struct bpf_core_sp btf_type =btf__type_by_id (btf, type_id);break ;default : -p_err ("unsupported kind: %s (%d)" , +p_err ("unsupported kind: %s (%u)" ,btf_kind_str (btf_type), btf_type->type);return -EINVAL ; }
@@ -2246,7 +2246,7 @@ static int btfgen_mark_type_match(struct btfgen_info *info, __u32 type_id, bool }/* tells if some other type needs to be handled */ default : -p_err ("unsupported kind: %s (%d)" ,btf_kind_str (btf_type), type_id); +p_err ("unsupported kind: %s (%u)" ,btf_kind_str (btf_type), type_id);return -EINVAL ; }
tools/bpf/bpftool/link.c +7 -7
@@ -107,7 +107,7 @@ static int link_parse_fd(int *argc, char ***argv) fd =bpf_link_get_fd_by_id (id);if (fd <0 ) -p_err ("failed to get link with ID %d: %s" , id,strerror (errno)); +p_err ("failed to get link with ID %u: %s" , id,strerror (errno));return fd; }else if (is_prefix (**argv,"pinned" )) {char *path;
@@ -404,7 +404,7 @@ static char *perf_config_hw_cache_str(__u64 config)if (hw_cache)snprintf (str,PERF_HW_CACHE_LEN ,"%s-" , hw_cache);else -snprintf (str,PERF_HW_CACHE_LEN ,"%lld-" , config &0xff ); +snprintf (str,PERF_HW_CACHE_LEN ,"%llu-" , config &0xff ); op =perf_event_name (evsel__hw_cache_op, (config >>8 ) &0xff );if (op)
@@ -412,7 +412,7 @@ static char *perf_config_hw_cache_str(__u64 config) "%s-", op); else snprintf(str + strlen(str), PERF_HW_CACHE_LEN - strlen(str), - "%lld-", (config >> 8) & 0xff); + "%llu-", (config >> 8) & 0xff); result =perf_event_name (evsel__hw_cache_result, config >>16 );if (result)
@@ -420,7 +420,7 @@ static char *perf_config_hw_cache_str(__u64 config) "%s", result); else snprintf(str + strlen(str), PERF_HW_CACHE_LEN - strlen(str), - "%lld", config >> 16); + "%llu", config >> 16);return str; }
@@ -623,7 +623,7 @@ static void show_link_ifindex_plain(__u32 ifindex)else snprintf (devname,sizeof (devname),"(detached)" );if (ret) -snprintf (devname,sizeof (devname),"%s(%d)" , +snprintf (devname,sizeof (devname),"%s(%u)" , tmpname, ifindex);printf ("ifindex %s " , devname); }
@@ -699,7 +699,7 @@ void netfilter_dump_plain(const struct bpf_link_info *info)if (pfname)printf ("\n\t%s" , pfname);else -printf ("\n\tpf: %d" , pf); +printf ("\n\tpf: %u" , pf);if (hookname)printf (" %s" , hookname);
@@ -773,7 +773,7 @@ static void show_uprobe_multi_plain(struct bpf_link_info *info)printf ("func_cnt %u " , info->uprobe_multi.count);if (info->uprobe_multi.pid) -printf ("pid %d " , info->uprobe_multi.pid); +printf ("pid %u " , info->uprobe_multi.pid);printf ("\n\t%-16s %-16s %-16s" ,"offset" ,"ref_ctr_offset" ,"cookies" );for (i =0 ; i < info->uprobe_multi.count; i++) {
tools/bpf/bpftool/main.c +4 -4
@@ -152,7 +152,7 @@ static int do_version(int argc, char **argv) BPFTOOL_MINOR_VERSION, BPFTOOL_PATCH_VERSION);#endif jsonw_name (json_wtr,"libbpf_version" ); -jsonw_printf (json_wtr,"\"%d.%d\"" , +jsonw_printf (json_wtr,"\"%u.%u\"" ,libbpf_major_version (),libbpf_minor_version ());jsonw_name (json_wtr,"features" );
@@ -374,7 +374,7 @@ static int do_batch(int argc, char **argv)while ((cp =strstr (buf,"\\\n" )) !=NULL ) {if (!fgets (contline,sizeof (contline), fp) ||strlen (contline) ==0 ) { -p_err ("missing continuation line on command %d" , +p_err ("missing continuation line on command %u" , lines); err =-1 ; goto err_close;
@@ -385,7 +385,7 @@ static int do_batch(int argc, char **argv) *cp ='\0' ;if (strlen (buf) +strlen (contline) +1 >sizeof (buf)) { -p_err ("command %d is too long" , lines); +p_err ("command %u is too long" , lines); err =-1 ; goto err_close; }
@@ -427,7 +427,7 @@ static int do_batch(int argc, char **argv) err =-1 ; }else {if (!json_output) -printf ("processed %d commands\n" , lines); +printf ("processed %u commands\n" , lines); } err_close:if (fp != stdin)
tools/bpf/bpftool/map.c +5 -5
@@ -285,7 +285,7 @@ static void print_entry_plain(struct bpf_map_info *info, unsigned char *key, }if (info->value_size) {for (i =0 ; i < n; i++) { -printf ("value (CPU %02d):%c" , +printf ("value (CPU %02u):%c" , i, info->value_size >16 ?'\n' :' ' );fprint_hex (stdout, value + i * step, info->value_size," " );
@@ -316,7 +316,7 @@ static char **parse_bytes(char **argv, const char *name, unsigned char *val, }if (i != n) { -p_err ("%s expected %d bytes got %d" , name, n, i); +p_err ("%s expected %u bytes got %u" , name, n, i);return NULL ; }
@@ -462,7 +462,7 @@ static void show_map_header_json(struct bpf_map_info *info, json_writer_t *wtr)jsonw_string_field (wtr,"name" , info->name);jsonw_name (wtr,"flags" ); -jsonw_printf (wtr,"%d" , info->map_flags); +jsonw_printf (wtr,"%u" , info->map_flags); }static int show_map_close_json (int fd,struct bpf_map_info *info)
@@ -588,7 +588,7 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)if (prog_type_str)printf ("owner_prog_type %s " , prog_type_str);else -printf ("owner_prog_type %d " , prog_type); +printf ("owner_prog_type %u " , prog_type); }if (owner_jited) printf("owner%s jited",
@@ -615,7 +615,7 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)printf ("\n\t" );if (info->btf_id) -printf ("btf_id %d" , info->btf_id); +printf ("btf_id %u" , info->btf_id);if (frozen)printf ("%sfrozen" , info->btf_id ?" " :"" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 482/1756 bpftool: Make skeleton C++ compatible with explicit casts
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: WanLi Niu <[email protected]>
[ Upstream commit 4effccde0a0521b220c3585c9a0d8e677d345209 ]
Fix C++ compilation errors in generated skeleton by adding explicit pointer casts and use char * subtraction for offset calculation
error: invalid conversion from 'void*' to '<obj_name>*' [-fpermissive]
| skel = skel_alloc(sizeof(*skel));
| ~~~~~~~~~~^~~~~~~~~~~~~~~
| |
| void*error: arithmetic on pointers to void
| skel->ctx.sz = (void *)&skel->links - (void *)skel;
| ~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~error: assigning to 'struct <obj_name>__<ident> *' from incompatible type 'void *'
| skel-><ident> = skel_prep_map_data((void *)data, 4096,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| sizeof(data) - 1);
| ~~~~~~~~~~~~~~~~~error: assigning to 'struct <obj_name>__<ident> *' from incompatible type 'void *'
| skel-><ident> = skel_finalize_map_data(&skel->maps.<ident>.initial_value,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 4096, PROT_READ | PROT_WRITE, skel->maps.<ident>.map_fd);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Minimum reproducer:
$ cat test.bpf.c int val; // placed in .bss section
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
SEC("raw_tracepoint/sched_wakeup_new") int handle(void *ctx) { return 0; }
$ cat test.cpp
#include <cerrno>
extern "C" {
#include "test.bpf.skel.h"
}
$ bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h
$ clang -g -O2 -target bpf -c test.bpf.c -o test.bpf.o
$ bpftool gen skeleton test.bpf.o -L > test.bpf.skel.h
$ g++ -c test.cpp -I.Stable-dep-of: a885470df10b ("bpftool: Compute map size of light skeletons at runtime")
--- tools/bpf/bpftool/gen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/bpf/bpftool/gen.c +4 -4
@@ -723,10 +723,10 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h { \n\ struct %1$s *skel; \n\ \n\ - skel = skel_alloc(sizeof(*skel)); \n\ + skel = (struct %1$s *)skel_alloc(sizeof(*skel)); \n\ if (!skel) \n\ goto cleanup; \n\ - skel->ctx.sz = (void *)&skel->links - (void *)skel; \n\ + skel->ctx.sz = (char *)&skel->links - (char *)skel; \n\ ", obj_name, opts.data_sz); bpf_object__for_each_map(map, obj) {
@@ -747,7 +747,7 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h \n\ \"; \n\\n\ -skel->%1$s = skel_prep_map_data((void *)data, %2$zd,\n\ +skel->%1$s = (__typeof__(skel->%1$s))skel_prep_map_data((void *)data, %2$zd,\n\ sizeof(data) - 1);\n\ if (!skel->%1$s) \n\ goto cleanup; \n\
@@ -805,7 +805,7 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h codegen("\ \n\ - skel->%1$s = skel_finalize_map_data(&skel->maps.%1$s.initial_value, \n\ + skel->%1$s = (__typeof__(skel->%1$s))skel_finalize_map_data(&skel->maps.%1$s.initial_value,\n\ %2$zd, %3$s, skel->maps.%1$s.map_fd);\n\ if (!skel->%1$s) \n\ return -ENOMEM; \n\
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 483/1756 bpftool: Generate skeleton for global percpu data
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Hwang <[email protected]>
[ Upstream commit 68d4fde73cf78a7ab858ed040f54e1851cc3815c ]
Enhance bpftool to generate skeletons that properly handle global percpu variables. The generated skeleton now includes a dedicated structure for percpu data, allowing users to initialize and access percpu variables more efficiently.
For global percpu variables, the skeleton now includes a nested structure, e.g.:
struct test_global_percpu_data {
struct bpf_object_skeleton *skeleton;
struct bpf_object *obj;
struct {
struct bpf_map *percpu;
} maps;
// ...
struct test_global_percpu_data__percpu {
int data;
char run;
struct {
char set;
int i;
int nums[7];
} struct_data;
int nums[7];
} *percpu;
// ...
}; * The "struct test_global_percpu_data__percpu *percpu" points to
initialized data, which is actually "maps.percpu->mmaped".
* Before loading the skeleton, updating the
"struct test_global_percpu_data__percpu *percpu" modifies the initial
value of the corresponding global percpu variables.
* After loading the skeleton, "maps.percpu->mmaped" has been marked as
read-only in libbpf. If users want to update the global percpu
variables, they have to update the "maps.percpu" map instead.
* For lightweight skeleton, "lskel->percpu" will be protected by
"mprotect(p, sz, PROT_READ)".* For subskeleton, those variables of global percpu data will be skipped.
Stable-dep-of: a885470df10b ("bpftool: Compute map size of light skeletons at runtime")
--- tools/bpf/bpftool/gen.c | 53 +++++++++++++++++++++++++++-------- tools/lib/bpf/skel_internal.h | 24 ++++++++++++++-- 2 files changed, 63 insertions(+), 14 deletions(-)
tools/bpf/bpftool/gen.c +41 -12
@@ -101,6 +101,12 @@ static bool get_map_ident(const struct bpf_map *map, char *buf, size_t buf_sz)return true; } +if (bpf_map__type (map) ==BPF_MAP_TYPE_PERCPU_ARRAY ) { +snprintf (buf, buf_sz,"%s" , name +1 ); +sanitize_identifier (buf); +return true; + } +for (i =0 , n =ARRAY_SIZE (sfxs); i < n; i++) {const char *sfx = sfxs[i], *p;
@@ -117,7 +123,7 @@ static bool get_map_ident(const struct bpf_map *map, char *buf, size_t buf_sz)static bool get_datasec_ident (const char *sec_name,char *buf,size_t buf_sz) { -static const char *pfxs[] = {".data" ,".rodata" ,".bss" ,".kconfig" }; +static const char *pfxs[] = {".data" ,".rodata" ,".bss" ,".percpu" ,".kconfig" };int i, n;/* recognize hard coded LLVM section name */
@@ -254,7 +260,7 @@ static const struct btf_type *find_type_for_map(struct btf *btf, const char *mapreturn NULL ; } -static bool is_mmapable_map (const struct bpf_map *map,char *buf,size_t sz) +static bool is_skel_data (const struct bpf_map *map,char *buf,size_t sz) {size_t tmp_sz;
@@ -263,13 +269,24 @@ static bool is_mmapable_map(const struct bpf_map *map, char *buf, size_t sz)return true; } -if (!bpf_map__is_internal (map) || !(bpf_map__map_flags (map) &BPF_F_MMAPABLE )) +if (!bpf_map__is_internal (map))return false;if (!get_map_ident (map, buf, sz))return false; -return true; +if (bpf_map__map_flags (map) &BPF_F_MMAPABLE ) +return true; + +if (bpf_map__type (map) ==BPF_MAP_TYPE_PERCPU_ARRAY ) +return bpf_map__btf_value_type_id (map) !=0 ; + +return false; +} + +static bool is_mmapable_map (const struct bpf_map *map,char *buf,size_t sz) +{ +return is_skel_data (map, buf, sz) &&bpf_map__type (map) !=BPF_MAP_TYPE_PERCPU_ARRAY ; }static int codegen_datasecs (struct bpf_object *obj,const char *obj_name)
@@ -287,7 +304,7 @@ static int codegen_datasecs(struct bpf_object *obj, const char *obj_name)bpf_object__for_each_map (map, obj) {/* only generate definitions for memory-mapped internal maps */ -if (!is_mmapable_map (map, map_ident,sizeof (map_ident))) +if (!is_skel_data (map, map_ident,sizeof (map_ident)))continue ; sec =find_type_for_map (btf, map_ident);
@@ -517,7 +534,7 @@ static void codegen_asserts(struct bpf_object *obj, const char *obj_name) ", obj_name);bpf_object__for_each_map (map, obj) { -if (!is_mmapable_map (map, map_ident,sizeof (map_ident))) +if (!is_skel_data (map, map_ident,sizeof (map_ident)))continue ; sec =find_type_for_map (btf, map_ident);
@@ -668,8 +685,7 @@ static void codegen_destroy(struct bpf_object *obj, const char *obj_name)bpf_object__for_each_map (map, obj) {if (!get_map_ident (map, ident,sizeof (ident)))continue ; -if (bpf_map__is_internal (map) && - (bpf_map__map_flags (map) &BPF_F_MMAPABLE )) +if (is_skel_data (map, ident,sizeof (ident)))printf ("\tskel_free_map_data(skel->%1$s, skel->maps.%1$s.initial_value, %2$zu);\n" , ident,bpf_map_mmap_sz (map)); codegen("\
@@ -733,7 +749,7 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *hconst void *mmap_data =NULL ;size_t mmap_size =0 ; -if (!is_mmapable_map (map, ident,sizeof (ident))) +if (!is_skel_data (map, ident,sizeof (ident)))continue ; codegen("\
@@ -795,9 +811,23 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *hbpf_object__for_each_map (map, obj) {const char *mmap_flags; -if (!is_mmapable_map (map, ident,sizeof (ident))) +if (!is_skel_data (map, ident,sizeof (ident)))continue ; +if (bpf_map__type (map) ==BPF_MAP_TYPE_PERCPU_ARRAY ) { +codegen ("\ +\n\ +err = skel_protect_map_data(skel->%1$s, &skel->maps.%1$s.initial_value, %2$zd);\n\ +if (err) \n\ +return err; \n\ +#ifdef __KERNEL__ \n\ +skel->%1$s = NULL; \n\ +#endif \n\ +" , + ident,bpf_map_mmap_sz (map)); +continue ; + } +if (bpf_map__map_flags (map) &BPF_F_RDONLY_PROG ) mmap_flags ="PROT_READ" ;else
@@ -901,8 +931,7 @@ codegen_maps_skeleton(struct bpf_object *obj, size_t map_cnt, bool mmaped, bool map->map = &obj->maps.%s; \n\ ", i, bpf_map__name(map), ident); -/* memory-mapped internal maps */ -if (mmaped &&is_mmapable_map (map, ident,sizeof (ident))) { +if (mmaped &&is_skel_data (map, ident,sizeof (ident))) {printf ("\tmap->mmaped = (void **)&obj->%s;\n" , ident); }
tools/lib/bpf/skel_internal.h +22 -2
@@ -125,8 +125,10 @@ static inline void skel_free_map_data(void *p, __u64 addr, size_t sz) {if (addr != ~0ULL )kvfree (p); -/* When addr == ~0ULL the 'p' points to -* ((struct bpf_array *)map)->value. See skel_finalize_map_data. +/* +* When addr == ~0ULL the init buffer has already been released. +* For skel_finalize_map_data(), 'p' points to +* ((struct bpf_array *)map)->value. */ }
@@ -164,6 +166,15 @@ static inline void *skel_finalize_map_data(__u64 *init_val, size_t mmap_sz, int return addr; } +static inline int skel_protect_map_data (void *p,__u64 *init_val,size_t sz) +{ + (void )sz; + +kvfree (p); + *init_val = ~0ULL ; +return 0 ; +} +#else static inline void *skel_alloc (size_t size)
@@ -202,6 +213,15 @@ static inline void *skel_finalize_map_data(__u64 *init_val, size_t mmap_sz, intreturn NULL ; return addr; } + +static inline int skel_protect_map_data (void *p,__u64 *init_val,size_t sz) +{ + (void )init_val; + +if (mprotect (p, sz,PROT_READ )) +return -errno; +return 0 ; +}#endif static inline int skel_closenz (int fd)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 484/1756 bpftool: Compute map size of light skeletons at runtime
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Hwang <[email protected]>
[ Upstream commit a885470df10b1c0dbc011177c19d3fd3bb8af2e9 ]
bpftool rounds memory-mapped data map sizes to the host page size when generating a light skeleton. The generated code therefore uses a 64K mapping size when bpftool runs on a 64K-page host, even if the skeleton runs on a 4K-page target. The target rejects the oversized map mmap(), causing failure of loading the light skeleton.
When try to run 64K-page selftests on 4K-page VM, the error message does not provide the reason about page size.
test_atomics:PASS:atomics skeleton open 0 nsec test_atomics:FAIL:atomics skeleton load unexpected error: -12 (errno 22)
#15 atomics:FAIL
Pass the original map value size and max entries to the generated code and round mmap size to the runtime page size in the user-space light skeleton helpers. This keeps generated light skeletons independent of the build host page size.
--- tools/bpf/bpftool/gen.c | 26 ++++++------------- tools/lib/bpf/skel_internal.h | 48 +++++++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 32 deletions(-)
tools/bpf/bpftool/gen.c +8 -18
@@ -500,16 +500,6 @@ static void print_hex(const char *data, int data_sz) } } -static size_t bpf_map_mmap_sz (const struct bpf_map *map) -{ -long page_sz =sysconf (_SC_PAGE_SIZE); -size_t map_sz; - - map_sz = (size_t )roundup (bpf_map__value_size (map),8 ) *bpf_map__max_entries (map); - map_sz =roundup (map_sz, page_sz); -return map_sz; -} -/* Emit type size asserts for all top-level fields in memory-mapped internal maps. */ static void codegen_asserts (struct bpf_object *obj,const char *obj_name) {
@@ -686,8 +676,8 @@ static void codegen_destroy(struct bpf_object *obj, const char *obj_name)if (!get_map_ident (map, ident,sizeof (ident)))continue ;if (is_skel_data (map, ident,sizeof (ident))) -printf ("\tskel_free_map_data(skel->%1$s, skel->maps.%1$s.initial_value, %2$zu);\n" , - ident,bpf_map_mmap_sz (map)); +printf ("\tskel_free_map_data(skel->%1$s, skel->maps.%1$s.initial_value, %2$u, %3$u);\n" , + ident,bpf_map__value_size (map),bpf_map__max_entries (map)); codegen("\ \n\ skel_closenz(skel->maps.%1$s.map_fd); \n\
@@ -763,13 +753,13 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h \n\ \"; \n\\n\ -skel->%1$s = (__typeof__(skel->%1$s))skel_prep_map_data((void *)data, %2$zd,\n\ +skel->%1$s = (__typeof__(skel->%1$s))skel_prep_map_data((void *)data, %2$u, %3$u,\n\ sizeof(data) - 1);\n\ if (!skel->%1$s) \n\ goto cleanup; \n\ skel->maps.%1$s.initial_value = (__u64) (long) skel->%1$s;\n\ } \n\ - ", ident, bpf_map_mmap_sz(map)); + ", ident, bpf_map__value_size(map), bpf_map__max_entries(map)); } codegen("\ \n\
@@ -817,14 +807,14 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *hif (bpf_map__type (map) ==BPF_MAP_TYPE_PERCPU_ARRAY ) {codegen ("\ \n\ -err = skel_protect_map_data(skel->%1$s, &skel->maps.%1$s.initial_value, %2$zd);\n\ +err = skel_protect_map_data(skel->%1$s, &skel->maps.%1$s.initial_value, %2$u, %3$u);\n\ if (err) \n\ return err; \n\ #ifdef __KERNEL__ \n\ skel->%1$s = NULL; \n\ #endif \n\ " , - ident,bpf_map_mmap_sz (map)); + ident,bpf_map__value_size (map),bpf_map__max_entries (map));continue ; }
@@ -836,11 +826,11 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *hcodegen ("\ \n\ skel->%1$s = (__typeof__(skel->%1$s))skel_finalize_map_data(&skel->maps.%1$s.initial_value,\n\ -%2$zd, %3$s, skel->maps.%1$s.map_fd);\n\ +%2$u, %3$u, %4$s, skel->maps.%1$s.map_fd);\n\ if (!skel->%1$s) \n\ return -ENOMEM; \n\ " , - ident,bpf_map_mmap_sz (map), mmap_flags); + ident,bpf_map__value_size (map),bpf_map__max_entries (map), mmap_flags); } codegen("\ \n\
tools/lib/bpf/skel_internal.h +34 -14
110 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 485/1756 pstore: dont leave an ERR_PTR in the ramoops zone pointer
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <[email protected]>
[ Upstream commit 70fec428c845216da98041b1ae9f16a8f54b3d68 ]
ramoops_init_prz() stores the result of persistent_ram_new() in *prz and returns the error without clearing it when initialization fails. ramoops_probe() then cleans up through ramoops_free_przs(), which hands *prz to persistent_ram_free(); that treats the ERR_PTR as a valid zone and dereferences it, crashing the kernel.
Clear *prz before returning so that cleanup sees a NULL zone.
--- fs/pstore/ram.c | 1 + 1 file changed, 1 insertion(+)
fs/pstore/ram.c +1 -0
@@ -605,6 +605,7 @@ static int ramoops_init_prz(const char *name,if (IS_ERR (*prz)) {int err =PTR_ERR (*prz); + *prz =NULL ;dev_err (dev,"failed to request %s mem region (0x%zx@0x%llx): %d\n" , name, sz, (unsigned long long )*paddr, err);return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 486/1756 pstore: reject persistent RAM zones too small for the buffer header
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <[email protected]>
[ Upstream commit 1b30df8662ac85a6759be4332f3bec7e3cb28efc ]
persistent_ram_buffer_map() computes
prz->buffer_size = size - sizeof(struct persistent_ram_buffer);
without checking that size is large enough to hold the header. A ramoops zone configured with a tiny size (e.g. ramoops.pmsg_size=1) underflows buffer_size to a huge value, which defeats every bounds check in persistent_ram_write() and persistent_ram_write_user(); a write to /dev/pmsg0 then copies user data far past the end of the zone and corrupts kernel memory.
Reject zones that are not larger than the buffer header.
--- fs/pstore/ram_core.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/pstore/ram_core.c +6 -0
@@ -507,6 +507,12 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, prz->paddr = start; prz->size = size; +if (size <=sizeof (struct persistent_ram_buffer )) { +pr_err ("%s: persistent ram zone too small (%#llx bytes)\n" , + prz->label, (unsigned long long )size); +return -EINVAL ; + } +if (pfn_valid (start >>PAGE_SHIFT )) prz->vaddr =persistent_ram_vmap (start, size, memtype);else
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 487/1756 KMSAN: fix memset() when using fortify-source, again
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 3555409e524a0279845f91273ba714998658c163 ]
Both kmsan and fortify-source replace the memset function. When both are enabled at the same time, the kmsan version gets used, which triggers a warning about fortify-source being nonfunctional:
warning: unsafe memset() usage lacked '__write_overflow' symbol in /home/arnd/arm-soc/lib/test_fortify/write_overflow-memset.c
warning: unsafe memset() usage lacked '__write_overflow_field' symbol in /home/arnd/arm-soc/lib/test_fortify/write_overflow_field-memset.c
Commit 78a498c3a227 already tried to address this, but this seems to only have worked for memcpy() and memmove() but not memset(), which is still lacking the macro definition when KMSAN is enabled.
Remove the incorrect #ifndef check around the memset() macro.
--- include/linux/fortify-string.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/fortify-string.h +0 -2
@@ -508,10 +508,8 @@ __FORTIFY_INLINE bool fortify_memset_chk(__kernel_size_t size,* __struct_size() vs __member_size() must be captured here to avoid * evaluating argument side-effects further into the macro layers. */ -#ifndef CONFIG_KMSAN #define memset (p, c, s) __fortify_memset_chk(p, c, s, \ __struct_size(p), __member_size(p)) -#endif /* * To make sure the compiler can enforce protection against buffer overflows,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 488/1756 md/raid5: give the io_unit slab caches per-array names
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yogesh Gaur <[email protected]>
[ Upstream commit 96858e2308431ff5678e0e6fab1a06e19f3d95da ]
Both raid5 log backends create their io_unit slab cache per array but name it after the struct:
ppl_conf->io_kc = KMEM_CACHE(ppl_io_unit, 0); log->io_kc = KMEM_CACHE(r5l_io_unit, 0);
KMEM_CACHE() passes the stringified type as the cache name, so every array that enables PPL or attaches a journal asks for a cache called "ppl_io_unit" or "r5l_io_unit". With two such arrays live at the same time the second one trips kmem_cache_sanity_check():
kmem_cache of name 'ppl_io_unit' already exists
WARNING: mm/slab_common.c:112 at __kmem_cache_create_args+0xae/0x460 ppl_init_log+0x285/0x1310 drivers/md/raid5-ppl.c:1363 log_init drivers/md/raid5-log.h:138 [inline] raid5_change_consistency_policy+0x255/0x740 drivers/md/raid5.c:9141 consistency_policy_store+0x7f/0x230 drivers/md/md.c:5883 md_attr_store+0x3b7/0x640 drivers/md/md.c:6158
which is reachable by any user that can write "ppl" to md/consistency_policy on two arrays, and equally by assembling two journalled arrays. The cache is created and destroyed correctly on every path, so this is a name collision only - duplicate names confuse slabtop and /proc/slabinfo, which is what the check is there to catch.
Build the name from the array instead, the way grow_stripes() already does for the stripe_head cache in this driver, and fall back to the mddev pointer for dm-raid where mdname() is the constant "mdX". The buffer is sized like conf->cache_name[] because mdname() can return up to DISK_NAME_LEN bytes.
The explicit size/align arguments keep what KMEM_CACHE() expanded to, so object layout does not change.
--- drivers/md/raid5-cache.c | 12 +++++++++++- drivers/md/raid5-ppl.c | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-)
drivers/md/raid5-cache.c +11 -1
@@ -3085,6 +3085,7 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev) {struct r5l_log *log;struct md_thread *thread; +char cache_name[48 ];int ret; pr_debug("md/raid:%s: using device %pg as journal\n",
@@ -3124,7 +3125,16 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev)INIT_LIST_HEAD (&log->flushing_ios);INIT_LIST_HEAD (&log->finished_ios); - log->io_kc =KMEM_CACHE (r5l_io_unit,0 ); +if (mddev_is_dm (conf->mddev)) +snprintf (cache_name,sizeof (cache_name),"r5l_io_unit-%p" , + conf->mddev); +else +snprintf (cache_name,sizeof (cache_name),"r5l_io_unit-%s" , +mdname (conf->mddev)); + + log->io_kc =kmem_cache_create (cache_name,sizeof (struct r5l_io_unit ), + __alignof__(struct r5l_io_unit ), +0 ,NULL );if (!log->io_kc) goto io_kc;
drivers/md/raid5-ppl.c +11 -1
@@ -1318,6 +1318,7 @@ int ppl_init_log(struct r5conf *conf) {struct ppl_conf *ppl_conf;struct mddev *mddev = conf->mddev; +char cache_name[48 ];int ret =0 ;int max_disks;int i;
@@ -1360,7 +1361,16 @@ int ppl_init_log(struct r5conf *conf) ppl_conf->mddev = mddev; - ppl_conf->io_kc =KMEM_CACHE (ppl_io_unit,0 ); +if (mddev_is_dm (mddev)) +snprintf (cache_name,sizeof (cache_name),"ppl_io_unit-%p" , mddev); +else +snprintf (cache_name,sizeof (cache_name),"ppl_io_unit-%s" , +mdname (mddev)); + + ppl_conf->io_kc =kmem_cache_create (cache_name, +sizeof (struct ppl_io_unit ), + __alignof__(struct ppl_io_unit ), +0 ,NULL );if (!ppl_conf->io_kc) { ret = -ENOMEM ; goto err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 489/1756 leds: lp8860: Fix device_node leak in lp8860_probe()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miles Krause <[email protected]>
[ Upstream commit f9879086c4eb4b3b0f4baa80139a5720b99b229e ]
lp8860_probe() looks up the driver's single LED child node with of_get_next_available_child() and hands it to the LED core as init_data.fwnode, but never drops the reference that lookup returned:
child_node = of_get_next_available_child(np, NULL); if (!child_node) return -EINVAL; ... init_data.fwnode = of_fwnode_handle(child_node);
of_get_next_available_child() returns the node with its refcount incremented, and the LED core does not take a reference of its own:led_classdev_register_ext() only reads properties out of init_data.fwnode and then stores the bare pointer with device_set_node(). The reference therefore stays owned by the driver for as long as it holds the node.
Nothing in lp8860_probe() ever releases it, so it is leaked on every error return taken after the lookup - the enable GPIO, the vled regulator, devm_mutex_init(), the regmap allocation, the optional EEPROM programming and the LED class registration - and on a fully successful probe alike. A device that binds and unbinds repeatedly leaks one device_node reference per bind.
Sibling drivers already get this right: leds-lm3692x.c, from the same TI LED family, calls fwnode_handle_put(init_data.fwnode) once after devm_led_classdev_register_ext() to cover both outcomes, while leds-ktd2692.c and leds-aat1290.c take the node with __free(device_node).
Use __free(device_node) here too. Unlike a single of_node_put() at the end of probe it also covers the intermediate error returns, and it keeps the node alive for the whole function, which the LED core still needs when it reads the child's properties during registration.
--- drivers/leds/leds-lp8860.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/leds/leds-lp8860.c +3 -2
@@ -7,6 +7,7 @@* Author: Dan Murphy <[email protected]> */ +#include <linux/cleanup.h> #include <linux/i2c.h> #include <linux/init.h> #include <linux/leds.h>
@@ -377,14 +378,14 @@ static int lp8860_probe(struct i2c_client *client)int ret;struct lp8860_led *led;struct device_node *np =dev_of_node (&client->dev); -struct device_node *child_node;struct led_init_data init_data = {}; led =devm_kzalloc (&client->dev,sizeof (*led),GFP_KERNEL );if (!led)return -ENOMEM ; - child_node =of_get_next_available_child (np,NULL ); + struct device_node *child_node __free(device_node) = +of_get_next_available_child (np,NULL );if (!child_node)return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 490/1756 leds: pca9532: Check i2c_smbus_read_byte_data() return value
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haibo Chen <[email protected]>
[ Upstream commit 1b75f038e5f71ed32ce6593b5763f9776ec58a25 ]
Coverity report INTEGER_OVERFLOW (tainted_data_return -> cast_underflow -> overflow) in pca9532_getled(). pca9532_getled() stored the return value of i2c_smbus_read_byte_data() into a char and used it directly to compute the LED state without checking for an error. i2c_smbus_read_byte_data() returns a negative error code on failure. On an I2C read error the negative value was assigned to an unsigned type, triggering an integer underflow/overflow, and a meaningless LED state was returned to the caller.
Read the value into an int, check for the error, and fall back to PCA9532_OFF while emitting a warning when the read fails.
--- drivers/leds/leds-pca9532.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/leds/leds-pca9532.c +6 -3
@@ -298,12 +298,15 @@ static enum pca9532_state pca9532_getled(struct pca9532_led *led)struct i2c_client *client = led->client;struct pca9532_data *data =i2c_get_clientdata (client);u8 maxleds = data->chip_info->num_leds; -char reg; -enum pca9532_state ret; +int reg; +enum pca9532_state ret =PCA9532_OFF ;mutex_lock (&data->update_lock); reg =i2c_smbus_read_byte_data (client,LED_REG (maxleds, led->id)); - ret = (reg &LED_MASK (led->id)) >>LED_SHIFT (led->id); +if (reg >=0 ) + ret = (reg &LED_MASK (led->id)) >>LED_SHIFT (led->id); +else +dev_warn (&client->dev,"failed to read LED register: %d\n" , reg);mutex_unlock (&data->update_lock);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 491/1756 perf test: Fix a leaked map reference in the arch dwarf unwind tests
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Pei <[email protected]>
[ Upstream commit 1622c9ae39e2882fcbbae7c9d27dda13f1880b93 ]
maps__find() has returned a reference to the map it finds since commit 42fd623b58db ("perf maps: Get map before returning in maps__find"), which updated arch/x86/tests/dwarf-unwind.c but missed the arm, arm64 and powerpc copies. Release the map after reading its end, as x86 does. All other callers of maps__find() already release what they get.
--- tools/perf/arch/arm/tests/dwarf-unwind.c | 1 + tools/perf/arch/arm64/tests/dwarf-unwind.c | 1 + tools/perf/arch/powerpc/tests/dwarf-unwind.c | 1 + 3 files changed, 3 insertions(+)
tools/perf/arch/arm/tests/dwarf-unwind.c +1 -0
@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample, } stack_size =map__end (map) - sp; +map__put (map); stack_size = stack_size >STACK_SIZE ?STACK_SIZE : stack_size;memcpy (buf, (void *) sp, stack_size);
tools/perf/arch/arm64/tests/dwarf-unwind.c +1 -0
@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample, } stack_size =map__end (map) - sp; +map__put (map); stack_size = stack_size >STACK_SIZE ?STACK_SIZE : stack_size;memcpy (buf, (void *) sp, stack_size);
tools/perf/arch/powerpc/tests/dwarf-unwind.c +1 -0
@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample, } stack_size =map__end (map) - sp; +map__put (map); stack_size = stack_size >STACK_SIZE ?STACK_SIZE : stack_size;memcpy (buf, (void *) sp, stack_size);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 492/1756 perf build: Check the version of the compiler that is used
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 4f4387a07f601988e44fc6a4f4663aa1ff264f94 ]
The flex and bison flags are adjusted for clang older than 13.0.0, which doesn't grok -Wno-unused-but-set-variable. The test is reached because CC_NO_CLANG says CC is clang, but the version comes from $(CLANG), which defaults to plain "clang" and needn't be the compiler in use:
$ make CC=clang-19 CLANG=clang-12 version from $(CLANG) -> 12.0.0, flag stripped version from $(CC) -> 19.1.7, flag kept
Dropping the flag lets the warnings it suppresses in the generated flex and bison code through, and those are errors under -Werror.
Ask $(CC) instead, as that is what compiles the code.
--- tools/perf/util/Build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/Build +1 -1
@@ -319,7 +319,7 @@ bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable # Old clangs don't grok -Wno-unused-but-set-variable, remove it ifeq ($(CC_NO_CLANG), 0) - CLANG_VERSION := $(shell $(CLANG) --version | head -1 | sed 's/.*clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g') + CLANG_VERSION := $(shell $(CC) --version | head -1 | sed 's/.*clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g') ifeq ($(call version-lt3,$(CLANG_VERSION),13.0.0),1) bison_flags := $(subst -Wno-unused-but-set-variable,,$(bison_flags)) flex_flags := $(subst -Wno-unused-but-set-variable,,$(flex_flags))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 493/1756 leds: lm3692x: Fix regulator/gpio leak and wrong enabled state on last write failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Nguyen <[email protected]>
[ Upstream commit 145ca6bca2cc5fd8d9c7af216df58a9c75c0e84c ]
Every write in lm3692x_leds_enable() checks its return and jumps to
out: on failure -- except the last one, which falls through and sets led->enabled = true regardless of whether it actually succeeded. Leaks the regulator on a failing probe, and short-circuits later brightness_set() calls without retrying.
Route it through out: like every other write here, and only set enabled = true once it succeeds.
--- drivers/leds/leds-lm3692x.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/leds/leds-lm3692x.c +3 -1
@@ -274,9 +274,11 @@ static int lm3692x_leds_enable(struct lm3692x_led *led) ret =regmap_update_bits (led->regmap,LM3692X_EN ,LM3692X_ENABLE_MASK , enable_state |LM3692X_DEVICE_EN ); +if (ret) + goto out; led->enabled = true; -return ret; +return 0 ; out:dev_err (&led->client->dev,"Fail writing initialization values\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 494/1756 perf annotate-data: Show the sample count in the data-type browser
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 9db4e9d6cc7c7d318fb6d6bb73abe3fed27385a8 ]
The data-type browser has a samples view, selected with -n (or with annotate.show_nr_samples), in which browser__write_overhead() prints a local nr_samples variable that is initialized to zero and never updated, so every member is listed as having no samples while the period and percent columns for the same entry are filled in.
Print the histogram entry's own count instead.
This predates the load/store counter split, so fix it ahead of that
patch: the split then only has to adapt a line that is already correct, and this fix can be picked on its own.
--- tools/perf/ui/browsers/annotate-data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browsers/annotate-data.c +1 -1
@@ -370,7 +370,7 @@ static void browser__write_overhead(struct ui_browser *uib,u64 period = hist->period;double percent = total->period ? (100.0 * period / total->period) :0 ;bool current =ui_browser__is_current_entry (uib, row); -int nr_samples =0 ; +int nr_samples = hist->nr_samples;ui_browser__set_percent_color (uib, percent, current);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 495/1756 RDMA/core: Fix partial copy of IPv6 flow_lbl in LAG hash skb
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit b63d21631f836528ef660d7b5a0d84890ff6dbd5 ]
rdma_build_skb() constructs a synthetic IPv6 header for LAG slave selection and copies the flow label from the AH attribute:
memcpy(&ip6h->flow_lbl, &ah_attr->grh.flow_label, sizeof(*ip6h->flow_lbl));
ipv6hdr.flow_lbl is __u8[3], so sizeof(*ip6h->flow_lbl) dereferences the array to a single __u8 and yields 1. The memcpy therefore copies only the first byte of the flow label, leaving flow_lbl[1] and flow_lbl[2] uninitialised in the skb buffer (alloc_skb() does not zero the data). The resulting LAG hash is computed over one byte of real flow-label data and two bytes of kmalloc residue, so IPv6 RoCEv2 traffic on a bonded interface can be steered to the wrong slave.
Use sizeof(ip6h->flow_lbl) (the array, 3 bytes) so the whole flow label is copied.
--- drivers/infiniband/core/lag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/lag.c +1 -1
@@ -59,7 +59,7 @@ static struct sk_buff *rdma_build_skb(struct net_device *netdev, ip6h->version =6 ; ip6h->nexthdr =IPPROTO_UDP ;memcpy (&ip6h->flow_lbl, &ah_attr->grh.flow_label, -sizeof (*ip6h->flow_lbl)); +sizeof (ip6h->flow_lbl));memcpy (&ip6h->saddr, ah_attr->grh.sgid_attr->gid.raw,sizeof (struct in6_addr )); memcpy(&ip6h->daddr, ah_attr->grh.dgid.raw,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 496/1756 RDMA/irdma: Fix erroneous -ENOMEM for large MR registration
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Moroni <[email protected]>
[ Upstream commit 5bb710151753fe53047b1d34b1b54d0f179cec68 ]
Commit cc8997c94bf3 ("RDMA/irdma: Refactor PBLE functions") replaced the explicit level1_only boolean with a bit mask but did not properly convert the "if (level1_only)" check in irdma_get_pble() to be "lvl == PBLE_LEVEL_1" and instead left it as "if (lvl)".
User MR registration passes "lvl = PBLE_LEVEL_1 | PBLE_LEVEL_2" so this check always evaluates to true and causes the loop to bail after grabbing a single SD even if the region actually requires more than one SD (as is the case for regions larger than 1 GiB with 4k pages). As a result, these registrations can fail with -ENOMEM even if there are sufficient PBLE resources.
--- drivers/infiniband/hw/irdma/pble.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/irdma/pble.c +1 -1
@@ -474,7 +474,7 @@ int irdma_get_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, status =get_lvl1_lvl2_pble (pble_rsrc, palloc, lvl);/* if level1_only, only go through it once */ -if (!status || lvl) +if (!status || lvl ==PBLE_LEVEL_1 )break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 497/1756 leds: flash: Prevent using uninitialized variable in flash_fault_show()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit d229695f2162a41bfa614f175798fa56a5f1c969 ]
In flash_fault_show(), address of uninitialized 'fault' variable is passed to device-specific .fault_get callbacks. This is not a problem if such a callback directly assigns the value like rt4505_fault_get(), but results in an undefined behavior if callback just performs bitwise ORs like as3645a_get_fault(). So just initialize 'fault' with zero.
--- drivers/leds/led-class-flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/led-class-flash.c +1 -1
@@ -188,7 +188,7 @@ static ssize_t flash_fault_show(struct device *dev, {struct led_classdev *led_cdev =dev_get_drvdata (dev);struct led_classdev_flash *fled_cdev =lcdev_to_flcdev (led_cdev); -u32 fault, mask =0x1 ; +u32 fault =0 , mask =0x1 ;char *pbuf = buf;int i, ret, buf_len;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 498/1756 regulator: mp886x: check get_voltage_sel() return value
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jisheng Zhang <[email protected]>
[ Upstream commit 87121c42fadc7683469aee96ad833bc560197a55 ]
The get_voltage_sel() can fail, resulting in negative error codes stored in unsigned integers and corrupted state logic.
--- drivers/regulator/mp886x.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/regulator/mp886x.c +7 -1
@@ -256,6 +256,7 @@ static int mp886x_regulator_register(struct mp886x_device_info *di, {struct regulator_desc *rdesc = &di->desc;struct regulator_dev *rdev; +int sel; rdesc->name ="mp886x-reg" ; rdesc->supply_name ="vin" ;
@@ -277,7 +278,12 @@ static int mp886x_regulator_register(struct mp886x_device_info *di, rdev =devm_regulator_register (di->dev, &di->desc, config);if (IS_ERR (rdev))return PTR_ERR (rdev); - di->sel = rdesc->ops->get_voltage_sel (rdev); + + sel = rdesc->ops->get_voltage_sel (rdev); +if (sel <0 ) +return sel; + di->sel = sel; +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 499/1756 regulator: mp886x: fix pontential division by zero
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jisheng Zhang <[email protected]>
[ Upstream commit d16ef5debccc4289c1f25309a2cccfbbe879601a ]
If the "mps,fb-voltage-divider" 2nd var is 0, there will be division by zero bug.
--- drivers/regulator/mp886x.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/regulator/mp886x.c +3 -0
@@ -317,6 +317,9 @@ static int mp886x_i2c_probe(struct i2c_client *client)if (ret)return ret; +if (di->r[1 ] ==0 ) +return -EINVAL ; + di->en_gpio =devm_gpiod_get (dev,"enable" ,GPIOD_OUT_HIGH );if (IS_ERR (di->en_gpio))return PTR_ERR (di->en_gpio);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 500/1756 arm64: dts: ti: k3-am62-verdin: fix main_gpio0/main_gpio1 line names size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Francesco Dolcini <[email protected]>
[ Upstream commit 11a51e82e1f997975a28358a1dcffec190ea7282 ]
gpio-line-names sized main_gpio0/main_gpio1 for 87/88 lines, the SoC's ti,ngpio values before they were corrected to 92/52 in commit 28c8f2189d80 ("arm64: dts: ti: k3-am62-main: Fix GPIO numbers in DT"), four months before this file was written. Resize both arrays to match, keeping every existing label at its original index.
--- arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi | 41 +++------------------- 1 file changed, 5 insertions(+), 36 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi +5 -36
@@ -994,6 +994,11 @@ &main_gpio0 { "", "", "", + "", + "", + "", + "", + "", /* 90 */ ""; };
@@ -1050,42 +1055,6 @@ &main_gpio1 { "", "SODIMM_17", "SODIMM_155", /* 50 */ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", /* 60 */ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", /* 70 */ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", /* 80 */ - "", - "", - "", - "", - "", - "", ""; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 501/1756 RDMA/irdma: Use kvzalloc for lvl2 leafmem allocation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Bongio <[email protected]>
[ Upstream commit 9c40f13a63a4b87177de3e8c318af25068fc6ab4 ]
During VM live migration or when registering large memory regions (e.g., guest memory >= 256 GB backed by 4 KiB pages), get_lvl2_pble() calculates total leaves exceeding ~131,072. The memory required for lvl2->leafmem.va exceeds 4 MiB (sizeof(*leaf) * total > 5.24 MiB).
Because kzalloc() requires physically contiguous pages, requests larger than MAX_PAGE_ORDER (4 MiB on x86_64) fail and trigger a warning:
WARNING: CPU: 123 PID: 119906 at mm/page_alloc.c:5997 __alloc_frozen_pages_noprof+0x50c/0x1050 Call Trace: <TASK> alloc_frozen_pages_noprof+0xc0/0x240 ___kmalloc_large_node+0x3d/0xd0 __kmalloc_large_node_noprof+0x1b/0x90 __kmalloc_noprof+0x254/0x660 get_lvl1_lvl2_pble+0xbc/0x270 [irdma] irdma_get_pble+0x44/0xc0 [irdma] irdma_setup_pbles+0x46/0x1d0 [irdma] irdma_reg_user_mr_type_mem+0x41/0x230 [irdma] irdma_reg_user_mr+0x194/0x1c0 [irdma] ib_uverbs_reg_mr+0x1b0/0x2c0 [ib_uverbs]
The leafmem array is purely host software tracking structures (struct irdma_pble_info) and does not require physically contiguous memory.
Switch the allocation from kzalloc() to kvzalloc() and free it with kvfree() so that requests exceeding MAX_PAGE_ORDER fall back to virtually contiguous memory via vmalloc.
--- drivers/infiniband/hw/irdma/pble.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/hw/irdma/pble.c +3 -3
@@ -322,7 +322,7 @@ static void free_lvl2(struct irdma_hmc_pble_rsrc *pble_rsrc,if (root->addr)irdma_prm_return_pbles (&pble_rsrc->pinfo, &root->chunkinfo); -kfree (lvl2->leafmem.va); +kvfree (lvl2->leafmem.va); lvl2->leaf =NULL ; }
@@ -350,7 +350,7 @@ static int get_lvl2_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, lvl2->leaf_cnt = total; lvl2->leafmem.size = (sizeof (*leaf) * total); - lvl2->leafmem.va =kzalloc (lvl2->leafmem.size,GFP_KERNEL ); + lvl2->leafmem.va =kvzalloc (lvl2->leafmem.size,GFP_KERNEL );if (!lvl2->leafmem.va)return -ENOMEM ;
@@ -359,7 +359,7 @@ static int get_lvl2_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, ret_code =irdma_prm_get_pbles (&pble_rsrc->pinfo, &root->chunkinfo, total <<3 , &root->addr, &fpm_addr);if (ret_code) { -kfree (lvl2->leafmem.va); +kvfree (lvl2->leafmem.va); lvl2->leaf =NULL ;return -ENOMEM ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 502/1756 ata: pata_parport: fix parport attach idr_alloc for
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit 193f5b84a95c02456f51fe5067750ecf73d213d5 ]
idr_alloc() expects an inclusive start and an exclusive end, so passing port->number as both arguments produces an empty range. Because idr_alloc() only falls back to INT_MAX when end <= 0, the allocation succeeds solely for parport0 and returns -ENOSPC for every other port, which pata_parport_attach() silently ignores. As a result only parport0 gets probed and any higher-numbered parports are never attached.
Use port->number + 1 as the end so the range [port->number, port->number + 1) contains exactly the desired ID.
--- drivers/ata/pata_parport/pata_parport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_parport/pata_parport.c +1 -1
@@ -731,7 +731,7 @@ static void pata_parport_attach(struct parport *port)int pr_num, id;mutex_lock (&pi_mutex); - id =idr_alloc (&parport_list, port, port->number, port->number, + id =idr_alloc (&parport_list, port, port->number, port->number +1 ,GFP_KERNEL );if (id <0 ) {mutex_unlock (&pi_mutex);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 503/1756 ASoC: amd: acp-es8336: Switch to use acpi_bus_get_primary_device()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 6f50ab7ab1f93e874fa75d18bf98bbca4ce0204f ]
Replace acpi_get_first_physical_node() that is slated for removal with acpi_bus_get_primary_device() that takes a reference to the device it is about to return.
This addresses a potential use-after-free that may occur if the device returned by acpi_get_first_physical_node() is removed right after dropping its ACPI companion's physical_node_lock in that function.
It also fixes a device reference counting issue that may lead to a premature device release if gpiod_get_optional() fails in st_es8336_late_probe().
--- sound/soc/amd/acp-es8336.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/acp-es8336.c +1 -1
@@ -201,7 +201,7 @@ static int st_es8336_late_probe(struct snd_soc_card *card)if (!adev)return -ENODEV ; - codec_dev =acpi_get_first_physical_node (adev); + codec_dev =acpi_bus_get_primary_device (adev);acpi_dev_put (adev);if (!codec_dev) {dev_err (card->dev,"can not find codec dev\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 504/1756 ASoC: amd: acp3x-es83xx: Switch to use acpi_bus_get_primary_device()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit aae5bd00ced5b7e42ef3b3aa46923ad72388c60b ]
Replace acpi_get_first_physical_node() that is slated for removal with acpi_bus_get_primary_device() that takes a reference to the device it is about to return.
This addresses a potential use-after-free that may occur if the device returned by acpi_get_first_physical_node() is removed right after dropping its ACPI companion's physical_node_lock in that function.
It also fixes a device reference counting issue that may lead to a premature device release if devm_kzalloc() fails in acp3x_es83xx_probe().
--- sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c +1 -1
@@ -424,7 +424,7 @@ static int acp3x_es83xx_probe(struct snd_soc_card *card)return -ENXIO ; } - codec_dev =acpi_get_first_physical_node (adev); + codec_dev =acpi_bus_get_primary_device (adev);acpi_dev_put (adev);if (!codec_dev) {dev_warn (dev,"Error cannot find codec device, will defer probe\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 505/1756 wifi: rtl8xxxu: free RX skb when URB submission fails
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kim Wooseok <[email protected]>
[ Upstream commit 9f7edf4e8584c87e3c478c6dd87c08d51b5157c2 ]
When usb_submit_urb() fails, rtl8xxxu_submit_rx_urb() unanchors the URB but leaves the newly allocated skb in urb.context. For ENOMEM/EAGAIN, the RX worker puts the request back on the pending list. The next submission allocates another skb and overwrites that pointer, leaking the previous buffer. Stopping before the retry also leaks it, because pending-list cleanup frees only the URB.
Free the skb and clear urb.context in rtl8xxxu_submit_rx_urb() when submission fails. This keeps buffer allocation and failure cleanup in the same function, so a request returned for retry or teardown no longer owns an skb. Remove the corresponding cleanup from start and the RX worker; they only need to decide whether to retry or free the URB.
--- drivers/net/wireless/realtek/rtl8xxxu/core.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/core.c +5 -11
@@ -5890,7 +5890,6 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work)struct rtl8xxxu_priv *priv;struct rtl8xxxu_rx_urb *rx_urb, *tmp;struct list_head local; -struct sk_buff *skb;unsigned long flags;int ret;
@@ -5922,8 +5921,6 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work)default :dev_warn (&priv->udev->dev,"failed to requeue urb with error %i\n" , ret); - skb = (struct sk_buff *)rx_urb->urb.context; -dev_kfree_skb (skb);usb_free_urb (&rx_urb->urb); } }
@@ -6618,8 +6615,11 @@ static int rtl8xxxu_submit_rx_urb(struct rtl8xxxu_priv *priv, skb_size, rtl8xxxu_rx_complete, skb);usb_anchor_urb (&rx_urb->urb, &priv->rx_anchor); ret =usb_submit_urb (&rx_urb->urb,GFP_ATOMIC ); -if (ret) +if (ret) {usb_unanchor_urb (&rx_urb->urb); +dev_kfree_skb (skb); + rx_urb->urb.context =NULL ; + }return ret; }
@@ -7431,7 +7431,6 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)struct rtl8xxxu_priv *priv = hw->priv;struct rtl8xxxu_rx_urb *rx_urb;struct rtl8xxxu_tx_urb *tx_urb; -struct sk_buff *skb;unsigned long flags;int ret, i;
@@ -7482,13 +7481,8 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw) rx_urb->hw = hw; ret =rtl8xxxu_submit_rx_urb (priv, rx_urb); -if (ret) { -if (ret != -ENOMEM ) { - skb = (struct sk_buff *)rx_urb->urb.context; -dev_kfree_skb (skb); - } +if (ret)rtl8xxxu_queue_rx_urb (priv, rx_urb); - } }schedule_delayed_work (&priv->ra_watchdog,2 *HZ );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 506/1756 RDMA/cxgb4: Fix neigh reference leak in rx_pkt()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 5fb3051aa4611ae18e304814fb1b74a30065fd85 ]
If ip_dev_find() fails on the loopback path the code jumps to free_dst without releasing the neighbour reference taken by dst_neigh_lookup_skb(), leaking one neigh reference.
Release the neighbour before jumping to free_dst.
--- drivers/infiniband/hw/cxgb4/cm.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/cxgb4/cm.c +1 -0
@@ -4156,6 +4156,7 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) pdev =ip_dev_find (&init_net, iph->daddr);if (!pdev) {pr_err ("%s - failed to find device!\n" , __func__); +neigh_release (neigh); goto free_dst; } e = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 507/1756 RDMA/cxgb4: Fix skb reference leak in rx_pkt()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 5eb6ecb612841927b5ede554a0e9d88240934282 ]
rx_pkt() takes an extra reference on the received skb so it can be handed to the firmware completion path via req->cookie. When the work request skb allocation in send_fw_pass_open_req() fails the function returns without releasing that extra reference, leaking one skb reference.
Free the packet skb before returning when the allocation fails, matching the cxgb4_ofld_send() failure path.
--- drivers/infiniband/hw/cxgb4/cm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/cxgb4/cm.c +3 -1
@@ -4006,8 +4006,10 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb,int ret; req_skb =alloc_skb (sizeof (struct fw_ofld_connection_wr ),GFP_KERNEL ); -if (!req_skb) +if (!req_skb) { +kfree_skb (skb);return ; + } req =__skb_put_zero (req_skb,sizeof (*req)); req->op_compl =htonl (WR_OP_V (FW_OFLD_CONNECTION_WR ) |FW_WR_COMPL_F ); req->len16_pkd =htonl (FW_WR_LEN16_V (DIV_ROUND_UP (sizeof (*req),16 )));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 508/1756 RDMA/mlx5: Fix RQ resource reference leak in mlx5_ib_wq_event()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 65f3eab431944415bbe5e3af1bbb2736d4bb1523 ]
Since commit 312b8f79eb05 ("RDMA/mlx: Calling qp event handler in workqueue context") rsc_event_notifier() expects the event handler to drop the resource reference taken by mlx5_get_rsc(). mlx5_ib_wq_event() was missed by that conversion, so every RQ event leaks one reference, which keeps destroy_resource_common() waiting on the completion.
Put the resource reference on all exits of the handler.
--- drivers/infiniband/hw/mlx5/qp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/qp.c +4 -1
@@ -5171,11 +5171,14 @@ static void mlx5_ib_wq_event(struct mlx5_core_qp *core_qp, int type)break ;default :mlx5_ib_warn (dev,"Unexpected event type %d on WQ %06x\n" , type, core_qp->qpn); -return ; + goto out; } rwq->ibwq.event_handler (&event, rwq->ibwq.wq_context); } + +out: +mlx5_core_res_put (&core_qp->common); }static int set_delay_drop (struct mlx5_ib_dev *dev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 509/1756 RDMA/siw: Fix qp use-after-free in siw_get_base_qp()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit ef15197f81ffedf29560edf2221199d92fd83dc2 ]
The reference taken by siw_qp_id2obj() is dropped before the address of the embedded ib_qp is taken from the QP. If that reference was the last one the QP is freed and the pointer returned to the iwarp core is dangling; the core only pins the QP with iw_add_ref() after the call has returned.
Copy the pointer while the reference is still held.
--- drivers/infiniband/sw/siw/siw_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_main.c +4 -1
@@ -218,8 +218,11 @@ static struct ib_qp *siw_get_base_qp(struct ib_device *base_dev, int id)/* * siw_qp_id2obj() increments object reference count */ +struct ib_qp *base_qp = &qp->base_qp; +siw_qp_put (qp); -return &qp->base_qp; + +return base_qp; }return NULL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 510/1756 hwrng: starfive - propagate clock and reset errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit ace145efdd80cd2eb95e84b1087d0f1fc55bdc0d ]
The StarFive TRNG probe and resume paths ignore failures from their clock and reset operations. That lets the driver register or resume while its hardware access prerequisites were not established.
Check each transition, unwind only the previously enabled clock on failure, and propagate the error to the probe or PM core.
--- drivers/char/hw_random/jh7110-trng.c | 39 +++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-)
drivers/char/hw_random/jh7110-trng.c +29 -10
@@ -321,9 +321,17 @@ static int starfive_trng_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev,PTR_ERR (trng->rst),"Error getting hardware reset line\n" ); -clk_prepare_enable (trng->hclk); -clk_prepare_enable (trng->ahb); -reset_control_deassert (trng->rst); + ret =clk_prepare_enable (trng->hclk); +if (ret) +return ret; + + ret =clk_prepare_enable (trng->ahb); +if (ret) + goto disable_hclk; + + ret =reset_control_deassert (trng->rst); +if (ret) + goto disable_ahb; trng->rng.name =dev_driver_string (&pdev->dev); trng->rng.init = starfive_trng_init;
@@ -343,13 +351,18 @@ static int starfive_trng_probe(struct platform_device *pdev)pm_runtime_disable (&pdev->dev);reset_control_assert (trng->rst); -clk_disable_unprepare (trng->ahb); -clk_disable_unprepare (trng->hclk); - -return dev_err_probe (&pdev->dev, ret,"Failed to register hwrng\n" ); + ret =dev_err_probe (&pdev->dev, ret,"Failed to register hwrng\n" ); + goto disable_ahb; }return 0 ; + +disable_ahb: +clk_disable_unprepare (trng->ahb); +disable_hclk: +clk_disable_unprepare (trng->hclk); + +return ret; }static int __maybe_unused starfive_trng_suspend (struct device *dev)
@@ -365,11 +378,17 @@ static int __maybe_unused starfive_trng_suspend(struct device *dev)static int __maybe_unused starfive_trng_resume (struct device *dev) {struct starfive_trng *trng =dev_get_drvdata (dev); +int ret; -clk_prepare_enable (trng->hclk); -clk_prepare_enable (trng->ahb); + ret =clk_prepare_enable (trng->hclk); +if (ret) +return ret; -return 0 ; + ret =clk_prepare_enable (trng->ahb); +if (ret) +clk_disable_unprepare (trng->hclk); + +return ret; }static const struct dev_pm_ops starfive_trng_pm_ops = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 511/1756 crypto: starfive - handle clock enable failures
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Liu <[email protected]>
[ Upstream commit 5358248961ae23f7253d010ddfde1cfd2556ce22 ]
Return error from failed clock enable.
starfive_cryp_probe ignores clk_prepare_enable return for hclk/ahb, then remove/error paths unconditionally clk_disable_unprepare both clocks.
Check consecutive clk_prepare_enable(cryp->hclk)/cryp->ahb returns in starfive_cryp_probe.
Stable-dep-of: c8acdd77a623 ("crypto: starfive - propagate clock and reset errors")
--- drivers/crypto/starfive/jh7110-cryp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/crypto/starfive/jh7110-cryp.c +9 -2
@@ -126,8 +126,15 @@ static int starfive_cryp_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev,PTR_ERR (cryp->rst),"Error getting hardware reset line\n" ); -clk_prepare_enable (cryp->hclk); -clk_prepare_enable (cryp->ahb); + ret =clk_prepare_enable (cryp->hclk); +if (ret) +return ret; + + ret =clk_prepare_enable (cryp->ahb); +if (ret) { +clk_disable_unprepare (cryp->hclk); +return ret; + }reset_control_deassert (cryp->rst);spin_lock (&dev_list.lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 512/1756 crypto: starfive - propagate clock and reset errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit c8acdd77a62374507ed8e70d59e124269d999b75 ]
starfive_cryp_probe() publishes the crypto device after enabling its clocks and deasserting its reset without checking whether those operations succeeded.
Check each hardware activation step and unwind only the resources that were actually enabled before returning the error.
--- drivers/crypto/starfive/jh7110-cryp.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/crypto/starfive/jh7110-cryp.c +10 -7
@@ -131,11 +131,12 @@ static int starfive_cryp_probe(struct platform_device *pdev)return ret; ret =clk_prepare_enable (cryp->ahb); -if (ret) { -clk_disable_unprepare (cryp->hclk); -return ret; - } -reset_control_deassert (cryp->rst); +if (ret) + goto disable_hclk; + + ret =reset_control_deassert (cryp->rst); +if (ret) + goto disable_ahb;spin_lock (&dev_list.lock);list_add (&cryp->list, &dev_list.dev_list);
@@ -185,9 +186,11 @@ static int starfive_cryp_probe(struct platform_device *pdev)list_del (&cryp->list);spin_unlock (&dev_list.lock); -clk_disable_unprepare (cryp->hclk); -clk_disable_unprepare (cryp->ahb);reset_control_assert (cryp->rst); +disable_ahb: +clk_disable_unprepare (cryp->ahb); +disable_hclk: +clk_disable_unprepare (cryp->hclk);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 513/1756 crypto: hisilicon/hpre - remove dma_free_coherent on NULL req->dst in ECDH
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weili Qian <[email protected]>
[ Upstream commit 5b87f619cc5c0a55dcd85ce97974e3f5b9333b7b ]
In hpre_ecdh_hw_data_clr_all(), req->dst is always NULL because hpre_ecdh_dst_data_init() sets hpre_req->dst = NULL before mapping the user buffer with dma_map_single(). The dma_free_coherent() call on req->dst is therefore dead code. Remove it.
--- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 2 -- 1 file changed, 2 deletions(-)
drivers/crypto/hisilicon/hpre/hpre_crypto.c +0 -2
@@ -1467,8 +1467,6 @@ static void hpre_ecdh_hw_data_clr_all(struct hpre_ctx *ctx,if (unlikely (dma_mapping_error (dev, dma)))return ; -if (req->dst) -dma_free_coherent (dev, ctx->key_sz <<1 , req->dst, dma);if (dst)dma_unmap_single (dev, dma, ctx->key_sz <<1 ,DMA_FROM_DEVICE ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 514/1756 crypto: ccp - kill v3 IRQ tasklet during teardown
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit b72a639bdee6e07d8091718ac3e451d9c5cba1b5 ]
On PCI devices using MSI-X, ccp_irq_handler() schedules irq_tasklet. The teardown paths release the IRQ but do not drain a tasklet that was already queued, so it can access ccp after the device-managed allocation has been released.
Kill the tasklet after releasing the IRQ in both the initialization error path and ccp_destroy().
--- drivers/crypto/ccp/ccp-dev-v3.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/crypto/ccp/ccp-dev-v3.c +4 -0
@@ -506,6 +506,8 @@ static int ccp_init(struct ccp_device *ccp)kthread_stop (ccp->cmd_q[i].kthread);sp_free_ccp_irq (ccp->sp, ccp); +if (ccp->use_tasklet) +tasklet_kill (&ccp->irq_tasklet); e_pool:for (i =0 ; i < ccp->cmd_q_count; i++)
@@ -545,6 +547,8 @@ static void ccp_destroy(struct ccp_device *ccp)kthread_stop (ccp->cmd_q[i].kthread);sp_free_ccp_irq (ccp->sp, ccp); +if (ccp->use_tasklet) +tasklet_kill (&ccp->irq_tasklet);for (i =0 ; i < ccp->cmd_q_count; i++)dma_pool_destroy (ccp->cmd_q[i].dma_pool);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 515/1756 crypto: ccp - kill v5 IRQ tasklet during teardown
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 67aefeccc4101a93627f36abbd049f191b54f903 ]
On PCI devices using MSI-X, ccp5_irq_handler() schedules irq_tasklet. The teardown paths release the IRQ but do not drain a tasklet that was already queued, so it can access ccp after the device-managed allocation has been released.
Kill the tasklet after releasing the IRQ in both the initialization error path and ccp5_destroy().
--- drivers/crypto/ccp/ccp-dev-v5.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/crypto/ccp/ccp-dev-v5.c +4 -0
@@ -995,6 +995,8 @@ static int ccp5_init(struct ccp_device *ccp) e_irq:sp_free_ccp_irq (ccp->sp, ccp); +if (ccp->use_tasklet) +tasklet_kill (&ccp->irq_tasklet); e_pool:for (i =0 ; i < ccp->cmd_q_count; i++)
@@ -1046,6 +1048,8 @@ static void ccp5_destroy(struct ccp_device *ccp)kthread_stop (ccp->cmd_q[i].kthread);sp_free_ccp_irq (ccp->sp, ccp); +if (ccp->use_tasklet) +tasklet_kill (&ccp->irq_tasklet);/* Flush the cmd and backlog queue */ while (!list_empty (&ccp->cmd)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 516/1756 RDMA/mlx5: Guard steering anchor resource destruction on create error
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 193aaf5b57f05d9f0403cfdaff3eda3b8d11ec13 ]
The steering anchor resources are shared between anchors with the same priority and are protected by rule_goto_table_ref.
When steering anchor creation succeeds but uverbs_copy_to() fails, the error path drops the reference acquired for the new anchor. However, it unconditionally calls mlx5_steering_anchor_destroy_res(), even when other anchors are still using the shared resources.
This can destroy the shared flow table, flow groups, and rules while existing anchors still hold references to them, resulting in a use-after-free when those anchors are subsequently cleaned up.
Only destroy the shared resources when dropping the reference makes rule_goto_table_ref zero, consistent with the existing cleanup path.
--- drivers/infiniband/hw/mlx5/fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/fs.c +2 -2
@@ -2466,8 +2466,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_STEERING_ANCHOR_CREATE)(return 0 ; destroy_res: - --ft_prio->anchor.rule_goto_table_ref; -mlx5_steering_anchor_destroy_res (ft_prio); +if (!--ft_prio->anchor.rule_goto_table_ref) +mlx5_steering_anchor_destroy_res (ft_prio); put_flow_table:put_flow_table (dev, ft_prio, true); free_obj:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 517/1756 swim: Assert strobe with stable outputs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit adcc410bfb41715fef198a0975db4ed594a49bb7 ]
Inside Macintosh says, "Be sure that you don't change CA0-CA2 or SEL while LSTRB is high". Unfortunately, those bits do change. The CA0-CA2 outputs become inputs when (LSTRB << 4) | LSTRB gets written to the phase register. Then LSTRB is driven low (with CA0-CA2 bits set).
This is a problem because the drive interprets a STEP command as an EJECT command when these pins float high. This occurs intermittently, perhaps because interrupts are disabled and the race condition happens to end well. However, when I add code to step the heads with interrupts enabled, the disk always ejects.
Keep the four phase pin directions set to output and hold their levels constant during LSTRB signalling. Introduce the PHASE_PIN_DIRECTION macro to separate the pin configuration from the logic level changes.
--- drivers/block/swim.c | 62 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-)
drivers/block/swim.c +31 -31
@@ -87,37 +87,37 @@ struct iwm {#define iwm_write (base, reg, v) out_8(&(base)->reg, (v))#define iwm_read (base, reg) in_8(&(base)->reg) -/* bits in phase register */ +/* Bits in phase register */ -#define SEEK_POSITIVE 0x070 -#define SEEK_NEGATIVE 0x074 -#define STEP 0x071 -#define MOTOR_ON 0x072 -#define MOTOR_OFF 0x076 -#define INDEX 0x073 -#define EJECT 0x077 -#define SETMFM 0x171 -#define SETGCR 0x175 - -#define RELAX 0x033 -#define LSTRB 0x008 - -#define CA_MASK 0x077 +#define RELAX 0x03 +#define LSTRB 0x08 +#define CA_MASK 0x07 +#define PHASE_PIN_DIR 0xF0/* Select values for swim_select and swim_readbit */ -#define READ_DATA_0 0x074 -#define ONEMEG_DRIVE 0x075 -#define SINGLE_SIDED 0x076 -#define DRIVE_PRESENT 0x077 -#define DISK_IN 0x170 -#define WRITE_PROT 0x171 -#define TRACK_ZERO 0x172 -#define TACHO 0x173 -#define READ_DATA_1 0x174 -#define GCR_MODE 0x175 -#define SEEK_COMPLETE 0x176 -#define TWOMEG_MEDIA 0x177 +#define SEEK_POSITIVE 0x000 +#define SEEK_NEGATIVE 0x004 +#define STEP 0x001 +#define MOTOR_ON 0x002 +#define MOTOR_OFF 0x006 +#define INDEX 0x003 +#define EJECT 0x007 +#define SETMFM 0x101 +#define SETGCR 0x105 + +#define READ_DATA_0 0x004 +#define ONEMEG_DRIVE 0x005 +#define SINGLE_SIDED 0x006 +#define DRIVE_PRESENT 0x007 +#define DISK_IN 0x100 +#define WRITE_PROT 0x101 +#define TRACK_ZERO 0x102 +#define TACHO 0x103 +#define READ_DATA_1 0x104 +#define GCR_MODE 0x105 +#define SEEK_COMPLETE 0x106 +#define TWOMEG_MEDIA 0x107/* Bits in handshake register */
@@ -269,11 +269,11 @@ static inline int get_swim_mode(struct swim __iomem *base)static inline void swim_select (struct swim __iomem *base,int sel) { -swim_write (base, phase,RELAX ); +swim_write (base, phase,RELAX |PHASE_PIN_DIR );via1_set_head (sel &0x100 ); -swim_write (base, phase, sel &CA_MASK ); +swim_write (base, phase, (sel &CA_MASK ) |PHASE_PIN_DIR ); }static inline void swim_action (struct swim __iomem *base,int action)
@@ -284,9 +284,9 @@ static inline void swim_action(struct swim __iomem *base, int action)swim_select (base, action);udelay (1 ); -swim_write (base, phase, (LSTRB <<4 ) |LSTRB ); +swim_write (base, phase,LSTRB | action |PHASE_PIN_DIR );udelay (1 ); -swim_write (base, phase, (LSTRB <<4 ) | ((~LSTRB ) &0x0F )); +swim_write (base, phase, action |PHASE_PIN_DIR );udelay (1 );local_irq_restore (flags);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 518/1756 swim: Select appropriate drive once only
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit a2d22b3f25c388f9fbce7bf36a45a8900dce4aa3 ]
Before turning off the spindle motor, call swim_drive() to select the appropriate drive. Remove the swim_drive() call from swim_add_floppy() because it was already called by swim_floppy_init().
--- drivers/block/swim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/swim.c +3 -3
@@ -679,8 +679,10 @@ static void floppy_release(struct gendisk *disk)else if (fs->ref_count >0 ) --fs->ref_count; -if (fs->ref_count ==0 ) +if (fs->ref_count ==0 ) { +swim_drive (base, fs->location);swim_motor (base,OFF ); + }mutex_unlock (&swim_mutex); }
@@ -752,8 +754,6 @@ static int swim_add_floppy(struct swim_priv *swd, enum drive_location location) fs->location = location; -swim_drive (base, location); -swim_motor (base,OFF ); fs->type =HD_MEDIA ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 519/1756 swim: Enable the drive when probing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 57d88c8f4ea34a4dd7c5351bd026e225c7283f3f ]
According to the ISM spec, the MOTON bit "causes the Enable 1 and Enable 2 signals to be turned on to the drive." It doesn't actually turn on the motor. When selecting a drive, enable MOTON. Disable it upon eject or release. This fixes detection of the Sony FDHD drive.
--- drivers/block/swim.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/block/swim.c +15 -3
@@ -154,8 +154,9 @@ struct iwm {/*----------------------------------------------------------------------------*/ enum drive_location { -INTERNAL_DRIVE =0x02 , -EXTERNAL_DRIVE =0x04 , +NO_DRIVE =0 , +INTERNAL_DRIVE =BIT (1 ), +EXTERNAL_DRIVE =BIT (2 ), };enum media_type {
@@ -311,9 +312,15 @@ static inline void swim_drive(struct swim __iomem *base,if (location ==INTERNAL_DRIVE ) {swim_write (base, mode0,EXTERNAL_DRIVE );/* clear drive 1 bit */ swim_write (base, mode1,INTERNAL_DRIVE );/* set drive 0 bit */ +swim_write (base, mode1,MOTON ); }else if (location ==EXTERNAL_DRIVE ) {swim_write (base, mode0,INTERNAL_DRIVE );/* clear drive 0 bit */ swim_write (base, mode1,EXTERNAL_DRIVE );/* set drive 1 bit */ +swim_write (base, mode1,MOTON ); + }else { +swim_write (base, mode0,INTERNAL_DRIVE ); +swim_write (base, mode0,EXTERNAL_DRIVE ); +swim_write (base, mode0,MOTON ); } }
@@ -447,6 +454,7 @@ static int floppy_eject(struct floppy_state *fs)swim_drive (base, fs->location);swim_motor (base,OFF );swim_eject (base); +swim_drive (base,NO_DRIVE ); fs->disk_in =0 ; fs->ejected =1 ;
@@ -652,8 +660,10 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode)else if (fs->ref_count >0 ) --fs->ref_count; -if (fs->ref_count ==0 ) +if (fs->ref_count ==0 ) {swim_motor (base,OFF ); +swim_drive (base,NO_DRIVE ); + }return err; }
@@ -682,6 +692,7 @@ static void floppy_release(struct gendisk *disk)if (fs->ref_count ==0 ) {swim_drive (base, fs->location);swim_motor (base,OFF ); +swim_drive (base,NO_DRIVE ); }mutex_unlock (&swim_mutex); }
@@ -804,6 +815,7 @@ static int swim_floppy_init(struct swim_priv *swd)if (swim_readbit (base,DRIVE_PRESENT ) && !swim_readbit (base,ONEMEG_DRIVE ))swim_add_floppy (swd,EXTERNAL_DRIVE ); +swim_drive (base,NO_DRIVE );/* register floppy drives */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 520/1756 swim: Dont disable drive after every sector
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 05a7c4b197279cfb3ec3df26146ce085a2438aec ]
This fixes multi-sector reads on a Sony drive. The Mitsubishi drive doesn't seem to care either way.
--- drivers/block/swim.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/block/swim.c +0 -4
@@ -473,8 +473,6 @@ static inline int swim_read_sector(struct floppy_state *fs,short i;swim_track (fs, track); - -swim_write (base, mode1,MOTON );swim_head (base, side);swim_write (base, mode0, side);
@@ -490,8 +488,6 @@ static inline int swim_read_sector(struct floppy_state *fs, }local_irq_restore (flags); -swim_write (base, mode0,MOTON ); -if ((header.side != side) || (header.track != track) || (header.sector != sector))return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 521/1756 swim: Perform ISM/IWM mode switching according to specs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 52981bb358d1b5c38040b00f81e2cf973f9148ad ]
The SWIM spec says, "MOTOREN must be low to switch modes" and "after switching from ISM to IWM, the very first command must be a clear L7".
The ISM spec says, MOTOREN "must not be cleared until after the Action bit is cleared". Perform those operations in the correct sequence.
When switching to ISM mode, the Mode register has to be selected with a particular sequence of bit flips. Set q7 low then q6 low then mtrOff.
--- drivers/block/swim.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/block/swim.c +7 -3
@@ -149,6 +149,7 @@ struct iwm {#define ACTION 0x08#define WRITE_MODE 0x10#define HEDSEL 0x20 +#define ISM_SELECT 0x40#define MOTON 0x80/*----------------------------------------------------------------------------*/
@@ -223,18 +224,21 @@ extern int swim_read_sector_data(struct swim __iomem *base,static DEFINE_MUTEX (swim_mutex);static inline void set_swim_mode (struct swim __iomem *base,int enable) { -struct iwm __iomem *iwm_base; +struct iwm __iomem *iwm_base = (struct iwm __iomem *)base;unsigned long flags;if (!enable) { -swim_write (base, mode0,0xf8 ); +swim_write (base, mode0,ACTION ); +swim_write (base, mode0,ENBL1 |ENBL2 |MOTON ); +swim_write (base, mode0,ISM_SELECT ); +iwm_read (iwm_base, q7L);return ; } - iwm_base = (struct iwm __iomem *)base;local_irq_save (flags);iwm_read (iwm_base, q7L); +iwm_read (iwm_base, q6L);iwm_read (iwm_base, mtrOff);iwm_read (iwm_base, q6H);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 522/1756 swim: Configure parameter memory
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 994a778d966592d0e211deaf6e436fcb21413935 ]
The original SWIM chip has a 16 byte memory to store parameters which control read/write timing. The SWIM 2 chip retains the last 4 parameters which control write pre-compensation, but omits the first 12. Hence SWIM 2 can perform reads without any parameter memory setup but SWIM 1 cannot.
Configure the SWIM parameter memory with the appropriate values so that SWIM 1 can read too. The parameters used here were observed in SWIM chip memory, using Macsbug, while MacOS was reading from an MFM floppy disk.
--- drivers/block/swim.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/block/swim.c +13 -0
@@ -796,6 +796,17 @@ static void swim_cleanup_floppy_disk(struct floppy_state *fs)blk_mq_free_tag_set (&fs->tag_set); } +static void swim_set_parameters (struct swim __iomem *base) +{ +unsigned int i; +static const u8 mem[] = {0x18 ,0x41 ,0x2e ,0x2e ,0x18 ,0x18 ,0x1b ,0x1b , +0x2f ,0x2f ,0x19 ,0x19 ,0x97 ,0x1b ,0x57 ,0x3b , }; + +swim_write (base, mode0,0 );/* reset parameter memory index */ +for (i =0 ; i <16 ; ++i) +swim_write (base, parameter, mem[i]); +} +static int swim_floppy_init (struct swim_priv *swd) {struct queue_limits lim = {
@@ -805,6 +816,8 @@ static int swim_floppy_init(struct swim_priv *swd)int drive;struct swim __iomem *base = swd->base; +swim_set_parameters (base); +/* scan floppy drives */ swim_drive (base,INTERNAL_DRIVE );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 523/1756 swim: Refactor SWIM setup
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 62977e8ea98e99dbf86609e65930e6607398e1c5 ]
The write to the setup register is really chip initialization, so do it in swim_floppy_init() rather than floppy_open(). Drop the udelay(), which was apparently copied and pasted from swim3.c where it presumably relates to interrupts, of which this chip has none. (See also mkLinux SWIM 3 driver.)
Stable-dep-of: 3c02a14c8996 ("swim: Enable clock divider only where appropriate")
--- drivers/block/swim.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/block/swim.c +3 -2
@@ -628,8 +628,7 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode) fs->ref_count =-1 ; else fs->ref_count++; -swim_write (base, setup,S_IBM_DRIVE |S_FCLK_DIV2 ); -udelay (10 ); +swim_drive (base, fs->location);swim_motor (base,ON );swim_action (base,SETMFM );
@@ -816,6 +815,8 @@ static int swim_floppy_init(struct swim_priv *swd)int drive;struct swim __iomem *base = swd->base; +swim_write (base, setup,S_IBM_DRIVE |S_FCLK_DIV2 ); +swim_set_parameters (base);/* scan floppy drives */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 524/1756 swim: Enable clock divider only where appropriate
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 3c02a14c89962c88ed0abb3cce4101021c63149c ]
Some models have a 16 MHz FCLK oscillator and others 32 MHz. Put this information into the swim device platform_data so that the driver can correctly enable the clock divider. When this is enabled incorrectly, nothing can be read and failures from the Error Correction Machine are flagged in the error register.
--- arch/m68k/mac/config.c | 31 ++++++++++++++++++++++++++++++- drivers/block/swim.c | 9 ++++++--- 2 files changed, 36 insertions(+), 4 deletions(-)
arch/m68k/mac/config.c +30 -1
@@ -986,8 +986,37 @@ static int __init mac_platform_init(void) .start = swim_base, .end = swim_base + 0x1FFF, }; +bool fast_fclk = false; + +/* Models in this list are supposed to run FCLK at 32 MHz */ +switch (macintosh_config->ident) { +case MAC_MODEL_CCL : +case MAC_MODEL_CCLII : +case MAC_MODEL_LCIII : +case MAC_MODEL_Q605 : +case MAC_MODEL_Q605_ACC : +case MAC_MODEL_Q610 : +case MAC_MODEL_Q630 : +case MAC_MODEL_Q650 : +case MAC_MODEL_Q800 : +case MAC_MODEL_P460 : +case MAC_MODEL_P475 : +case MAC_MODEL_P475F : +case MAC_MODEL_P520 : +case MAC_MODEL_P550 : +case MAC_MODEL_P575 : +case MAC_MODEL_P588 : +case MAC_MODEL_TV : +case MAC_MODEL_C610 : +case MAC_MODEL_C650 : +case MAC_MODEL_PB190 : +case MAC_MODEL_PB520 : + fast_fclk = true; +break ; + } -platform_device_register_simple ("swim" ,-1 , &swim_rsrc,1 ); +platform_device_register_resndata (NULL ,"swim" ,-1 , &swim_rsrc,1 , + &fast_fclk,sizeof (fast_fclk)); }/*
drivers/block/swim.c +6 -3
@@ -806,8 +806,11 @@ static void swim_set_parameters(struct swim __iomem *base)swim_write (base, parameter, mem[i]); } -static int swim_floppy_init (struct swim_priv *swd) +static int swim_floppy_init (struct platform_device *pdev) { +struct swim_priv *swd =platform_get_drvdata (pdev); +bool *data = pdev->dev.platform_data; +bool fast_fclk = data && *data;struct queue_limits lim = { .features =BLK_FEAT_ROTATIONAL , };
@@ -815,7 +818,7 @@ static int swim_floppy_init(struct swim_priv *swd)int drive;struct swim __iomem *base = swd->base; -swim_write (base, setup,S_IBM_DRIVE |S_FCLK_DIV2 ); +swim_write (base, setup,S_IBM_DRIVE | (fast_fclk ?S_FCLK_DIV2 :0 ));swim_set_parameters (base);
@@ -931,7 +934,7 @@ static int swim_probe(struct platform_device *dev) swd->base = swim_base; - ret =swim_floppy_init (swd); + ret =swim_floppy_init (dev);if (ret) goto out_kfree;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 525/1756 swim: Dont start motor until medium is present
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit dbbaaae83cb277d76e70426c0f0ce289e867ed77 ]
The spindle motor should not be running when a disk is to be inserted. Don't start the motor while the drive is empty.
--- drivers/block/swim.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/block/swim.c +4 -2
@@ -630,8 +630,7 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode) fs->ref_count++;swim_drive (base, fs->location); -swim_motor (base,ON ); -swim_action (base,SETMFM ); +if (fs->ejected)setup_medium (fs);if (!fs->disk_in) {
@@ -639,6 +638,9 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode) goto out; } +swim_motor (base,ON ); +swim_action (base,SETMFM ); +set_capacity (fs->disk, fs->total_secs);if (mode &BLK_OPEN_NDELAY )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 526/1756 swim: Recalibrate when drive is probed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit ba087774a1493ade524f8a783461fa8be9c75039 ]
Track zero recalibration can be slow and is normally done only once i.e. during system POST or boot-up. Recalibrate once after the drive is probed rather than every time the device is opened. Don't register the drive if recalibration fails. Park the heads before ejecting.
--- drivers/block/swim.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-)
drivers/block/swim.c +17 -20
@@ -412,6 +412,7 @@ static inline int swim_track00(struct swim __iomem *base)if (swim_readbit (base,TRACK_ZERO ))return 0 ; +pr_err ("swim: track zero recalibration failed\n" );return -1 ; }
@@ -456,6 +457,7 @@ static int floppy_eject(struct floppy_state *fs)struct swim __iomem *base = fs->swd->base;swim_drive (base, fs->location); +swim_track (fs,40 );swim_motor (base,OFF );swim_eject (base);swim_drive (base,NO_DRIVE );
@@ -596,13 +598,6 @@ static void setup_medium(struct floppy_state *fs)struct floppy_struct *g; fs->disk_in =1 ; fs->write_protected =swim_readbit (base,WRITE_PROT ); - -if (swim_track00 (base)) -printk (KERN_ERR -"SWIM: cannot move floppy head to track 0\n" ); - -swim_track00 (base); - fs->type =swim_readbit (base,TWOMEG_MEDIA ) ?HD_MEDIA :DD_MEDIA ; fs->head_number =swim_readbit (base,SINGLE_SIDED ) ?1 :2 ;
@@ -610,7 +605,6 @@ static void setup_medium(struct floppy_state *fs) fs->total_secs = g->size; fs->secpercyl = g->head * g->sect; fs->secpertrack = g->sect; - fs->track =0 ; }else { fs->disk_in =0 ; }
@@ -759,24 +753,33 @@ static const struct block_device_operations floppy_fops = { .check_events = floppy_check_events, }; -static int swim_add_floppy (struct swim_priv *swd,enum drive_location location) +static void swim_add_floppy (struct swim_priv *swd,enum drive_location location) {struct floppy_state *fs = &swd->unit[swd->floppy_count];struct swim __iomem *base = swd->base; - fs->location = location; +swim_drive (base, location); +if (!swim_readbit (base,DRIVE_PRESENT ) || +swim_readbit (base,ONEMEG_DRIVE )) + goto out; +if (swim_readbit (base,DISK_IN )) +swim_motor (base,ON ); +if (swim_track00 (base)) + goto out; -swim_motor (base,OFF ); + fs->location = location; fs->type =HD_MEDIA ; fs->head_number =2 ; fs->ref_count =0 ; fs->ejected =1 ; + fs->track =0 ; swd->floppy_count++; -return 0 ; +out: +swim_motor (base,OFF ); }static const struct blk_mq_ops swim_mq_ops = {
@@ -826,14 +829,8 @@ static int swim_floppy_init(struct platform_device *pdev)/* scan floppy drives */ -swim_drive (base,INTERNAL_DRIVE ); -if (swim_readbit (base,DRIVE_PRESENT ) && - !swim_readbit (base,ONEMEG_DRIVE )) -swim_add_floppy (swd,INTERNAL_DRIVE ); -swim_drive (base,EXTERNAL_DRIVE ); -if (swim_readbit (base,DRIVE_PRESENT ) && - !swim_readbit (base,ONEMEG_DRIVE )) -swim_add_floppy (swd,EXTERNAL_DRIVE ); +swim_add_floppy (swd,INTERNAL_DRIVE ); +swim_add_floppy (swd,EXTERNAL_DRIVE );swim_drive (base,NO_DRIVE );/* register floppy drives */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 527/1756 swim: Add track zero recalibration delay
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit b9c1095048537cc9563f12d0a24f2f0df129e4d5 ]
The UPD72070 spec indicates that the track zero sensor can take 3 ms to stabilize following a STEP command so add a call to msleep(). Remove the duplicate swim_readbit() call as there's no need for that once the sensor signal has stabilized.
--- drivers/block/swim.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/block/swim.c +4 -5
@@ -402,16 +402,15 @@ static inline int swim_track00(struct swim __iomem *base)for (try =0 ; try <100 ; try++) {swim_select (base,RELAX ); +msleep (3 ); +if (swim_readbit (base,TRACK_ZERO )) -break ; +return 0 ;if (swim_step (base)) -return -1 ; +break ; } -if (swim_readbit (base,TRACK_ZERO )) -return 0 ; -pr_err ("swim: track zero recalibration failed\n" );return -1 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 528/1756 swim: Handle FIFO timeout error
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 2e9bcbecee68431b689d16b23bc5529db686f8d4 ]
When polling the FIFO for a mark byte in the sector header, don't return zero if the timeout counter has expired, return an error code.
--- drivers/block/swim_asm.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/block/swim_asm.S +1 -2
@@ -79,7 +79,7 @@ wait_addr_mark_byte: tstb %a2@ dbmi %d2, wait_addr_mark_byte - bpl header_exit + bpl signal_nonyb moveb %a3@, %d3 cmpb %a0@+, %d3
@@ -136,7 +136,6 @@ crc1: tstb %a2@ tstb %a3@(read_error - read_mark) -header_exit: moveq #0, %d0 moveb #0x18, %a3@(write_mode0 - read_mark) rts
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 529/1756 swim: Check for CRC errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 01bff87152e6748fbac9ccd645d3d5f490d75ddc ]
After reading either the sector header or sector data, examine that flag in the handshake register which holds the result of the CRC calculation. CRC validation has to take place with the last byte still in the FIFO. This flag can't be checked by the caller because by then all bytes will have been retrieved from the FIFO. Return an error code when appropriate.
--- drivers/block/swim_asm.S | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/block/swim_asm.S +10 -0
@@ -42,6 +42,8 @@ .equ max_retry, 40 .equ sector_size, 512 + .equ .Lhr_crc_error, 0x02 + .global swim_read_sector_header swim_read_sector_header: link %a6, #0
@@ -134,6 +136,10 @@ crc1: tstb %a2@ moveb %a3@, %a4@(o_crc1) + moveb %a2@, %d5 + andb #.Lhr_crc_error, %d5 + bne signal_nonyb + tstb %a3@(read_error - read_mark) moveq #0, %d0
@@ -226,6 +232,10 @@ data_crc1: moveb %a3@, %d5 + moveb %a2@, %d5 + andb #.Lhr_crc_error, %d5 + bne data_exit + tstb %a3@(read_error - read_mark) moveb #0x18, %a3@(write_mode0 - read_mark)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 530/1756 swim: Simplify return value initialization
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 385a44e78702762e2fce796cf37b6f465d86a87f ]
Initialize the error result once only. Update the result only after a successful read.
Stable-dep-of: d66bdef0a308 ("swim: Check error register during sector read")
--- drivers/block/swim_asm.S | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/block/swim_asm.S +3 -8
@@ -49,6 +49,7 @@ swim_read_sector_header: link %a6, #0 moveml %d1-%d5/%a0-%a4,%sp@- movel %a6@(0x0c), %a4 + moveq #-1, %d0 bsr mfm_read_addrmark moveml %sp@+, %d1-%d5/%a0-%a4 unlk %a6
@@ -63,7 +64,6 @@ mfm_read_addrmark: movel %a6@(0x08), %a3 lea %a3@(read_handshake), %a2 lea %a3@(read_mark), %a3 - moveq #-1, %d0 movew #seek_time, %d2 wait_header_init:
@@ -143,10 +143,7 @@ crc1: tstb %a2@ tstb %a3@(read_error - read_mark) moveq #0, %d0 - moveb #0x18, %a3@(write_mode0 - read_mark) - rts signal_nonyb: - moveq #-1, %d0 moveb #0x18, %a3@(write_mode0 - read_mark) rts
@@ -155,6 +152,7 @@ swim_read_sector_data: link %a6, #0 moveml %d1-%d5/%a0-%a5,%sp@- movel %a6@(0x0c), %a4 + moveq #-1, %d0 bsr mfm_read_data moveml %sp@+, %d1-%d5/%a0-%a5 unlk %a6
@@ -238,15 +236,12 @@ data_crc1: tstb %a3@(read_error - read_mark) - moveb #0x18, %a3@(write_mode0 - read_mark) - /* return number of bytes read */ movel #sector_size, %d0 addw #1, %d4 subl %d4, %d0 - rts + data_exit: moveb #0x18, %a3@(write_mode0 - read_mark) - moveq #-1, %d0 rts
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 531/1756 swim: Check error register during sector read
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit d66bdef0a3083fed1a0fc4f0ee1c85b26476b21c ]
Clear the error register only once before a sector read operation. Don't clear it afterwards -- the caller needs it. Check the error register in swim_read_sector() and return the appropriate error when necessary. Fully validate the sector header. Don't terminate the search loop early just because an erroneous sector header showed up.
--- drivers/block/swim.c | 13 +++++++------ drivers/block/swim_asm.S | 8 -------- 2 files changed, 7 insertions(+), 14 deletions(-)
drivers/block/swim.c +7 -6
@@ -483,20 +483,21 @@ static inline int swim_read_sector(struct floppy_state *fs,local_irq_save (flags);for (i =0 ; i <36 ; i++) { - ret =swim_read_sector_header (base, &header); -if (!ret && (header.sector == sector)) { +if (swim_read_sector_header (base, &header) || +swim_read (base, error) || header.track != track || + header.side != side || header.size !=2 ) +continue ; +if (header.sector == sector) {/* found */ ret =swim_read_sector_data (base, buffer); +if (swim_read (base, error)) + ret = -EIO ;break ; } }local_irq_restore (flags); -if ((header.side != side) || (header.track != track) || - (header.sector != sector)) -return 0 ; -return ret; }
drivers/block/swim_asm.S +0 -8
@@ -67,7 +67,6 @@ mfm_read_addrmark: movew #seek_time, %d2 wait_header_init: - tstb %a3@(read_error - read_mark) moveb #0x18, %a3@(write_mode0 - read_mark) moveb #0x01, %a3@(write_mode1 - read_mark) moveb #0x01, %a3@(write_mode0 - read_mark)
@@ -140,8 +139,6 @@ crc1: tstb %a2@ andb #.Lhr_crc_error, %d5 bne signal_nonyb - tstb %a3@(read_error - read_mark) - moveq #0, %d0 signal_nonyb: moveb #0x18, %a3@(write_mode0 - read_mark)
@@ -166,7 +163,6 @@ mfm_read_data: movew #seek_time, %d2 wait_data_init: - tstb %a3@(read_error - read_mark) moveb #0x18, %a3@(write_mode0 - read_mark) moveb #0x01, %a3@(write_mode1 - read_mark) moveb #0x01, %a3@(write_mode0 - read_mark)
@@ -191,8 +187,6 @@ wait_data_mark_byte: /* read data */ - tstb %a3@(read_error - read_mark) - movel #sector_size-1, %d4 /* sector size */ read_new_data: movew #max_retry, %d2
@@ -234,8 +228,6 @@ data_crc1: andb #.Lhr_crc_error, %d5 bne data_exit - tstb %a3@(read_error - read_mark) - /* return number of bytes read */ movel #sector_size, %d0
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 532/1756 swim: Dont use the mark register to read data
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit cb7923133ec18e67e2d6718e29426a4423af6b73 ]
If an unexpected mark byte were to be read from the data register, an error would be flagged. But no error gets flagged when such a byte is read from the mark register, which is misleading. Always use the data register except when a mark byte is expected.
--- drivers/block/swim_asm.S | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/block/swim_asm.S +11 -10
@@ -47,11 +47,11 @@ .global swim_read_sector_header swim_read_sector_header: link %a6, #0 - moveml %d1-%d5/%a0-%a4,%sp@- + moveml %d1-%d5/%a0-%a5,%sp@- movel %a6@(0x0c), %a4 moveq #-1, %d0 bsr mfm_read_addrmark - moveml %sp@+, %d1-%d5/%a0-%a4 + moveml %sp@+, %d1-%d5/%a0-%a5 unlk %a6 rts
@@ -63,6 +63,7 @@ sector_data_mark: mfm_read_addrmark: movel %a6@(0x08), %a3 lea %a3@(read_handshake), %a2 + lea %a3@(read_data), %a5 lea %a3@(read_mark), %a3 movew #seek_time, %d2
@@ -93,7 +94,7 @@ amark0: tstb %a2@ dbmi %d2, amark0 bpl signal_nonyb - moveb %a3@, %a4@(o_track) + moveb %a5@, %a4@(o_track) moveq #max_retry, %d2
@@ -101,7 +102,7 @@ amark1: tstb %a2@ dbmi %d2, amark1 bpl signal_nonyb - moveb %a3@, %a4@(o_side) + moveb %a5@, %a4@(o_side) moveq #max_retry, %d2
@@ -109,7 +110,7 @@ amark2: tstb %a2@ dbmi %d2, amark2 bpl signal_nonyb - moveb %a3@, %a4@(o_sector) + moveb %a5@, %a4@(o_sector) moveq #max_retry, %d2
@@ -117,7 +118,7 @@ amark3: tstb %a2@ dbmi %d2, amark3 bpl signal_nonyb - moveb %a3@, %a4@(o_size) + moveb %a5@, %a4@(o_size) moveq #max_retry, %d2
@@ -125,7 +126,7 @@ crc0: tstb %a2@ dbmi %d2, crc0 bpl signal_nonyb - moveb %a3@, %a4@(o_crc0) + moveb %a5@, %a4@(o_crc0) moveq #max_retry, %d2
@@ -133,7 +134,7 @@ crc1: tstb %a2@ dbmi %d2, crc1 bpl signal_nonyb - moveb %a3@, %a4@(o_crc1) + moveb %a5@, %a4@(o_crc1) moveb %a2@, %d5 andb #.Lhr_crc_error, %d5
@@ -212,7 +213,7 @@ data_crc0: dbmi %d2, data_crc0 bpl data_exit - moveb %a3@, %d5 + moveb %a5@, %d5 moveq #max_retry, %d2
@@ -222,7 +223,7 @@ data_crc1: dbmi %d2, data_crc1 bpl data_exit - moveb %a3@, %d5 + moveb %a5@, %d5 moveb %a2@, %d5 andb #.Lhr_crc_error, %d5
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 533/1756 swim: Fix buffer overflow
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit a54870a4ae4962acf341eb6ca010cae02af1a6ea ]
The effect of this bug can be observed as swim_read_sector_data() inexplicably returning -5, or an error flag indicating that a mark byte was read from the data register, or other odd behviour.
When copying bytes from the chip FIFO to the read buffer, the driver keeps count of the remaining buffer space using register %d4. A counter in register %d2 serves as a timeout. The driver polls (%a2), the handshake register, until flags indicate that byte(s) have arrived in the FIFO.
movel #sector_size-1, %d4
read_new_data:
movew #max_retry, %d2
read_data_loop:
moveb %a2@, %d5
andb #0xc0, %d5
dbne %d2, read_data_loop
beq data_exit
moveb %a5@, %a4@+
andb #0x40, %d5
dbne %d4, read_new_data
beq exit_loopNote that the exit_loop branch depends upon a flag in the handshake register and not on the remaining buffer space. Hence there may be no branch to exit_loop after %d4 is decremented to -1 (i.e. full buffer).
moveb %a5@, %a4@+
dbra %d4, read_new_dataexit_loop:
Here is a second decrement of %d4 which can now reach -2. But the buffer bounds check is a comparison with -1, which is now ineffective. Hence the loop will continue copying until %d2 eventually reaches -1.
Fix this bug by terminating the loop as soon as %d4 or %d2 reach -1. Reset the timeout whenever a byte is copied.
--- drivers/block/swim_asm.S | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/block/swim_asm.S +9 -7
@@ -43,6 +43,8 @@ .equ sector_size, 512 .equ .Lhr_crc_error, 0x02 + .equ .Lhr_fifo_2bytes, 0x40 + .equ .Lhr_fifo_1byte, 0x80 .global swim_read_sector_header swim_read_sector_header:
@@ -189,20 +191,20 @@ wait_data_mark_byte: /* read data */ movel #sector_size-1, %d4 /* sector size */ -read_new_data: movew #max_retry, %d2 read_data_loop: moveb %a2@, %d5 - andb #0xc0, %d5 + andb #(.Lhr_fifo_1byte + .Lhr_fifo_2bytes), %d5 dbne %d2, read_data_loop beq data_exit + moveq #max_retry, %d2 moveb %a5@, %a4@+ - andb #0x40, %d5 - dbne %d4, read_new_data - beq exit_loop + dbra %d4, 1f + bra data_crc0 +1: andb #.Lhr_fifo_2bytes, %d5 + beq read_data_loop moveb %a5@, %a4@+ - dbra %d4, read_new_data -exit_loop: + dbra %d4, read_data_loop /* read CRC */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 534/1756 block: remove BLK_MQ_F_SHOULD_MERGE
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit cc76ace465d6977b47daa427379b7be1e0976f12 ]
BLK_MQ_F_SHOULD_MERGE is set for all tag_sets except those that purely process passthrough commands (bsg-lib, ufs tmf, various nvme admin queues) and thus don't even check the flag. Remove it to simplify the driver interface.
Stable-dep-of: 92353a047637 ("swim: Convert to blocking queue")
--- arch/um/drivers/ubd_kern.c | 1 - block/blk-mq-debugfs.c | 1 - block/blk-mq-sched.c | 3 +-- drivers/block/amiflop.c | 1 - drivers/block/aoe/aoeblk.c | 1 - drivers/block/ataflop.c | 1 - drivers/block/floppy.c | 1 - drivers/block/loop.c | 3 +-- drivers/block/mtip32xx/mtip32xx.c | 1 - drivers/block/nbd.c | 3 +-- drivers/block/null_blk/main.c | 2 -- drivers/block/ps3disk.c | 3 +-- drivers/block/rbd.c | 1 - drivers/block/rnbd/rnbd-clt.c | 3 +-- drivers/block/sunvdc.c | 2 +- drivers/block/swim.c | 2 +- drivers/block/swim3.c | 3 +-- drivers/block/ublk_drv.c | 1 - drivers/block/virtio_blk.c | 1 - drivers/block/xen-blkfront.c | 1 - drivers/block/z2ram.c | 1 - drivers/cdrom/gdrom.c | 2 +- drivers/md/dm-rq.c | 2 +- drivers/memstick/core/ms_block.c | 3 +-- drivers/memstick/core/mspro_block.c | 3 +-- drivers/mmc/core/queue.c | 2 +- drivers/mtd/mtd_blkdevs.c | 2 +- drivers/mtd/ubi/block.c | 2 +- drivers/nvme/host/apple.c | 1 - drivers/nvme/host/core.c | 1 - drivers/s390/block/dasd_genhd.c | 1 - drivers/s390/block/scm_blk.c | 1 - drivers/scsi/scsi_lib.c | 1 - include/linux/blk-mq.h | 1 - 34 files changed, 15 insertions(+), 43 deletions(-)
arch/um/drivers/ubd_kern.c +0 -1
@@ -865,7 +865,6 @@ static int ubd_add(int n, char **error_out) ubd_dev->tag_set.ops = &ubd_mq_ops; ubd_dev->tag_set.queue_depth =64 ; ubd_dev->tag_set.numa_node =NUMA_NO_NODE ; - ubd_dev->tag_set.flags =BLK_MQ_F_SHOULD_MERGE ; ubd_dev->tag_set.driver_data = ubd_dev; ubd_dev->tag_set.nr_hw_queues =1 ;
block/blk-mq-debugfs.c +0 -1
@@ -181,7 +181,6 @@ static const char *const alloc_policy_name[] = {#define HCTX_FLAG_NAME (name) [ilog2(BLK_MQ_F_##name)] = #namestatic const char *const hctx_flag_name[] = { -HCTX_FLAG_NAME (SHOULD_MERGE ),HCTX_FLAG_NAME (TAG_QUEUE_SHARED ),HCTX_FLAG_NAME (STACKING ),HCTX_FLAG_NAME (TAG_HCTX_SHARED ),
block/blk-mq-sched.c +1 -2
@@ -351,8 +351,7 @@ bool blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio, ctx =blk_mq_get_ctx (q); hctx =blk_mq_map_queue (q, bio->bi_opf, ctx); type = hctx->type; -if (!(hctx->flags &BLK_MQ_F_SHOULD_MERGE ) || -list_empty_careful (&ctx->rq_lists[type])) +if (list_empty_careful (&ctx->rq_lists[type])) goto out_put;/* default per sw-queue merge */
drivers/block/amiflop.c +0 -1
@@ -1872,7 +1872,6 @@ static int fd_alloc_drive(int drive) unit[drive].tag_set.nr_maps =1 ; unit[drive].tag_set.queue_depth =2 ; unit[drive].tag_set.numa_node =NUMA_NO_NODE ; - unit[drive].tag_set.flags =BLK_MQ_F_SHOULD_MERGE ;if (blk_mq_alloc_tag_set (&unit[drive].tag_set)) goto out_cleanup_trackbuf;
drivers/block/aoe/aoeblk.c +0 -1
@@ -368,7 +368,6 @@ aoeblk_gdalloc(void *vp) set->nr_hw_queues =1 ; set->queue_depth =128 ; set->numa_node =NUMA_NO_NODE ; - set->flags =BLK_MQ_F_SHOULD_MERGE ; err =blk_mq_alloc_tag_set (set);if (err) { pr_err("aoe: cannot allocate tag set for %ld.%d\n",
drivers/block/ataflop.c +0 -1
@@ -2088,7 +2088,6 @@ static int __init atari_floppy_init (void) unit[i].tag_set.nr_maps =1 ; unit[i].tag_set.queue_depth =2 ; unit[i].tag_set.numa_node =NUMA_NO_NODE ; - unit[i].tag_set.flags =BLK_MQ_F_SHOULD_MERGE ; ret =blk_mq_alloc_tag_set (&unit[i].tag_set);if (ret) goto err;
drivers/block/floppy.c +0 -1
@@ -4596,7 +4596,6 @@ static int __init do_floppy_init(void) tag_sets[drive].nr_maps =1 ; tag_sets[drive].queue_depth =2 ; tag_sets[drive].numa_node =NUMA_NO_NODE ; - tag_sets[drive].flags =BLK_MQ_F_SHOULD_MERGE ; err =blk_mq_alloc_tag_set (&tag_sets[drive]);if (err) goto out_put_disk;
drivers/block/loop.c +1 -2
@@ -2001,8 +2001,7 @@ static int loop_add(int i) lo->tag_set.queue_depth = hw_queue_depth; lo->tag_set.numa_node =NUMA_NO_NODE ; lo->tag_set.cmd_size =sizeof (struct loop_cmd ); - lo->tag_set.flags =BLK_MQ_F_SHOULD_MERGE |BLK_MQ_F_STACKING | -BLK_MQ_F_NO_SCHED_BY_DEFAULT ; + lo->tag_set.flags =BLK_MQ_F_STACKING |BLK_MQ_F_NO_SCHED_BY_DEFAULT ; lo->tag_set.driver_data = lo; err =blk_mq_alloc_tag_set (&lo->tag_set);
drivers/block/mtip32xx/mtip32xx.c +0 -1
@@ -3415,7 +3415,6 @@ static int mtip_block_initialize(struct driver_data *dd) dd->tags.reserved_tags =1 ; dd->tags.cmd_size =sizeof (struct mtip_cmd ); dd->tags.numa_node = dd->numa_node; - dd->tags.flags =BLK_MQ_F_SHOULD_MERGE ; dd->tags.driver_data = dd; dd->tags.timeout =MTIP_NCQ_CMD_TIMEOUT_MS ;
drivers/block/nbd.c +1 -2
@@ -1855,8 +1855,7 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs) nbd->tag_set.queue_depth =128 ; nbd->tag_set.numa_node =NUMA_NO_NODE ; nbd->tag_set.cmd_size =sizeof (struct nbd_cmd ); - nbd->tag_set.flags =BLK_MQ_F_SHOULD_MERGE | -BLK_MQ_F_BLOCKING ; + nbd->tag_set.flags =BLK_MQ_F_BLOCKING ; nbd->tag_set.driver_data = nbd;INIT_WORK (&nbd->remove_work, nbd_dev_remove_work); nbd->backend =NULL ;
drivers/block/null_blk/main.c +0 -2
@@ -1811,7 +1811,6 @@ static int null_init_global_tag_set(void) tag_set.nr_hw_queues = g_submit_queues; tag_set.queue_depth = g_hw_queue_depth; tag_set.numa_node = g_home_node; - tag_set.flags =BLK_MQ_F_SHOULD_MERGE ;if (g_no_sched) tag_set.flags |=BLK_MQ_F_NO_SCHED ;if (g_shared_tag_bitmap)
@@ -1837,7 +1836,6 @@ static int null_setup_tagset(struct nullb *nullb) nullb->tag_set->nr_hw_queues = nullb->dev->submit_queues; nullb->tag_set->queue_depth = nullb->dev->hw_queue_depth; nullb->tag_set->numa_node = nullb->dev->home_node; - nullb->tag_set->flags =BLK_MQ_F_SHOULD_MERGE ;if (nullb->dev->no_sched) nullb->tag_set->flags |=BLK_MQ_F_NO_SCHED ;if (nullb->dev->shared_tag_bitmap)
drivers/block/ps3disk.c +1 -2
@@ -438,8 +438,7 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev)ps3disk_identify (dev); - error =blk_mq_alloc_sq_tag_set (&priv->tag_set, &ps3disk_mq_ops,1 , -BLK_MQ_F_SHOULD_MERGE ); + error =blk_mq_alloc_sq_tag_set (&priv->tag_set, &ps3disk_mq_ops,1 ,0 );if (error) goto fail_teardown;
drivers/block/rbd.c +0 -1
@@ -4966,7 +4966,6 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) rbd_dev->tag_set.ops = &rbd_mq_ops; rbd_dev->tag_set.queue_depth = rbd_dev->opts->queue_depth; rbd_dev->tag_set.numa_node =NUMA_NO_NODE ; - rbd_dev->tag_set.flags =BLK_MQ_F_SHOULD_MERGE ; rbd_dev->tag_set.nr_hw_queues =num_present_cpus (); rbd_dev->tag_set.cmd_size =sizeof (struct rbd_img_request );
drivers/block/rnbd/rnbd-clt.c +1 -2
@@ -1209,8 +1209,7 @@ static int setup_mq_tags(struct rnbd_clt_session *sess) tag_set->ops = &rnbd_mq_ops; tag_set->queue_depth = sess->queue_depth; tag_set->numa_node =NUMA_NO_NODE ; - tag_set->flags =BLK_MQ_F_SHOULD_MERGE | -BLK_MQ_F_TAG_QUEUE_SHARED ; + tag_set->flags =BLK_MQ_F_TAG_QUEUE_SHARED ; tag_set->cmd_size =sizeof (struct rnbd_iu ) +RNBD_RDMA_SGL_SIZE ;/* for HCTX_TYPE_DEFAULT, HCTX_TYPE_READ, HCTX_TYPE_POLL */
drivers/block/sunvdc.c +1 -1
@@ -853,7 +853,7 @@ static int probe_disk(struct vdc_port *port) } err =blk_mq_alloc_sq_tag_set (&port->tag_set, &vdc_mq_ops, -VDC_TX_RING_SIZE ,BLK_MQ_F_SHOULD_MERGE ); +VDC_TX_RING_SIZE ,0 );if (err)return err;
drivers/block/swim.c +1 -1
@@ -846,7 +846,7 @@ static int swim_floppy_init(struct platform_device *pdev)for (drive =0 ; drive < swd->floppy_count; drive++) { err =blk_mq_alloc_sq_tag_set (&swd->unit[drive].tag_set, - &swim_mq_ops,2 ,BLK_MQ_F_SHOULD_MERGE ); + &swim_mq_ops,2 ,0 );if (err) goto exit_put_disks;
drivers/block/swim3.c +1 -2
@@ -1208,8 +1208,7 @@ static int swim3_attach(struct macio_dev *mdev, fs = &floppy_states[floppy_count];memset (fs,0 ,sizeof (*fs)); - rc =blk_mq_alloc_sq_tag_set (&fs->tag_set, &swim3_mq_ops,2 , -BLK_MQ_F_SHOULD_MERGE ); + rc =blk_mq_alloc_sq_tag_set (&fs->tag_set, &swim3_mq_ops,2 ,0 );if (rc) goto out_unregister;
drivers/block/ublk_drv.c +0 -1
@@ -2311,7 +2311,6 @@ static int ublk_add_tag_set(struct ublk_device *ub) ub->tag_set.queue_depth = ub->dev_info.queue_depth; ub->tag_set.numa_node =NUMA_NO_NODE ; ub->tag_set.cmd_size =sizeof (struct ublk_rq_data ); - ub->tag_set.flags =BLK_MQ_F_SHOULD_MERGE ; ub->tag_set.driver_data = ub;return blk_mq_alloc_tag_set (&ub->tag_set); }
drivers/block/virtio_blk.c +0 -1
@@ -1481,7 +1481,6 @@ static int virtblk_probe(struct virtio_device *vdev) vblk->tag_set.ops = &virtio_mq_ops; vblk->tag_set.queue_depth = queue_depth; vblk->tag_set.numa_node =NUMA_NO_NODE ; - vblk->tag_set.flags =BLK_MQ_F_SHOULD_MERGE ; vblk->tag_set.cmd_size =sizeof (struct virtblk_req ) +sizeof (struct scatterlist ) *VIRTIO_BLK_INLINE_SG_CNT ;
drivers/block/xen-blkfront.c +0 -1
@@ -1131,7 +1131,6 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, }else info->tag_set.queue_depth =BLK_RING_SIZE (info); info->tag_set.numa_node =NUMA_NO_NODE ; - info->tag_set.flags =BLK_MQ_F_SHOULD_MERGE ; info->tag_set.cmd_size =sizeof (struct blkif_req ); info->tag_set.driver_data = info;
drivers/block/z2ram.c +0 -1
@@ -354,7 +354,6 @@ static int __init z2_init(void) tag_set.nr_maps =1 ; tag_set.queue_depth =16 ; tag_set.numa_node =NUMA_NO_NODE ; - tag_set.flags =BLK_MQ_F_SHOULD_MERGE ; ret =blk_mq_alloc_tag_set (&tag_set);if (ret) goto out_unregister_blkdev;
drivers/cdrom/gdrom.c +1 -1
@@ -777,7 +777,7 @@ static int probe_gdrom(struct platform_device *devptr)probe_gdrom_setupcd (); err =blk_mq_alloc_sq_tag_set (&gd.tag_set, &gdrom_mq_ops,1 , -BLK_MQ_F_SHOULD_MERGE |BLK_MQ_F_BLOCKING ); +BLK_MQ_F_BLOCKING );if (err) goto probe_fail_free_cd_info;
drivers/md/dm-rq.c +1 -1
@@ -553,7 +553,7 @@ int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t) md->tag_set->ops = &dm_mq_ops; md->tag_set->queue_depth =dm_get_blk_mq_queue_depth (); md->tag_set->numa_node = md->numa_node_id; - md->tag_set->flags =BLK_MQ_F_SHOULD_MERGE |BLK_MQ_F_STACKING ; + md->tag_set->flags =BLK_MQ_F_STACKING ; md->tag_set->nr_hw_queues =dm_get_blk_mq_nr_hw_queues (); md->tag_set->driver_data = md;
drivers/memstick/core/ms_block.c +1 -2
@@ -2098,8 +2098,7 @@ static int msb_init_disk(struct memstick_dev *card)if (msb->disk_id <0 )return msb->disk_id; - rc =blk_mq_alloc_sq_tag_set (&msb->tag_set, &msb_mq_ops,2 , -BLK_MQ_F_SHOULD_MERGE ); + rc =blk_mq_alloc_sq_tag_set (&msb->tag_set, &msb_mq_ops,2 ,0 );if (rc) goto out_release_id;
drivers/memstick/core/mspro_block.c +1 -2
@@ -1139,8 +1139,7 @@ static int mspro_block_init_disk(struct memstick_dev *card)if (disk_id <0 )return disk_id; - rc =blk_mq_alloc_sq_tag_set (&msb->tag_set, &mspro_mq_ops,2 , -BLK_MQ_F_SHOULD_MERGE ); + rc =blk_mq_alloc_sq_tag_set (&msb->tag_set, &mspro_mq_ops,2 ,0 );if (rc) goto out_release_id;
drivers/mmc/core/queue.c +1 -1
@@ -452,7 +452,7 @@ struct gendisk *mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,else mq->tag_set.queue_depth =MMC_QUEUE_DEPTH ; mq->tag_set.numa_node =NUMA_NO_NODE ; - mq->tag_set.flags =BLK_MQ_F_SHOULD_MERGE |BLK_MQ_F_BLOCKING ; + mq->tag_set.flags =BLK_MQ_F_BLOCKING ; mq->tag_set.nr_hw_queues =1 ; mq->tag_set.cmd_size =sizeof (struct mmc_queue_req ); mq->tag_set.driver_data = mq;
drivers/mtd/mtd_blkdevs.c +1 -1
@@ -329,7 +329,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) goto out_list_del; ret =blk_mq_alloc_sq_tag_set (new->tag_set, &mtd_mq_ops,2 , -BLK_MQ_F_SHOULD_MERGE |BLK_MQ_F_BLOCKING ); +BLK_MQ_F_BLOCKING );if (ret) goto out_kfree_tag_set;
drivers/mtd/ubi/block.c +1 -1
@@ -383,7 +383,7 @@ int ubiblock_create(struct ubi_volume_info *vi) dev->tag_set.ops = &ubiblock_mq_ops; dev->tag_set.queue_depth =64 ; dev->tag_set.numa_node =NUMA_NO_NODE ; - dev->tag_set.flags =BLK_MQ_F_SHOULD_MERGE |BLK_MQ_F_BLOCKING ; + dev->tag_set.flags =BLK_MQ_F_BLOCKING ; dev->tag_set.cmd_size =sizeof (struct ubiblock_pdu ); dev->tag_set.driver_data = dev; dev->tag_set.nr_hw_queues =1 ;
drivers/nvme/host/apple.c +0 -1
@@ -1290,7 +1290,6 @@ static int apple_nvme_alloc_tagsets(struct apple_nvme *anv) anv->tagset.timeout =NVME_IO_TIMEOUT ; anv->tagset.numa_node =NUMA_NO_NODE ; anv->tagset.cmd_size =sizeof (struct apple_nvme_iod ); - anv->tagset.flags =BLK_MQ_F_SHOULD_MERGE ; anv->tagset.driver_data = &anv->ioq; ret =blk_mq_alloc_tag_set (&anv->tagset);
drivers/nvme/host/core.c +0 -1
@@ -4721,7 +4721,6 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,/* Reserved for fabric connect */ set->reserved_tags =1 ; set->numa_node = ctrl->numa_node; - set->flags =BLK_MQ_F_SHOULD_MERGE ;if (ctrl->ops->flags &NVME_F_BLOCKING ) set->flags |=BLK_MQ_F_BLOCKING ; set->cmd_size = cmd_size;
drivers/s390/block/dasd_genhd.c +0 -1
@@ -56,7 +56,6 @@ int dasd_gendisk_alloc(struct dasd_block *block) block->tag_set.cmd_size =sizeof (struct dasd_ccw_req ); block->tag_set.nr_hw_queues = nr_hw_queues; block->tag_set.queue_depth = queue_depth; - block->tag_set.flags =BLK_MQ_F_SHOULD_MERGE ; block->tag_set.numa_node =NUMA_NO_NODE ; rc =blk_mq_alloc_tag_set (&block->tag_set);if (rc)
drivers/s390/block/scm_blk.c +0 -1
@@ -461,7 +461,6 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev) bdev->tag_set.cmd_size =sizeof (blk_status_t); bdev->tag_set.nr_hw_queues = nr_requests; bdev->tag_set.queue_depth = nr_requests_per_io * nr_requests; - bdev->tag_set.flags =BLK_MQ_F_SHOULD_MERGE ; bdev->tag_set.numa_node =NUMA_NO_NODE ; ret =blk_mq_alloc_tag_set (&bdev->tag_set);
drivers/scsi/scsi_lib.c +0 -1
@@ -2110,7 +2110,6 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) tag_set->queue_depth = shost->can_queue; tag_set->cmd_size = cmd_size; tag_set->numa_node =dev_to_node (shost->dma_dev); - tag_set->flags =BLK_MQ_F_SHOULD_MERGE ; tag_set->flags |=BLK_ALLOC_POLICY_TO_MQ_FLAG (shost->hostt->tag_alloc_policy);if (shost->queuecommand_may_block)
include/linux/blk-mq.h +0 -1
@@ -668,7 +668,6 @@ struct blk_mq_ops {/* Keep hctx_flag_name[] in sync with the definitions below */ enum { -BLK_MQ_F_SHOULD_MERGE =1 <<0 ,BLK_MQ_F_TAG_QUEUE_SHARED =1 <<1 ,/* * Set when this device requires underlying blk-mq device for
Signature · 1 line
2.53.0
Miguel Ojeda
maintainerRe: [PATCH 6.12 0534/1756] block: remove BLK_MQ_F_SHOULD_MERGE
include/linux/blk-mq.h struct blk_mq_ops { · line 671
Quoted 9 lines · On Wed, 18 Nov 2026 15:44:21 +0100 Greg Kroah-Hartman…
BLK_MQ_F_SHOULD_MERGEis set for alltag_setsexcept those that purely process passthrough commands (bsg-lib, ufs tmf, various nvme admin queues) and thus don't even check the flag. Remove it to simplify the driver interface.enum {
include/linux/blk-mq.h +0
-1-BLK_MQ_F_SHOULD_MERGE =1 <<0 , BLK_MQ_F_TAG_QUEUE_SHARED = 1 << 1,
This causes:
error[E0425]: cannot find value `BLK_MQ_F_SHOULD_MERGE` in crate `bindings`
--> rust/kernel/block/mq/tag_set.rs:55:38
|
55 | flags: bindings::BLK_MQ_F_SHOULD_MERGE,
| ^^^^^^^^^^^^^^^^^^^^^ not found in `bindings`We need:
31d813a3b8cb ("rust: block: fix use of BLK_MQ_F_SHOULD_MERGE")
I hope that helps!
Cheers,
Miguel
Sasha Levin
maintainerRe: [PATCH 6.12 0534/1756] block: remove BLK_MQ_F_SHOULD_MERGE
Quoted 1 line · Miguel Ojeda
error[E0425]: cannot find value
BLK_MQ_F_SHOULD_MERGEin cratebindings
Dropped cc76ace465d6 ("block: remove BLK_MQ_F_SHOULD_MERGE") from the 6.12 queue, along with the swim patches it was queued for: 92353a047637 ("swim:
Convert to blocking queue") and the swim patches after it (04cb277e6841, b736189c93c9, abae04f5bed9 and bbcd3e38a4f3), plus b9c109504853 ("swim: Add track zero recalibration delay"). Thanks for the pointer to 31d813a3b8cb.
Signature · 2 lines
Thanks, Sasha
Greg Kroah-Hartman
maintainerPATCH 535/1756 swim: Convert to blocking queue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 92353a04763726f70fea6be90957c50fc18215e0 ]
These drives are slow: completing a request can take hundreds of milliseconds. Delays are managed by disabling interrupts judiciously and sleeping opportunistically.
As of commit e3896d77b702 ("swim: convert to blk-mq"), a spinlock is taken in irq mode as soon as a request is issued. That lock is held for the duration of the request. Hence the driver sleeps while holding the lock which is forbidden.
Adopt BLK_MQ_F_BLOCKING and remove the spinlock. Use a mutex to serialize requests from the two request queues. (The chip cannot simultaneously process requests on both internal and external drive.)
--- drivers/block/swim.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/block/swim.c +3 -8
@@ -211,7 +211,6 @@ enum head {struct swim_priv {struct swim __iomem *base; -spinlock_t lock;int floppy_count;struct floppy_state unit[FD_MAX_UNIT ]; };
@@ -537,12 +536,10 @@ static blk_status_t swim_queue_rq(struct blk_mq_hw_ctx *hctx, const struct blk_mq_queue_data *bd) {struct floppy_state *fs = hctx->queue->queuedata; -struct swim_priv *swd = fs->swd;struct request *req = bd->rq;blk_status_t err; -if (!spin_trylock_irq (&swd->lock)) -return BLK_STS_DEV_RESOURCE ; +mutex_lock (&swim_mutex);blk_mq_start_request (req);
@@ -560,7 +557,7 @@ static blk_status_t swim_queue_rq(struct blk_mq_hw_ctx *hctx, err =BLK_STS_OK ; out: -spin_unlock_irq (&swd->lock); +mutex_unlock (&swim_mutex);return err; }
@@ -842,11 +839,9 @@ static int swim_floppy_init(struct platform_device *pdev)return -EBUSY ; } -spin_lock_init (&swd->lock); -for (drive =0 ; drive < swd->floppy_count; drive++) { err =blk_mq_alloc_sq_tag_set (&swd->unit[drive].tag_set, - &swim_mq_ops,2 ,0 ); + &swim_mq_ops,2 ,BLK_MQ_F_BLOCKING );if (err) goto exit_put_disks;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 536/1756 swim: Remove redundant RELAX actions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 04cb277e6841b55b950b42063fe11501b5d1676a ]
Wherever we have a swim_select() or swim_readbit() call there is an implicit RELAX. That means the caller doesn't have to do it. Remove the redundant code.
BTW, Inside Macintosh says, "Be sure [...] that CA0 and CA1 are set high before changing SEL." Hence the RELAX found in swim_select(). The SwimIII driver in mkLinux also has that. But the swim3.c driver in Linux is odd:
it scatters RELAX actions around as though SEL was not actually under its control... In anycase, swim.c really does control SEL so there's no need for that here.
Stable-dep-of: b736189c93c9 ("swim: Deduplicate polling loops")
--- drivers/block/swim.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/block/swim.c +1 -7
@@ -336,7 +336,6 @@ static inline void swim_motor(struct swim __iomem *base,swim_action (base,MOTOR_ON );for (i =0 ; i <2 *HZ ; i++) { -swim_select (base,RELAX );if (swim_readbit (base,MOTOR_ON ))break ;set_current_state (TASK_INTERRUPTIBLE );
@@ -344,7 +343,7 @@ static inline void swim_motor(struct swim __iomem *base, } }else if (action ==OFF ) {swim_action (base,MOTOR_OFF ); -swim_select (base,RELAX ); +swim_write (base, phase,RELAX |PHASE_PIN_DIR ); } }
@@ -355,13 +354,11 @@ static inline void swim_eject(struct swim __iomem *base)swim_action (base,EJECT );for (i =0 ; i <2 *HZ ; i++) { -swim_select (base,RELAX );if (!swim_readbit (base,DISK_IN ))break ;set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (1 ); } -swim_select (base,RELAX ); }static inline void swim_head (struct swim __iomem *base,enum head head)
@@ -385,7 +382,6 @@ static inline int swim_step(struct swim __iomem *base)set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (1 ); -swim_select (base,RELAX );if (!swim_readbit (base,STEP ))return 0 ; }
@@ -399,8 +395,6 @@ static inline int swim_track00(struct swim __iomem *base)swim_action (base,SEEK_NEGATIVE );for (try =0 ; try <100 ; try++) { - -swim_select (base,RELAX );msleep (3 );if (swim_readbit (base,TRACK_ZERO ))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 537/1756 swim: Deduplicate polling loops
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit b736189c93c9ad1056521a4229ec2f252b714b5a ]
Replace duplicated polling loops with poll_timeout_us(). Change the interruptible sleep to uninterruptible because signal delivery shouldn't be allowed to shorten delays required by the drive hardware.
Change the timeout for the !STEP transition to 20 ms in accordance with the maximum interval required by the UPD72070 spec. The existing 1 second timeout is impractical considering the number of steps in a typical seek.
Change the return type of swim_readbit() to bool because that way the bit names make sense i.e. the reader doesn't have to remember to invert the active-low logic used for drive signals.
--- drivers/block/swim.c | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-)
drivers/block/swim.c +8 -31
@@ -19,6 +19,7 @@#include <linux/major.h> #include <linux/mutex.h> #include <linux/hdreg.h> +#include <linux/iopoll.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/platform_device.h>
@@ -296,7 +297,7 @@ static inline void swim_action(struct swim __iomem *base, int action)local_irq_restore (flags); } -static inline int swim_readbit (struct swim __iomem *base,int bit) +static inline bool swim_readbit (struct swim __iomem *base,int bit) {int stat;
@@ -309,6 +310,9 @@ static inline int swim_readbit(struct swim __iomem *base, int bit)return (stat &SENSE ) ==0 ; } +#define swim_readbit_timeout (base, bit, val, timeout_us) \ + poll_timeout_us(, swim_readbit(base, bit) == val, 1000, timeout_us, false) +static inline void swim_drive (struct swim __iomem *base,enum drive_location location) {
@@ -331,16 +335,8 @@ static inline void swim_motor(struct swim __iomem *base, enum motor_action action) {if (action ==ON ) { -int i; -swim_action (base,MOTOR_ON ); - -for (i =0 ; i <2 *HZ ; i++) { -if (swim_readbit (base,MOTOR_ON )) -break ; -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (1 ); - } +swim_readbit_timeout (base,MOTOR_ON , true,2000 *1000 ); }else if (action ==OFF ) {swim_action (base,MOTOR_OFF );swim_write (base, phase,RELAX |PHASE_PIN_DIR );
@@ -349,16 +345,8 @@ static inline void swim_motor(struct swim __iomem *base,static inline void swim_eject (struct swim __iomem *base) { -int i; -swim_action (base,EJECT ); - -for (i =0 ; i <2 *HZ ; i++) { -if (!swim_readbit (base,DISK_IN )) -break ; -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (1 ); - } +swim_readbit_timeout (base,DISK_IN , false,2000 *1000 ); }static inline void swim_head (struct swim __iomem *base,enum head head)
@@ -373,19 +361,8 @@ static inline void swim_head(struct swim __iomem *base, enum head head)static inline int swim_step (struct swim __iomem *base) { -int wait; -swim_action (base,STEP ); - -for (wait =0 ; wait <HZ ; wait++) { - -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (1 ); - -if (!swim_readbit (base,STEP )) -return 0 ; - } -return -1 ; +return swim_readbit_timeout (base,STEP , false,20 *1000 ); }static inline int swim_track00 (struct swim __iomem *base)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 538/1756 swim: Check drive ready bit
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit abae04f5bed924590e98fe1519566a6e0144e6b5 ]
The drive provides a readiness signal that has to be tested before certain commands are issued to the drive. Rename the SEEK_COMPLETE flag as READY because that's how it's known in the documentation as well as the mkLinux source code.
Poll for that signal after stepping the heads and also after switching to MFM mode, as that's what mkLinux does. Check for readiness when stepping because testing shows that some drives require this.
--- drivers/block/swim.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
drivers/block/swim.c +22 -7
@@ -117,7 +117,7 @@ struct iwm {#define TACHO 0x103#define READ_DATA_1 0x104#define GCR_MODE 0x105 -#define SEEK_COMPLETE 0x106 +#define READY 0x106#define TWOMEG_MEDIA 0x107/* Bits in handshake register */
@@ -313,6 +313,14 @@ static inline bool swim_readbit(struct swim __iomem *base, int bit)#define swim_readbit_timeout (base, bit, val, timeout_us) \ poll_timeout_us(, swim_readbit(base, bit) == val, 1000, timeout_us, false) +#define swim_READY_timeout (base) \ +({ \ + int ret = swim_readbit_timeout(base, READY, true, 1000 * 1000); \ + if (ret) \ + printk(KERN_DEBUG "%s: drive not ready\n", __func__); \ + ret; \ +}) +static inline void swim_drive (struct swim __iomem *base,enum drive_location location) {
@@ -351,8 +359,6 @@ static inline void swim_eject(struct swim __iomem *base)static inline void swim_head (struct swim __iomem *base,enum head head) { -/* wait drive is ready */ -if (head ==UPPER_HEAD )swim_select (base,READ_DATA_1 );else if (head ==LOWER_HEAD )
@@ -387,20 +393,25 @@ static inline int swim_track00(struct swim __iomem *base)static inline int swim_seek (struct swim __iomem *base,int step) { -if (step ==0 ) -return 0 ; -if (step <0 ) {swim_action (base,SEEK_NEGATIVE ); step = -step; - }else + }else if (step >0 )swim_action (base,SEEK_POSITIVE ); +swim_READY_timeout (base); + +if (step ==0 ) +return 0 ; +for ( ; step >0 ; step--) {if (swim_step (base))return -1 ; } +msleep (30 ); +swim_READY_timeout (base); +return 0 ; }
@@ -482,6 +493,8 @@ static blk_status_t floppy_read_sectors(struct floppy_state *fs,swim_drive (base, fs->location); +swim_READY_timeout (base); +for (i = req_sector; i < req_sector + sectors_nb; i++) {int x; track = i / fs->secpercyl;
@@ -602,6 +615,8 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode)swim_motor (base,ON );swim_action (base,SETMFM ); +msleep (30 ); +swim_READY_timeout (base);set_capacity (fs->disk, fs->total_secs);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 539/1756 swim: Revisit delays
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit bbcd3e38a4f355d6b0320f3f6916df96c109f2ad ]
AFAIK, timing requirements for the various FDHD drive mechanisms aren't well documented. But we do have the UPD72070 spec and secondary sources like swim3.c and mkLinux source code. This patch is needed to satisfy the requirements in the UPD72070 spec and follows mkLinux.
Change the LSTRB pulse to 2 microseconds, because this is what mkLinux does. Inside Macintosh says, "Hold LSTRB high for at least one usec but not more than one msec".
When a disk is ejected, pause before de-asserting /ENBL. Wait 150 us after the STEP command for valid signalling. Pause for 1 us after setting the step direction before sending the STEP command.
--- drivers/block/swim.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/block/swim.c +5 -1
@@ -290,7 +290,7 @@ static inline void swim_action(struct swim __iomem *base, int action)swim_select (base, action);udelay (1 );swim_write (base, phase,LSTRB | action |PHASE_PIN_DIR ); -udelay (1 ); +udelay (2 );swim_write (base, phase, action |PHASE_PIN_DIR );udelay (1 );
@@ -337,6 +337,7 @@ static inline void swim_drive(struct swim __iomem *base,swim_write (base, mode0,EXTERNAL_DRIVE );swim_write (base, mode0,MOTON ); } +udelay (1 ); } static inline void swim_motor(struct swim __iomem *base,
@@ -355,6 +356,7 @@ static inline void swim_eject(struct swim __iomem *base) {swim_action (base,EJECT );swim_readbit_timeout (base,DISK_IN , false,2000 *1000 ); +msleep (1 ); }static inline void swim_head (struct swim __iomem *base,enum head head)
@@ -368,6 +370,7 @@ static inline void swim_head(struct swim __iomem *base, enum head head)static inline int swim_step (struct swim __iomem *base) {swim_action (base,STEP ); +udelay (150 );return swim_readbit_timeout (base,STEP , false,20 *1000 ); }
@@ -398,6 +401,7 @@ static inline int swim_seek(struct swim __iomem *base, int step) step = -step; }else if (step >0 )swim_action (base,SEEK_POSITIVE ); +udelay (1 );swim_READY_timeout (base);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 540/1756 swim: Dont search beyond the first data mark
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 79eafa4ccb74be023fd2cae87d75425d6eb903bb ]
The ISM chip does an automatic MFM gap/sync search when the Action bit is first set. That search may stop at any of a) post-index gap, b) address field gap or c) data field gap. To find the next sector header, the driver need not search at all. It only has to validate the mark bytes.
Once the sector address mark has been validated, swim_read_sector_data() is called to read the sector contents. Between the sector address and data fields lies an intra-sector gap followed by a data field mark. After this mark is validated, the 512-byte data area is read into the IO request buffer.
Problem is, if any byte in the data field mark is mis-read, the driver searches the whole sector and then reaches the data field mark in the following sector. The wrong sector is then read into the buffer, and swim_read_sector_data() returns success. The request is silently corrupted.
The existing limit on polling loop iterations does constrain the search distance but is inherently tied to CPU speed. This is probably the reason why corruption was only observed on a 68030 system.
Discontinue the mark search when the mark bytes fail validation.
--- drivers/block/swim_asm.S | 73 ++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 33 deletions(-)
drivers/block/swim_asm.S +40 -33
@@ -41,18 +41,45 @@ .equ seek_time, 30000 .equ max_retry, 40 .equ sector_size, 512 + .equ .Lmark_sequence_len, 4 .equ .Lhr_crc_error, 0x02 .equ .Lhr_fifo_2bytes, 0x40 .equ .Lhr_fifo_1byte, 0x80 +.Lmfm_mark_check: + /* + * This subroutine reads and validates a mark byte sequence. + * On entry, %a1 and %d4 shall hold the location and length (resp.) + * of the mark byte array. + * %a2 and %a3 shall hold the locations of the handshake and mark + * registers. + * Returns zero in %d1 for success. + */ + + moveq #-1, %d1 + subq #1, %d4 + movew #seek_time, %d2 + +5: tstb %a2@ + dbmi %d2, 5b + bpl 6f + + moveb %a3@, %d3 + cmpb %a1@+, %d3 + dbne %d4, 5b + bne 6f + + moveq #0, %d1 +6: rts + .global swim_read_sector_header swim_read_sector_header: link %a6, #0 moveml %d1-%d5/%a0-%a5,%sp@- movel %a6@(0x0c), %a4 moveq #-1, %d0 - bsr mfm_read_addrmark + bsr .Lmfm_read_header moveml %sp@+, %d1-%d5/%a0-%a5 unlk %a6 rts
@@ -62,33 +89,25 @@ sector_address_mark: sector_data_mark: .byte 0xa1, 0xa1, 0xa1, 0xfb -mfm_read_addrmark: +.Lmfm_read_header: movel %a6@(0x08), %a3 lea %a3@(read_handshake), %a2 lea %a3@(read_data), %a5 lea %a3@(read_mark), %a3 - movew #seek_time, %d2 -wait_header_init: moveb #0x18, %a3@(write_mode0 - read_mark) moveb #0x01, %a3@(write_mode1 - read_mark) moveb #0x01, %a3@(write_mode0 - read_mark) tstb %a3@(read_error - read_mark) moveb #0x08, %a3@(write_mode1 - read_mark) - lea sector_address_mark, %a0 - moveq #3, %d1 - -wait_addr_mark_byte: - - tstb %a2@ - dbmi %d2, wait_addr_mark_byte - bpl signal_nonyb + lea sector_address_mark, %a1 + moveq #.Lmark_sequence_len, %d4 + bsr .Lmfm_mark_check + tstl %d1 + bne signal_nonyb - moveb %a3@, %d3 - cmpb %a0@+, %d3 - dbne %d1, wait_addr_mark_byte - bne wait_header_init + /* read header */ moveq #max_retry, %d2
@@ -163,30 +182,18 @@ mfm_read_data: lea %a3@(read_handshake), %a2 lea %a3@(read_data), %a5 lea %a3@(read_mark), %a3 - movew #seek_time, %d2 -wait_data_init: moveb #0x18, %a3@(write_mode0 - read_mark) moveb #0x01, %a3@(write_mode1 - read_mark) moveb #0x01, %a3@(write_mode0 - read_mark) tstb %a3@(read_error - read_mark) moveb #0x08, %a3@(write_mode1 - read_mark) - lea sector_data_mark, %a0 - moveq #3, %d1 - - /* wait data address mark */ - -wait_data_mark_byte: - - tstb %a2@ - dbmi %d2, wait_data_mark_byte - bpl data_exit - - moveb %a3@, %d3 - cmpb %a0@+, %d3 - dbne %d1, wait_data_mark_byte - bne wait_data_init + lea sector_data_mark, %a1 + moveq #.Lmark_sequence_len, %d4 + bsr .Lmfm_mark_check + tstl %d1 + bne data_exit /* read data */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 541/1756 media: i2c: ov5648: Fix a data race on state->streaming
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ginger Li <[email protected]>
[ Upstream commit 76c8ffbe1b9bc0ee4c977180e3f498352de0d01e ]
ov5648_s_stream() updates state->streaming after it has released sensor->mutex, while ov5648_resume() reads that field with sensor->mutex held. A concurrent resume can therefore observe a stale streaming state and leave the sensor in standby while the software believes that it is streaming, or the other way around.
Keep the update inside the sensor->mutex protected section that already programs the standby mode.
--- drivers/media/i2c/ov5648.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/ov5648.c +2 -2
@@ -2145,13 +2145,13 @@ static int ov5648_s_stream(struct v4l2_subdev *subdev, int enable)mutex_lock (&sensor->mutex); ret =ov5648_sw_standby (sensor, !enable); +if (!ret) + state->streaming = !!enable;mutex_unlock (&sensor->mutex);if (ret)return ret; - state->streaming = !!enable; -if (!enable)pm_runtime_put (sensor->dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 542/1756 serial: msm: select PM_OPP
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Sinyavin <[email protected]>
[ Upstream commit 6a8352bb4e4bfcf67fa23c49d2e0d14684ffe2e6 ]
Commit 173ebdedcd84 ("serial: msm: Use OPP table for DVFS support") made the MSM serial driver unconditionally configure the core clock through the OPP framework during probe.
When CONFIG_PM_OPP is disabled, devm_pm_opp_set_clkname() is a stub that returns -EOPNOTSUPP, so every MSM serial port fails to probe. Select PM_OPP to keep minimal configurations functional.
--- drivers/tty/serial/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/Kconfig +1 -0
@@ -894,6 +894,7 @@ config SERIAL_JSM config SERIAL_MSM tristate "MSM on-chip serial port support" depends on ARCH_QCOM || COMPILE_TEST + select PM_OPP select SERIAL_CORE config SERIAL_MSM_CONSOLE
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 543/1756 serial: Switch back to struct platform_driver::remove()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 5cbb9b1705ab8d98ed96affa4ec399023a22b755 ]
After commit 0edb555a65d1 ("platform: Make platform_driver::remove() return void") .remove() is (again) the right callback to implement for platform drivers.
Convert all platform drivers below drivers/tty/serial to use .remove(), with the eventual goal to drop struct platform_driver::remove_new(). As .remove() and .remove_new() have the same prototypes, conversion is done by just changing the structure member name in the driver initializer.
Stable-dep-of: 22c6a6ac74c2 ("serial: txx9: Drop noop probe function and dangerous remove callback")
--- drivers/tty/serial/8250/8250_aspeed_vuart.c | 2 +- drivers/tty/serial/8250/8250_bcm2835aux.c | 2 +- drivers/tty/serial/8250/8250_bcm7271.c | 2 +- drivers/tty/serial/8250/8250_dw.c | 2 +- drivers/tty/serial/8250/8250_em.c | 2 +- drivers/tty/serial/8250/8250_fsl.c | 2 +- drivers/tty/serial/8250/8250_ingenic.c | 2 +- drivers/tty/serial/8250/8250_ioc3.c | 2 +- drivers/tty/serial/8250/8250_lpc18xx.c | 2 +- drivers/tty/serial/8250/8250_mtk.c | 2 +- drivers/tty/serial/8250/8250_of.c | 2 +- drivers/tty/serial/8250/8250_omap.c | 2 +- drivers/tty/serial/8250/8250_platform.c | 2 +- drivers/tty/serial/8250/8250_pxa.c | 2 +- drivers/tty/serial/8250/8250_tegra.c | 2 +- drivers/tty/serial/8250/8250_uniphier.c | 2 +- drivers/tty/serial/altera_jtaguart.c | 2 +- drivers/tty/serial/altera_uart.c | 2 +- drivers/tty/serial/amba-pl011.c | 2 +- drivers/tty/serial/ar933x_uart.c | 2 +- drivers/tty/serial/atmel_serial.c | 2 +- drivers/tty/serial/bcm63xx_uart.c | 2 +- drivers/tty/serial/clps711x.c | 2 +- drivers/tty/serial/cpm_uart.c | 2 +- drivers/tty/serial/digicolor-usart.c | 2 +- drivers/tty/serial/esp32_acm.c | 2 +- drivers/tty/serial/esp32_uart.c | 2 +- drivers/tty/serial/fsl_linflexuart.c | 2 +- drivers/tty/serial/fsl_lpuart.c | 2 +- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/lantiq.c | 2 +- drivers/tty/serial/liteuart.c | 2 +- drivers/tty/serial/lpc32xx_hs.c | 2 +- drivers/tty/serial/ma35d1_serial.c | 2 +- drivers/tty/serial/mcf.c | 2 +- drivers/tty/serial/meson_uart.c | 2 +- drivers/tty/serial/milbeaut_usio.c | 2 +- drivers/tty/serial/mpc52xx_uart.c | 2 +- drivers/tty/serial/msm_serial.c | 2 +- drivers/tty/serial/mxs-auart.c | 2 +- drivers/tty/serial/omap-serial.c | 2 +- drivers/tty/serial/owl-uart.c | 2 +- drivers/tty/serial/pic32_uart.c | 2 +- drivers/tty/serial/pmac_zilog.c | 2 +- drivers/tty/serial/qcom_geni_serial.c | 2 +- drivers/tty/serial/rda-uart.c | 2 +- drivers/tty/serial/sa1100.c | 2 +- drivers/tty/serial/samsung_tty.c | 2 +- drivers/tty/serial/sccnxp.c | 2 +- drivers/tty/serial/serial-tegra.c | 2 +- drivers/tty/serial/serial_txx9.c | 2 +- drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/sifive.c | 2 +- drivers/tty/serial/sprd_serial.c | 2 +- drivers/tty/serial/st-asc.c | 2 +- drivers/tty/serial/stm32-usart.c | 2 +- drivers/tty/serial/sunhv.c | 2 +- drivers/tty/serial/sunplus-uart.c | 2 +- drivers/tty/serial/sunsab.c | 2 +- drivers/tty/serial/sunsu.c | 2 +- drivers/tty/serial/sunzilog.c | 2 +- drivers/tty/serial/tegra-tcu.c | 2 +- drivers/tty/serial/timbuart.c | 2 +- drivers/tty/serial/uartlite.c | 2 +- drivers/tty/serial/ucc_uart.c | 2 +- drivers/tty/serial/xilinx_uartps.c | 2 +- 66 files changed, 66 insertions(+), 66 deletions(-)
drivers/tty/serial/8250/8250_aspeed_vuart.c +1 -1
@@ -569,7 +569,7 @@ static struct platform_driver aspeed_vuart_driver = { .of_match_table = aspeed_vuart_table, }, .probe = aspeed_vuart_probe, - .remove_new = aspeed_vuart_remove, + .remove = aspeed_vuart_remove, };module_platform_driver (aspeed_vuart_driver);
drivers/tty/serial/8250/8250_bcm2835aux.c +1 -1
@@ -267,7 +267,7 @@ static struct platform_driver bcm2835aux_serial_driver = { .pm = pm_ptr(&bcm2835aux_dev_pm_ops), }, .probe = bcm2835aux_serial_probe, - .remove_new = bcm2835aux_serial_remove, + .remove = bcm2835aux_serial_remove, };module_platform_driver (bcm2835aux_serial_driver);
drivers/tty/serial/8250/8250_bcm7271.c +1 -1
@@ -1204,7 +1204,7 @@ static struct platform_driver brcmuart_platform_driver = { .of_match_table = brcmuart_dt_ids, }, .probe = brcmuart_probe, - .remove_new = brcmuart_remove, + .remove = brcmuart_remove, };static int __init brcmuart_init (void )
drivers/tty/serial/8250/8250_dw.c +1 -1
@@ -808,7 +808,7 @@ static struct platform_driver dw8250_platform_driver = { .acpi_match_table = dw8250_acpi_match, }, .probe = dw8250_probe, - .remove_new = dw8250_remove, + .remove = dw8250_remove, };module_platform_driver (dw8250_platform_driver);
drivers/tty/serial/8250/8250_em.c +1 -1
@@ -219,7 +219,7 @@ static struct platform_driver serial8250_em_platform_driver = { .of_match_table = serial8250_em_dt_ids, }, .probe = serial8250_em_probe, - .remove_new = serial8250_em_remove, + .remove = serial8250_em_remove, };module_platform_driver (serial8250_em_platform_driver);
drivers/tty/serial/8250/8250_fsl.c +1 -1
@@ -179,7 +179,7 @@ static struct platform_driver fsl8250_platform_driver = { .acpi_match_table = ACPI_PTR(fsl_8250_acpi_id), }, .probe = fsl8250_acpi_probe, - .remove_new = fsl8250_acpi_remove, + .remove = fsl8250_acpi_remove, };module_platform_driver (fsl8250_platform_driver);
drivers/tty/serial/8250/8250_ingenic.c +1 -1
@@ -361,7 +361,7 @@ static struct platform_driver ingenic_uart_platform_driver = { .of_match_table = of_match, }, .probe = ingenic_uart_probe, - .remove_new = ingenic_uart_remove, + .remove = ingenic_uart_remove, };module_platform_driver (ingenic_uart_platform_driver);
drivers/tty/serial/8250/8250_ioc3.c +1 -1
@@ -84,7 +84,7 @@ static void serial8250_ioc3_remove(struct platform_device *pdev)static struct platform_driver serial8250_ioc3_driver = { .probe = serial8250_ioc3_probe, - .remove_new = serial8250_ioc3_remove, + .remove = serial8250_ioc3_remove, .driver = { .name ="ioc3-serial8250" , }
drivers/tty/serial/8250/8250_lpc18xx.c +1 -1
@@ -195,7 +195,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_serial_match);static struct platform_driver lpc18xx_serial_driver = { .probe = lpc18xx_serial_probe, - .remove_new = lpc18xx_serial_remove, + .remove = lpc18xx_serial_remove, .driver = { .name ="lpc18xx-uart" , .of_match_table = lpc18xx_serial_match,
drivers/tty/serial/8250/8250_mtk.c +1 -1
@@ -656,7 +656,7 @@ static struct platform_driver mtk8250_platform_driver = { .of_match_table = mtk8250_of_match, }, .probe = mtk8250_probe, - .remove_new = mtk8250_remove, + .remove = mtk8250_remove, };module_platform_driver (mtk8250_platform_driver);
drivers/tty/serial/8250/8250_of.c +1 -1
@@ -393,7 +393,7 @@ static struct platform_driver of_platform_serial_driver = { .pm = &of_serial_pm_ops, }, .probe = of_platform_serial_probe, - .remove_new = of_platform_serial_remove, + .remove = of_platform_serial_remove, };module_platform_driver (of_platform_serial_driver);
drivers/tty/serial/8250/8250_omap.c +1 -1
@@ -1883,7 +1883,7 @@ static struct platform_driver omap8250_platform_driver = { .of_match_table = omap8250_dt_ids, }, .probe = omap8250_probe, - .remove_new = omap8250_remove, + .remove = omap8250_remove, };module_platform_driver (omap8250_platform_driver);
drivers/tty/serial/8250/8250_platform.c +1 -1
@@ -285,7 +285,7 @@ MODULE_DEVICE_TABLE(acpi, acpi_platform_serial_table);static struct platform_driver serial8250_isa_driver = { .probe = serial8250_probe, - .remove_new = serial8250_remove, + .remove = serial8250_remove, .suspend = serial8250_suspend, .resume = serial8250_resume, .driver = {
drivers/tty/serial/8250/8250_pxa.c +1 -1
@@ -154,7 +154,7 @@ static void serial_pxa_remove(struct platform_device *pdev)static struct platform_driver serial_pxa_driver = { .probe = serial_pxa_probe, - .remove_new = serial_pxa_remove, + .remove = serial_pxa_remove, .driver = { .name ="pxa2xx-uart" ,
drivers/tty/serial/8250/8250_tegra.c +1 -1
@@ -182,7 +182,7 @@ static struct platform_driver tegra_uart_driver = { .acpi_match_table = ACPI_PTR(tegra_uart_acpi_match), }, .probe = tegra_uart_probe, - .remove_new = tegra_uart_remove, + .remove = tegra_uart_remove, };module_platform_driver (tegra_uart_driver);
drivers/tty/serial/8250/8250_uniphier.c +1 -1
@@ -282,7 +282,7 @@ MODULE_DEVICE_TABLE(of, uniphier_uart_match);static struct platform_driver uniphier_uart_platform_driver = { .probe = uniphier_uart_probe, - .remove_new = uniphier_uart_remove, + .remove = uniphier_uart_remove, .driver = { .name ="uniphier-uart" , .of_match_table = uniphier_uart_match,
drivers/tty/serial/altera_jtaguart.c +1 -1
@@ -454,7 +454,7 @@ MODULE_DEVICE_TABLE(of, altera_jtaguart_match);static struct platform_driver altera_jtaguart_platform_driver = { .probe = altera_jtaguart_probe, - .remove_new = altera_jtaguart_remove, + .remove = altera_jtaguart_remove, .driver = { .name =DRV_NAME , .of_match_table =of_match_ptr (altera_jtaguart_match),
drivers/tty/serial/altera_uart.c +1 -1
@@ -617,7 +617,7 @@ MODULE_DEVICE_TABLE(of, altera_uart_match);static struct platform_driver altera_uart_platform_driver = { .probe = altera_uart_probe, - .remove_new = altera_uart_remove, + .remove = altera_uart_remove, .driver = { .name =DRV_NAME , .of_match_table =of_match_ptr (altera_uart_match),
drivers/tty/serial/amba-pl011.c +1 -1
@@ -2967,7 +2967,7 @@ MODULE_DEVICE_TABLE(acpi, sbsa_uart_acpi_match);static struct platform_driver arm_sbsa_uart_platform_driver = { .probe = sbsa_uart_probe, - .remove_new = sbsa_uart_remove, + .remove = sbsa_uart_remove, .driver = { .name ="sbsa-uart" , .pm = &pl011_dev_pm_ops,
drivers/tty/serial/ar933x_uart.c +1 -1
@@ -832,7 +832,7 @@ MODULE_DEVICE_TABLE(of, ar933x_uart_of_ids);static struct platform_driver ar933x_uart_platform_driver = { .probe = ar933x_uart_probe, - .remove_new = ar933x_uart_remove, + .remove = ar933x_uart_remove, .driver = { .name =DRIVER_NAME , .of_match_table =of_match_ptr (ar933x_uart_of_ids),
drivers/tty/serial/atmel_serial.c +1 -1
@@ -3017,7 +3017,7 @@ static SIMPLE_DEV_PM_OPS(atmel_serial_pm_ops, atmel_serial_suspend,static struct platform_driver atmel_serial_driver = { .probe = atmel_serial_probe, - .remove_new = atmel_serial_remove, + .remove = atmel_serial_remove, .driver = { .name ="atmel_usart_serial" , .of_match_table =of_match_ptr (atmel_serial_dt_ids),
drivers/tty/serial/bcm63xx_uart.c +1 -1
@@ -884,7 +884,7 @@ MODULE_DEVICE_TABLE(of, bcm63xx_of_match);*/ static struct platform_driver bcm_uart_platform_driver = { .probe = bcm_uart_probe, - .remove_new = bcm_uart_remove, + .remove = bcm_uart_remove, .driver = { .name ="bcm63xx_uart" , .of_match_table = bcm63xx_of_match,
drivers/tty/serial/clps711x.c +1 -1
@@ -529,7 +529,7 @@ static struct platform_driver clps711x_uart_platform = { .of_match_table = of_match_ptr(clps711x_uart_dt_ids), }, .probe = uart_clps711x_probe, - .remove_new = uart_clps711x_remove, + .remove = uart_clps711x_remove, };static int __init uart_clps711x_init (void )
drivers/tty/serial/cpm_uart.c +1 -1
@@ -1573,7 +1573,7 @@ static struct platform_driver cpm_uart_driver = { .of_match_table = cpm_uart_match, }, .probe = cpm_uart_probe, - .remove_new = cpm_uart_remove, + .remove = cpm_uart_remove, };static int __init cpm_uart_init (void )
drivers/tty/serial/digicolor-usart.c +1 -1
@@ -522,7 +522,7 @@ static struct platform_driver digicolor_uart_platform = { .of_match_table = of_match_ptr(digicolor_uart_dt_ids), }, .probe = digicolor_uart_probe, - .remove_new = digicolor_uart_remove, + .remove = digicolor_uart_remove, };static int __init digicolor_uart_init (void )
drivers/tty/serial/esp32_acm.c +1 -1
@@ -423,7 +423,7 @@ static void esp32s3_acm_remove(struct platform_device *pdev)static struct platform_driver esp32s3_acm_driver = { .probe = esp32s3_acm_probe, - .remove_new = esp32s3_acm_remove, + .remove = esp32s3_acm_remove, .driver = { .name =DRIVER_NAME , .of_match_table = esp32s3_acm_dt_ids,
drivers/tty/serial/esp32_uart.c +1 -1
@@ -743,7 +743,7 @@ static void esp32_uart_remove(struct platform_device *pdev)static struct platform_driver esp32_uart_driver = { .probe = esp32_uart_probe, - .remove_new = esp32_uart_remove, + .remove = esp32_uart_remove, .driver = { .name =DRIVER_NAME , .of_match_table = esp32_uart_dt_ids,
drivers/tty/serial/fsl_linflexuart.c +1 -1
@@ -882,7 +882,7 @@ static SIMPLE_DEV_PM_OPS(linflex_pm_ops, linflex_suspend, linflex_resume);static struct platform_driver linflex_driver = { .probe = linflex_probe, - .remove_new = linflex_remove, + .remove = linflex_remove, .driver = { .name =DRIVER_NAME , .of_match_table = linflex_dt_ids,
drivers/tty/serial/fsl_lpuart.c +1 -1
@@ -3224,7 +3224,7 @@ static const struct dev_pm_ops lpuart_pm_ops = {static struct platform_driver lpuart_driver = { .probe = lpuart_probe, - .remove_new = lpuart_remove, + .remove = lpuart_remove, .driver = { .name ="fsl-lpuart" , .of_match_table = lpuart_dt_ids,
drivers/tty/serial/imx.c +1 -1
@@ -2738,7 +2738,7 @@ static const struct dev_pm_ops imx_uart_pm_ops = {static struct platform_driver imx_uart_platform_driver = { .probe = imx_uart_probe, - .remove_new = imx_uart_remove, + .remove = imx_uart_remove, .driver = { .name ="imx-uart" ,
drivers/tty/serial/lantiq.c +1 -1
@@ -915,7 +915,7 @@ MODULE_DEVICE_TABLE(of, ltq_asc_match);static struct platform_driver lqasc_driver = { .probe = lqasc_probe, - .remove_new = lqasc_remove, + .remove = lqasc_remove, .driver = { .name =DRVNAME , .of_match_table = ltq_asc_match,
drivers/tty/serial/liteuart.c +1 -1
@@ -353,7 +353,7 @@ MODULE_DEVICE_TABLE(of, liteuart_of_match);static struct platform_driver liteuart_platform_driver = { .probe = liteuart_probe, - .remove_new = liteuart_remove, + .remove = liteuart_remove, .driver = { .name =KBUILD_MODNAME , .of_match_table = liteuart_of_match,
drivers/tty/serial/lpc32xx_hs.c +1 -1
@@ -695,7 +695,7 @@ MODULE_DEVICE_TABLE(of, serial_hs_lpc32xx_dt_ids);static struct platform_driver serial_hs_lpc32xx_driver = { .probe = serial_hs_lpc32xx_probe, - .remove_new = serial_hs_lpc32xx_remove, + .remove = serial_hs_lpc32xx_remove, .suspend = serial_hs_lpc32xx_suspend, .resume = serial_hs_lpc32xx_resume, .driver = {
drivers/tty/serial/ma35d1_serial.c +1 -1
@@ -806,7 +806,7 @@ static int ma35d1serial_resume(struct platform_device *dev)static struct platform_driver ma35d1serial_driver = { .probe = ma35d1serial_probe, - .remove_new = ma35d1serial_remove, + .remove = ma35d1serial_remove, .suspend = ma35d1serial_suspend, .resume = ma35d1serial_resume, .driver = {
drivers/tty/serial/mcf.c +1 -1
@@ -616,7 +616,7 @@ static void mcf_remove(struct platform_device *pdev)static struct platform_driver mcf_platform_driver = { .probe = mcf_probe, - .remove_new = mcf_remove, + .remove = mcf_remove, .driver = { .name ="mcfuart" , },
drivers/tty/serial/meson_uart.c +1 -1
@@ -842,7 +842,7 @@ MODULE_DEVICE_TABLE(of, meson_uart_dt_match);static struct platform_driver meson_uart_platform_driver = { .probe = meson_uart_probe, - .remove_new = meson_uart_remove, + .remove = meson_uart_remove, .driver = { .name ="meson_uart" , .of_match_table = meson_uart_dt_match,
drivers/tty/serial/milbeaut_usio.c +1 -1
@@ -573,7 +573,7 @@ MODULE_DEVICE_TABLE(of, mlb_usio_dt_ids);static struct platform_driver mlb_usio_driver = { .probe = mlb_usio_probe, - .remove_new = mlb_usio_remove, + .remove = mlb_usio_remove, .driver = { .name =USIO_NAME , .of_match_table = mlb_usio_dt_ids,
drivers/tty/serial/mpc52xx_uart.c +1 -1
@@ -1843,7 +1843,7 @@ MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match);static struct platform_driver mpc52xx_uart_of_driver = { .probe = mpc52xx_uart_of_probe, - .remove_new = mpc52xx_uart_of_remove, + .remove = mpc52xx_uart_of_remove, #ifdef CONFIG_PM .suspend = mpc52xx_uart_of_suspend, .resume = mpc52xx_uart_of_resume,
drivers/tty/serial/msm_serial.c +1 -1
@@ -1901,7 +1901,7 @@ static const struct dev_pm_ops msm_serial_dev_pm_ops = { };static struct platform_driver msm_platform_driver = { - .remove_new = msm_serial_remove, + .remove = msm_serial_remove, .probe = msm_serial_probe, .driver = { .name ="msm_serial" ,
drivers/tty/serial/mxs-auart.c +1 -1
@@ -1704,7 +1704,7 @@ static void mxs_auart_remove(struct platform_device *pdev)static struct platform_driver mxs_auart_driver = { .probe = mxs_auart_probe, - .remove_new = mxs_auart_remove, + .remove = mxs_auart_remove, .driver = { .name ="mxs-auart" , .of_match_table = mxs_auart_dt_ids,
drivers/tty/serial/omap-serial.c +1 -1
@@ -1802,7 +1802,7 @@ MODULE_DEVICE_TABLE(of, omap_serial_of_match);static struct platform_driver serial_omap_driver = { .probe = serial_omap_probe, - .remove_new = serial_omap_remove, + .remove = serial_omap_remove, .driver = { .name =OMAP_SERIAL_DRIVER_NAME , .pm = &serial_omap_dev_pm_ops,
drivers/tty/serial/owl-uart.c +1 -1
@@ -730,7 +730,7 @@ static void owl_uart_remove(struct platform_device *pdev)static struct platform_driver owl_uart_platform_driver = { .probe = owl_uart_probe, - .remove_new = owl_uart_remove, + .remove = owl_uart_remove, .driver = { .name ="owl-uart" , .of_match_table = owl_uart_dt_matches,
drivers/tty/serial/pic32_uart.c +1 -1
@@ -956,7 +956,7 @@ MODULE_DEVICE_TABLE(of, pic32_serial_dt_ids);static struct platform_driver pic32_uart_platform_driver = { .probe = pic32_uart_probe, - .remove_new = pic32_uart_remove, + .remove = pic32_uart_remove, .driver = { .name =PIC32_DEV_NAME , .of_match_table =of_match_ptr (pic32_serial_dt_ids),
drivers/tty/serial/pmac_zilog.c +1 -1
@@ -1776,7 +1776,7 @@ static struct macio_driver pmz_driver = {static struct platform_driver pmz_driver = { .probe = pmz_attach, - .remove_new = pmz_detach, + .remove = pmz_detach, .driver = { .name ="scc" , },
drivers/tty/serial/qcom_geni_serial.c +1 -1
@@ -1864,7 +1864,7 @@ static const struct of_device_id qcom_geni_serial_match_table[] = {MODULE_DEVICE_TABLE (of, qcom_geni_serial_match_table);static struct platform_driver qcom_geni_serial_platform_driver = { - .remove_new = qcom_geni_serial_remove, + .remove = qcom_geni_serial_remove, .probe = qcom_geni_serial_probe, .driver = { .name ="qcom_geni_serial" ,
drivers/tty/serial/rda-uart.c +1 -1
@@ -777,7 +777,7 @@ static void rda_uart_remove(struct platform_device *pdev)static struct platform_driver rda_uart_platform_driver = { .probe = rda_uart_probe, - .remove_new = rda_uart_remove, + .remove = rda_uart_remove, .driver = { .name ="rda-uart" , .of_match_table = rda_uart_dt_matches,
drivers/tty/serial/sa1100.c +1 -1
@@ -880,7 +880,7 @@ static void sa1100_serial_remove(struct platform_device *pdev)static struct platform_driver sa11x0_serial_driver = { .probe = sa1100_serial_probe, - .remove_new = sa1100_serial_remove, + .remove = sa1100_serial_remove, .suspend = sa1100_serial_suspend, .resume = sa1100_serial_resume, .driver = {
drivers/tty/serial/samsung_tty.c +1 -1
@@ -2645,7 +2645,7 @@ MODULE_DEVICE_TABLE(of, s3c24xx_uart_dt_match);static struct platform_driver samsung_serial_driver = { .probe = s3c24xx_serial_probe, - .remove_new = s3c24xx_serial_remove, + .remove = s3c24xx_serial_remove, .id_table = s3c24xx_serial_driver_ids, .driver = { .name ="samsung-uart" ,
drivers/tty/serial/sccnxp.c +1 -1
@@ -1052,7 +1052,7 @@ static struct platform_driver sccnxp_uart_driver = { .name = SCCNXP_NAME, }, .probe = sccnxp_probe, - .remove_new = sccnxp_remove, + .remove = sccnxp_remove, .id_table = sccnxp_id_table, };module_platform_driver (sccnxp_uart_driver);
drivers/tty/serial/serial-tegra.c +1 -1
@@ -1662,7 +1662,7 @@ static const struct dev_pm_ops tegra_uart_pm_ops = {static struct platform_driver tegra_uart_platform_driver = { .probe = tegra_uart_probe, - .remove_new = tegra_uart_remove, + .remove = tegra_uart_remove, .driver = { .name ="serial-tegra" , .of_match_table = tegra_uart_of_match,
drivers/tty/serial/serial_txx9.c +1 -1
@@ -1097,7 +1097,7 @@ static int serial_txx9_resume(struct platform_device *dev)static struct platform_driver serial_txx9_plat_driver = { .probe = serial_txx9_probe, - .remove_new = serial_txx9_remove, + .remove = serial_txx9_remove, #ifdef CONFIG_PM .suspend = serial_txx9_suspend, .resume = serial_txx9_resume,
drivers/tty/serial/sh-sci.c +1 -1
@@ -3662,7 +3662,7 @@ static SIMPLE_DEV_PM_OPS(sci_dev_pm_ops, sci_suspend, sci_resume);static struct platform_driver sci_driver = { .probe = sci_probe, - .remove_new = sci_remove, + .remove = sci_remove, .driver = { .name ="sh-sci" , .pm = &sci_dev_pm_ops,
drivers/tty/serial/sifive.c +1 -1
@@ -1046,7 +1046,7 @@ MODULE_DEVICE_TABLE(of, sifive_serial_of_match);static struct platform_driver sifive_serial_platform_driver = { .probe = sifive_serial_probe, - .remove_new = sifive_serial_remove, + .remove = sifive_serial_remove, .driver = { .name =SIFIVE_SERIAL_NAME , .pm =pm_sleep_ptr (&sifive_uart_pm_ops),
drivers/tty/serial/sprd_serial.c +1 -1
@@ -1261,7 +1261,7 @@ MODULE_DEVICE_TABLE(of, serial_ids);static struct platform_driver sprd_platform_driver = { .probe = sprd_probe, - .remove_new = sprd_remove, + .remove = sprd_remove, .driver = { .name ="sprd_serial" , .of_match_table = serial_ids,
drivers/tty/serial/st-asc.c +1 -1
@@ -934,7 +934,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(asc_serial_pm_ops, asc_serial_suspend,static struct platform_driver asc_serial_driver = { .probe = asc_serial_probe, - .remove_new = asc_serial_remove, + .remove = asc_serial_remove, .driver = { .name =DRIVER_NAME , .pm =pm_sleep_ptr (&asc_serial_pm_ops),
drivers/tty/serial/stm32-usart.c +1 -1
@@ -2186,7 +2186,7 @@ static const struct dev_pm_ops stm32_serial_pm_ops = {static struct platform_driver stm32_serial_driver = { .probe = stm32_usart_serial_probe, - .remove_new = stm32_usart_serial_remove, + .remove = stm32_usart_serial_remove, .driver = { .name =DRIVER_NAME , .pm = &stm32_serial_pm_ops,
drivers/tty/serial/sunhv.c +1 -1
@@ -633,7 +633,7 @@ static struct platform_driver hv_driver = { .of_match_table = hv_match, }, .probe = hv_probe, - .remove_new = hv_remove, + .remove = hv_remove, };static int __init sunhv_init (void )
drivers/tty/serial/sunplus-uart.c +1 -1
@@ -697,7 +697,7 @@ MODULE_DEVICE_TABLE(of, sp_uart_of_match);static struct platform_driver sunplus_uart_platform_driver = { .probe = sunplus_uart_probe, - .remove_new = sunplus_uart_remove, + .remove = sunplus_uart_remove, .driver = { .name ="sunplus_uart" , .of_match_table = sp_uart_of_match,
drivers/tty/serial/sunsab.c +1 -1
@@ -1100,7 +1100,7 @@ static struct platform_driver sab_driver = { .of_match_table = sab_match, }, .probe = sab_probe, - .remove_new = sab_remove, + .remove = sab_remove, };static int __init sunsab_init (void )
drivers/tty/serial/sunsu.c +1 -1
@@ -1549,7 +1549,7 @@ static struct platform_driver su_driver = { .of_match_table = su_match, }, .probe = su_probe, - .remove_new = su_remove, + .remove = su_remove, };static int __init sunsu_init (void )
drivers/tty/serial/sunzilog.c +1 -1
@@ -1538,7 +1538,7 @@ static struct platform_driver zs_driver = { .of_match_table = zs_match, }, .probe = zs_probe, - .remove_new = zs_remove, + .remove = zs_remove, };static int __init sunzilog_init (void )
drivers/tty/serial/tegra-tcu.c +1 -1
@@ -293,7 +293,7 @@ static struct platform_driver tegra_tcu_driver = { .of_match_table = tegra_tcu_match, }, .probe = tegra_tcu_probe, - .remove_new = tegra_tcu_remove, + .remove = tegra_tcu_remove, };module_platform_driver (tegra_tcu_driver);
drivers/tty/serial/timbuart.c +1 -1
@@ -485,7 +485,7 @@ static struct platform_driver timbuart_platform_driver = { .name = "timb-uart", }, .probe = timbuart_probe, - .remove_new = timbuart_remove, + .remove = timbuart_remove, };module_platform_driver (timbuart_platform_driver);
drivers/tty/serial/uartlite.c +1 -1
@@ -906,7 +906,7 @@ MODULE_ALIAS("platform:uartlite");static struct platform_driver ulite_platform_driver = { .probe = ulite_probe, - .remove_new = ulite_remove, + .remove = ulite_remove, .driver = { .name ="uartlite" , .of_match_table =of_match_ptr (ulite_of_match),
drivers/tty/serial/ucc_uart.c +1 -1
@@ -1484,7 +1484,7 @@ static struct platform_driver ucc_uart_of_driver = { .of_match_table = ucc_uart_match, }, .probe = ucc_uart_probe, - .remove_new = ucc_uart_remove, + .remove = ucc_uart_remove, };static int __init ucc_uart_init (void )
drivers/tty/serial/xilinx_uartps.c +1 -1
@@ -1901,7 +1901,7 @@ static void cdns_uart_remove(struct platform_device *pdev)static struct platform_driver cdns_uart_platform_driver = { .probe = cdns_uart_probe, - .remove_new = cdns_uart_remove, + .remove = cdns_uart_remove, .driver = { .name =CDNS_UART_NAME , .of_match_table = cdns_uart_of_match,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 544/1756 serial: txx9: Drop noop probe function and dangerous remove callback
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König (The Capable Hub) <[email protected]>
[ Upstream commit 22c6a6ac74c2434735638e7ef1101597ae263aec ]
The only platform device that can be bound to the driver is allocated by the driver itself. That device doesn't have platdata, so the probe function only consists of a loop that is never run and thus can be dropped without loss of functionality.
The remove function then should better not undo things that were not done in the first place. That happens because serial_txx9_init() calls serial_txx9_register_ports() with the created platform device and so up->dev == &dev->dev evaluates to true and uart_remove_one_port() is called twice for each port.
So let serial_txx9_exit() undo exactly what serial_txx9_init() does and remove the useless respectively wrong functions.
--- drivers/tty/serial/serial_txx9.c | 55 ++------------------------------ 1 file changed, 3 insertions(+), 52 deletions(-)
drivers/tty/serial/serial_txx9.c +3 -52
@@ -1009,7 +1009,8 @@ static void serial_txx9_unregister_port(int line)struct uart_port *uart = &serial_txx9_ports[line];mutex_lock (&serial_txx9_mutex); -uart_remove_one_port (&serial_txx9_reg, uart); +if (uart->iobase || uart->mapbase) +uart_remove_one_port (&serial_txx9_reg, uart); uart->flags =0 ; uart->type =PORT_UNKNOWN ; uart->iobase =0 ;
@@ -1019,52 +1020,6 @@ static void serial_txx9_unregister_port(int line)mutex_unlock (&serial_txx9_mutex); } -/* -* Register a set of serial devices attached to a platform device. -*/ -static int serial_txx9_probe (struct platform_device *dev) -{ -struct uart_port *p =dev_get_platdata (&dev->dev); -struct uart_port port; -int ret, i; - -memset (&port,0 ,sizeof (struct uart_port )); -for (i =0 ; p && p->uartclk !=0 ; p++, i++) { - port.iobase = p->iobase; - port.membase = p->membase; - port.irq = p->irq; - port.uartclk = p->uartclk; - port.iotype = p->iotype; - port.flags = p->flags; - port.mapbase = p->mapbase; - port.dev = &dev->dev; - port.has_sysrq =IS_ENABLED (CONFIG_SERIAL_TXX9_CONSOLE ); - ret =serial_txx9_register_port (&port); -if (ret <0 ) { -dev_err (&dev->dev,"unable to register port at index %d " -"(IO%lx MEM%llx IRQ%d): %d\n" , i, - p->iobase, (unsigned long long )p->mapbase, - p->irq, ret); - } - } -return 0 ; -} - -/* -* Remove serial ports registered against a platform device. -*/ -static void serial_txx9_remove (struct platform_device *dev) -{ -int i; - -for (i =0 ; i <UART_NR ; i++) { -struct uart_port *up = &serial_txx9_ports[i]; - -if (up->dev == &dev->dev) -serial_txx9_unregister_port (i); - } -} -#ifdef CONFIG_PM static int serial_txx9_suspend (struct platform_device *dev,pm_message_t state) {
@@ -1096,8 +1051,6 @@ static int serial_txx9_resume(struct platform_device *dev)#endif static struct platform_driver serial_txx9_plat_driver = { - .probe = serial_txx9_probe, - .remove = serial_txx9_remove, #ifdef CONFIG_PM .suspend = serial_txx9_suspend, .resume = serial_txx9_resume,
@@ -1251,9 +1204,7 @@ static void __exit serial_txx9_exit(void)platform_driver_unregister (&serial_txx9_plat_driver);platform_device_unregister (serial_txx9_plat_devs);for (i =0 ; i <UART_NR ; i++) { -struct uart_port *up = &serial_txx9_ports[i]; -if (up->iobase || up->mapbase) -uart_remove_one_port (&serial_txx9_reg, up); +serial_txx9_unregister_port (i); }uart_unregister_driver (&serial_txx9_reg);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 545/1756 serial: 8250_uniphier: Use devm_clk_get_enabled()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malathi A <[email protected]>
[ Upstream commit 790aacba3fdfd3a227cdd5e4952c596ed66a0ed8 ]
uniphier_uart_probe() enables priv->clk by hand and is then responsible for disabling it again on every error path. It misses one: when uart_read_port_properties() fails the function returns directly, leaving the clock prepared and enabled. The neighbouring path, taken when serial8250_register_8250_port() fails, does call clk_disable_unprepare(), which shows the leak is an oversight rather than intent.
Rather than adding another manual unwind, switch to devm_clk_get_enabled() so the clock is released by devres. That removes the error path entirely, along with the explicit disables in the register failure path and in uniphier_uart_remove().
The clock is still disabled and re-enabled by hand across system sleep, which stays balanced: only SET_SYSTEM_SLEEP_PM_OPS is used, so the device cannot be unbound while suspended and devres always sees an enabled clock at detach.
Found by smatch:
drivers/tty/serial/8250/8250_uniphier.c:232 uniphier_uart_probe() warn: 'priv->clk' from clk_prepare_enable() not released on lines: 205.
--- drivers/tty/serial/8250/8250_uniphier.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/tty/serial/8250/8250_uniphier.c +2 -8
@@ -180,16 +180,12 @@ static int uniphier_uart_probe(struct platform_device *pdev)memset (&up,0 ,sizeof (up)); - priv->clk =devm_clk_get (dev,NULL ); + priv->clk =devm_clk_get_enabled (dev,NULL );if (IS_ERR (priv->clk)) { -dev_err (dev,"failed to get clock\n" ); +dev_err (dev,"failed to get and enable clock\n" );return PTR_ERR (priv->clk); } - ret =clk_prepare_enable (priv->clk); -if (ret) -return ret; - up.port.uartclk =clk_get_rate (priv->clk);spin_lock_init (&priv->atomic_write_lock);
@@ -222,7 +218,6 @@ static int uniphier_uart_probe(struct platform_device *pdev) ret =serial8250_register_8250_port (&up);if (ret <0 ) {dev_err (dev,"failed to register 8250 port\n" ); -clk_disable_unprepare (priv->clk);return ret; } priv->line = ret;
@@ -237,7 +232,6 @@ static void uniphier_uart_remove(struct platform_device *pdev)struct uniphier8250_priv *priv =platform_get_drvdata (pdev);serial8250_unregister_port (priv->line); -clk_disable_unprepare (priv->clk); }static int __maybe_unused uniphier_uart_suspend (struct device *dev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 546/1756 serial: sifive: fix off-by-one in console port bounds check
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zongmin Zhou <[email protected]>
[ Upstream commit bf961847813d9edcb5a9c089714069428d141fa9 ]
sifive_serial_console_ports[] is sized SIFIVE_SERIAL_MAX_PORTS (8), so valid indices are 0..7. The bounds check in sifive_serial_probe() uses "id > SIFIVE_SERIAL_MAX_PORTS", which lets id == 8 pass and causes an out-of-bounds write in __ssp_add_console_port() through sifive_serial_console_ports[ssp->port.line].
Fix the check to use >= instead, matching the check already used in sifive_serial_console_setup().
--- drivers/tty/serial/sifive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sifive.c +1 -1
@@ -937,7 +937,7 @@ static int sifive_serial_probe(struct platform_device *pdev) }#ifdef CONFIG_SERIAL_SIFIVE_CONSOLE -if (id >SIFIVE_SERIAL_MAX_PORTS ) { +if (id >=SIFIVE_SERIAL_MAX_PORTS ) {dev_err (&pdev->dev,"too many UARTs (%d)\n" , id);return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 547/1756 ARM: dts: ux500: Convert HREF audio to audio-graph-card2
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit f9b2262d1edba1b6c0abc12118105f8fa200980a ]
Describe the HREF500 and HREF520 sound hardware with two-link audio graph cards in their PMIC-specific HREF DTSIs, and name the card HREF-500. Connect MSP1 to codec DAI 0 for playback and MSP3 to codec DAI 1 for capture.
Describe the DSP_A format, codec-provided bit and frame clocks, 16-by-16-bit TDM frame and active slots on the graph endpoints. Keep the clocks running continuously, matching the legacy machine driver's normal one- and two-channel mode.
Keep each complete card, including its endpoint graph, connector widgets and routes, in the existing PMIC-specific HREF DTSI. The AB8500 variant exposes six digital microphone endpoints. AB8505 has neither the digital microphone interface nor its VDMIC regulator, so leave these endpoints out of HREF520 and remove its stale regulator and pin configuration nodes.
Select ULPCLK as the fixed parent of the codec audio clock in the HREF-specific codec DTSIs. This replaces the machine driver clock control with declarative board policy.
--- arch/arm/boot/dts/st/ste-ab8500.dtsi | 6 -- arch/arm/boot/dts/st/ste-ab8505.dtsi | 6 -- arch/arm/boot/dts/st/ste-dbx5x0.dtsi | 5 - arch/arm/boot/dts/st/ste-href-ab8500.dtsi | 104 +++++++++++++++++++ arch/arm/boot/dts/st/ste-href-ab8505.dtsi | 118 +++++++++++++++++----- 5 files changed, 196 insertions(+), 43 deletions(-)
arch/arm/boot/dts/st/ste-ab8500.dtsi +0 -6
@@ -364,12 +364,6 @@ ab8500_ldo_ana_reg: ab8500_ldo_ana { }; }; - sound { - stericsson,audio-codec = <&codec>; - clocks = <&prcmu_clk PRCMU_SYSCLK>, <&ab8500_clock AB8500_SYSCLK_ULP>, <&ab8500_clock AB8500_SYSCLK_INT>; - clock-names = "sysclk", "ulpclk", "intclk"; - }; - mcde@a0350000 { vana-supply = <&ab8500_ldo_ana_reg>;
arch/arm/boot/dts/st/ste-ab8505.dtsi +0 -6
@@ -301,12 +301,6 @@ ab8500_ldo_ana_reg: ab8500_ldo_ana { }; }; - sound { - stericsson,audio-codec = <&codec>; - clocks = <&prcmu_clk PRCMU_SYSCLK>, <&ab8500_clock AB8500_SYSCLK_ULP>, <&ab8500_clock AB8500_SYSCLK_INT>; - clock-names = "sysclk", "ulpclk", "intclk"; - }; - mcde@a0350000 { vana-supply = <&ab8500_ldo_ana_reg>;
arch/arm/boot/dts/st/ste-dbx5x0.dtsi +0 -5
@@ -1071,11 +1071,6 @@ mmc@80008000 { status = "disabled"; }; - sound { - compatible = "stericsson,snd-soc-mop500"; - stericsson,cpu-dai = <&msp1 &msp3>; - }; - msp0: msp@80123000 { compatible = "stericsson,ux500-msp-i2s"; reg = <0x80123000 0x1000>;
arch/arm/boot/dts/st/ste-href-ab8500.dtsi +104 -0
113 lines not on this page · raw message
arch/arm/boot/dts/st/ste-href-ab8505.dtsi +92 -26
145 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 548/1756 dt-bindings: vendor-prefixes: add Free Mobile
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Jardin <[email protected]>
[ Upstream commit aa906abf611c7f37c0fe9171c1d33c40270aa5fe ]
Free Mobile is a French mobile network operator. Add its vendor prefix, used by the Nodebox v3 CPU Module (freemobile,nbxv3).
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -533,6 +533,8 @@ patternProperties: description: Freebox SAS "^freecom,.*": description: Freecom Gmbh + "^freemobile,.*": + description: Free Mobile "^frida,.*": description: Shenzhen Frida LCD Co., Ltd. "^friendlyarm,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 549/1756 clk: qcom: dispcc-sm8450: Fix disp_cc_mdss_mdp_clk_src ops
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esteban Urrutia <[email protected]>
[ Upstream commit 8464e2284fec42d9fd05f3109d8b209d65864ece ]
If the clock frequency is changed at registration time, a flicker will be visible at boot.
Switching to clk_rcg2_shared_no_init_park_ops fixes this.
--- drivers/clk/qcom/dispcc-sm8450.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/dispcc-sm8450.c +1 -1
@@ -569,7 +569,7 @@ static struct clk_rcg2 disp_cc_mdss_mdp_clk_src = { .parent_data = disp_cc_parent_data_5, .num_parents = ARRAY_SIZE(disp_cc_parent_data_5), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_shared_no_init_park_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 550/1756 clk: qcom: alpha-pll: Check Lucid Ole PLL status before configuring
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esteban Urrutia <[email protected]>
[ Upstream commit eb34e2804ce4ea56efb741e23d598469274a2f94 ]
On some platforms such as SM8475, not doing this may result in graphical glitches when the mdss driver takes over.
This fixes the aforementioned issue.
--- drivers/clk/qcom/clk-alpha-pll.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/clk/qcom/clk-alpha-pll.c +9 -0
@@ -2304,6 +2304,15 @@ void clk_lucid_ole_pll_configure(struct clk_alpha_pll *pll, struct regmap *regma {u32 lval = config->l; +/* +* If the bootloader left the PLL enabled it's likely that there are +* RCGs that will lock up if we disable the PLL below. +*/ +if (trion_pll_is_enabled (pll, regmap)) { +pr_debug ("Lucid Ole PLL is already enabled, skipping configuration\n" ); +return ; + } + lval |=TRION_PLL_CAL_VAL <<LUCID_EVO_PLL_CAL_L_VAL_SHIFT ; lval |=TRION_PLL_CAL_VAL <<LUCID_OLE_PLL_RINGOSC_CAL_L_VAL_SHIFT ;clk_alpha_pll_write_config (regmap,PLL_L_VAL (pll), lval);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 551/1756 tools/nolibc: fix WIFSIGNALED() for status 0
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danish Khateeb <[email protected]>
[ Upstream commit 368fae47c6cae28a312c5dc86e5bdb8f9369fd26 ]
WIFSIGNALED() needs the subtraction to wrap around for status 0, so that only 1 to 0xff, a terminating signal with or without the core dump flag, pass the check. But status is an int, and 0 - 1 is -1, which is less than 0xff. A child that exits with 0 is therefore reported as both exited and killed, and a caller that tests WIFSIGNALED() first sees "killed by signal 0".
Make the subtraction unsigned, as musl does in the same macro.
--- tools/include/nolibc/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/include/nolibc/types.h +1 -1
@@ -108,7 +108,7 @@#define WEXITSTATUS (status) (((status) & 0xff00) >> 8)#define WIFEXITED (status) (((status) & 0x7f) == 0)#define WTERMSIG (status) ((status) & 0x7f) -#define WIFSIGNALED (status) ((status) - 1 < 0xff) +#define WIFSIGNALED (status) ((status) - 1U < 0xff)/* standard exit() codes */ #define EXIT_SUCCESS 0
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 552/1756 bpftool: Fix CPU IDs in per-CPU map output
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Su <[email protected]>
[ Upstream commit dbf8cef936c7783ca909c38097a69f73173a19a7 ]
bpftool uses dense per-CPU value-buffer slots when printing per-CPU map values. It also uses the slot index as the CPU ID, which produces incorrect labels when the possible CPU mask is sparse, such as 0,2-3.
Parse the possible CPU mask and use the corresponding logical CPU ID in plain, JSON, and BTF-formatted output. Keep the dense slot index for accessing the per-CPU value buffer.
Pass the parsed CPU count together with the CPU ID array so that the printed CPU IDs and loop bounds come from the same possible-CPU mask. Propagate CPU-ID lookup and map output errors through the shared output path to its callers.
--- tools/bpf/bpftool/common.c | 40 ++++++++++++++++ tools/bpf/bpftool/main.h | 1 + tools/bpf/bpftool/map.c | 95 +++++++++++++++++++++++++------------- 3 files changed, 103 insertions(+), 33 deletions(-)
tools/bpf/bpftool/common.c +40 -0
@@ -29,6 +29,7 @@#include <bpf/bpf.h> #include <bpf/hashmap.h> #include <bpf/libbpf.h> /* libbpf_num_possible_cpus */ +#include <bpf/libbpf_internal.h> #include <bpf/btf.h> #include "main.h"
@@ -650,6 +651,45 @@ unsigned int get_possible_cpus(void)return cpus; } +int get_possible_cpu_ids (int **cpu_ids) +{ +const char *possible_cpus_file ="/sys/devices/system/cpu/possible" ; +bool *mask =NULL ; +int mask_sz, nr_cpus =0 ; +int *ids =NULL ; +int i, res; + + *cpu_ids =NULL ; + + res =parse_cpu_mask_file (possible_cpus_file, &mask, &mask_sz); +if (res) { +p_err ("failed to parse possible CPU mask: %s" ,strerror (-res)); +return res; + } + +for (i =0 ; i < mask_sz; i++) + nr_cpus += mask[i]; + + ids =calloc (nr_cpus,sizeof (*ids)); +if (!ids) { +p_err ("mem alloc failed" ); + res = -ENOMEM ; + goto out; + } + +for (i =0 , nr_cpus =0 ; i < mask_sz; i++) { +if (mask[i]) + ids[nr_cpus++] = i; + } + *cpu_ids = ids; + ids =NULL ; + res = nr_cpus; +out: +free (ids); +free (mask); +return res; +} +static char *ifindex_to_name_ns (__u32 ifindex,__u32 ns_dev,__u32 ns_ino,char *buf) {
tools/bpf/bpftool/main.h +1 -0
@@ -203,6 +203,7 @@ void print_hex_data_json(uint8_t *data, size_t len);unsigned int get_page_size (void );unsigned int get_possible_cpus (void ); +int get_possible_cpu_ids (int **cpu_ids);const char *ifindex_to_arch (__u32 ifindex,__u64 ns_dev,__u64 ns_ino,const char **opt);
tools/bpf/bpftool/map.c +62 -33
244 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 553/1756 iommufd: Fix iommufd_hw_capabilities reference in kernel-doc
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 54dadb030c7e2350957855d3995de05ae02c2e66 ]
The kernel-doc comment of struct iommu_hw_info refers to iommu_hw_capabilities, which does not exist. The name is iommufd_hw_capabilities. Say iommufd_hw_capabilities.
--- include/uapi/linux/iommufd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/iommufd.h +1 -1
@@ -529,7 +529,7 @@ enum iommufd_hw_capabilities {* @out_data_type: Output the iommu hardware info type as defined in the enum * iommu_hw_info_type. * @out_capabilities: Output the generic iommu capability info type as defined -* in the enum iommu_hw_capabilities. +* in the enum iommufd_hw_capabilities. * @out_max_pasid_log2: Output the width of PASIDs. 0 means no PASID support. * PCI devices turn to out_capabilities to check if the * specific capabilities is supported or not.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 554/1756 ext2: drain in-flight DIO before buffered write fallback
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 1e2ef9f221e142ed19d874a71b2cae7fabbaf138 ]
An asynchronous direct write can remain in flight after the inode lock is released. If another direct write falls back to buffered I/O while the first write is still pending, generic_perform_write() can dirty pages before the first write completes its post-I/O page cache invalidation. The invalidation then finds dirty pages, reports a page cache invalidation failure, and records -EIO in the mapping error sequence. A later fsync() therefore returns -EIO.
Commit 15cdefd0c0522f9d5e12d947fa04f4c11649b699 ("ext4: drain in-flight DIO before buffered write fallback") fixed the same race in ext4. Ext2 has an equivalent fallback after iomap_dio_rw() returns -ENOTBLK or a short write, but does not drain other in-flight DIO before dirtying the page cache.
Wait for in-flight DIO before calling generic_perform_write() in the fallback path.
A reproducer using concurrent AIO direct writes and buffered fallback triggered the following warning and made a subsequent fsync() return -EIO:
Page cache invalidation failure on direct I/O. Possible data corruption due to collision with buffered I/O!
--- fs/ext2/file.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/ext2/file.c +7 -0
@@ -251,6 +251,13 @@ static ssize_t ext2_dio_write_iter(struct kiocb *iocb, struct iov_iter *from)int ret2; iocb->ki_flags &= ~IOCB_DIRECT ; + +/* +* Prevent concurrent direct I/O and buffered I/O to the same file +* range. Wait for in-flight DIO to finish before dirtying pages. +*/ +inode_dio_wait (inode); + pos = iocb->ki_pos; status =generic_perform_write (iocb, from);if (unlikely (status <0 )) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 555/1756 mfd: rk8xx: Register poweroff handler in atomic phase
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Anderson <[email protected]>
[ Upstream commit 128115b520c6b61afbffd01809cfc3e8cbb78516 ]
This fixes a regression from v6.1 to v6.6 where Google Veyron devices (rk3288) would not power off after being shut down.
Prior to commit 4fec8a5a85c4 ("mfd: rk808: Convert to device managed resources"), pm_power_off was called by legacy_pm_power_off() which itself was registered using SYS_OFF_MODE_POWER_OFF. But in that commit the registration of rk808_power_off() moved to SYS_OFF_MODE_POWER_OFF_PREPARE. At the very least, the code should be consistent between SYS_OFF_MODE_POWER_OFF and SYS_OFF_MODE_RESTART; both should be *_PREPARE or both not.
It appears interrupt delivery is already shut down (but not disabled) when SYS_OFF_MODE_POWER_OFF_PREPARE is triggered, so regmap_update_bits() in rk808_power_off() does not complete successfully. Registering rk808_power_off() as SYS_OFF_MODE_POWER_OFF runs with interrupts disabled which causes polling I/O to be used instead, and the device to power down.
--- drivers/mfd/rk8xx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/rk8xx-core.c +1 -1
@@ -788,7 +788,7 @@ int rk8xx_probe(struct device *dev, int variant, unsigned int irq, struct regmapif (device_property_read_bool (dev,"rockchip,system-power-controller" ) ||device_property_read_bool (dev,"system-power-controller" )) { ret =devm_register_sys_off_handler (dev, -SYS_OFF_MODE_POWER_OFF_PREPARE ,SYS_OFF_PRIO_HIGH , +SYS_OFF_MODE_POWER_OFF ,SYS_OFF_PRIO_HIGH , &rk808_power_off, rk808);if (ret) return dev_err_probe(dev, ret,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 556/1756 mfd: intel_quark_i2c_gpio: Manage the fixed-rate clock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit 14a7cf1a3730c7c2393ef5a226e90baf61aa8a9f ]
The I2C clock is allocated by clk_register_fixed_rate(), but cleanup uses clk_unregister(), leaving the fixed-rate provider allocation behind.
Manage the provider with devm_clk_hw_register_fixed_rate() and its lookup with devm_clk_hw_register_clkdev(). Managed resources release the lookup before the provider, after the MFD children have been removed.
Remove the manual clock cleanup and the private structure that only stored the clock and lookup pointers.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/mfd/intel_quark_i2c_gpio.c | 52 ++++-------------------------- 1 file changed, 6 insertions(+), 46 deletions(-)
drivers/mfd/intel_quark_i2c_gpio.c +6 -46
@@ -35,11 +35,6 @@/* The Quark I2C controller source clock */ #define INTEL_QUARK_I2C_CLK_HZ 33000000 -struct intel_quark_mfd { -struct clk *i2c_clk; -struct clk_lookup *i2c_clk_lookup; -}; -static const struct property_entry intel_quark_i2c_controller_standard_properties[] = {PROPERTY_ENTRY_U32 ("clock-frequency" ,I2C_MAX_STANDARD_MODE_FREQ ), { }
@@ -160,37 +155,12 @@ MODULE_DEVICE_TABLE(pci, intel_quark_mfd_ids);static int intel_quark_register_i2c_clk (struct device *dev) { -struct intel_quark_mfd *quark_mfd =dev_get_drvdata (dev); -struct clk *i2c_clk; - - i2c_clk =clk_register_fixed_rate (dev, -INTEL_QUARK_I2C_CONTROLLER_CLK ,NULL , -0 ,INTEL_QUARK_I2C_CLK_HZ ); -if (IS_ERR (i2c_clk)) -return PTR_ERR (i2c_clk); - - quark_mfd->i2c_clk = i2c_clk; - quark_mfd->i2c_clk_lookup =clkdev_create (i2c_clk,NULL , -INTEL_QUARK_I2C_CONTROLLER_CLK ); - -if (!quark_mfd->i2c_clk_lookup) { -clk_unregister (quark_mfd->i2c_clk); -dev_err (dev,"Fixed clk register failed\n" ); -return -ENOMEM ; - } - -return 0 ; -} - -static void intel_quark_unregister_i2c_clk (struct device *dev) -{ -struct intel_quark_mfd *quark_mfd =dev_get_drvdata (dev); - -if (!quark_mfd->i2c_clk_lookup) -return ; +struct clk_hw *hw; -clkdev_drop (quark_mfd->i2c_clk_lookup); -clk_unregister (quark_mfd->i2c_clk); + hw =devm_clk_hw_register_fixed_rate (dev,INTEL_QUARK_I2C_CONTROLLER_CLK , +NULL ,0 ,INTEL_QUARK_I2C_CLK_HZ ); +return devm_clk_hw_register_clkdev (dev, hw,NULL , +INTEL_QUARK_I2C_CONTROLLER_CLK ); }static int intel_quark_i2c_setup (struct pci_dev *pdev)
@@ -238,19 +208,12 @@ static int intel_quark_gpio_setup(struct pci_dev *pdev)static int intel_quark_mfd_probe (struct pci_dev *pdev,const struct pci_device_id *id) { -struct intel_quark_mfd *quark_mfd;int ret; ret =pcim_enable_device (pdev);if (ret)return ret; - quark_mfd =devm_kzalloc (&pdev->dev,sizeof (*quark_mfd),GFP_KERNEL ); -if (!quark_mfd) -return -ENOMEM ; - -dev_set_drvdata (&pdev->dev, quark_mfd); - ret =intel_quark_register_i2c_clk (&pdev->dev);if (ret)return ret;
@@ -260,7 +223,7 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,/* This driver only requires 1 IRQ vector */ ret =pci_alloc_irq_vectors (pdev,1 ,1 ,PCI_IRQ_ALL_TYPES );if (ret <0 ) - goto err_unregister_i2c_clk; +return ret; ret =intel_quark_i2c_setup (pdev);if (ret)
@@ -282,8 +245,6 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,software_node_unregister_node_group (intel_quark_gpio_node_group); err_free_irq_vectors:pci_free_irq_vectors (pdev); -err_unregister_i2c_clk: -intel_quark_unregister_i2c_clk (&pdev->dev);return ret; }
@@ -292,7 +253,6 @@ static void intel_quark_mfd_remove(struct pci_dev *pdev)mfd_remove_devices (&pdev->dev);software_node_unregister_node_group (intel_quark_gpio_node_group);pci_free_irq_vectors (pdev); -intel_quark_unregister_i2c_clk (&pdev->dev); }static struct pci_driver intel_quark_mfd_driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 557/1756 mfd: da9150: Balance IRQ wake on teardown
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit ef464f82f3aecad4071af71074b2ceb77ffbb609 ]
DA9150 enables IRQ wake after registering its regmap IRQ chip, but does not disable it on a later probe failure or driver removal. This leaves the wake depth elevated after the handler is removed, and repeated bind attempts can accumulate the imbalance.
Remember whether enabling IRQ wake succeeded and balance only a successful call. Remove MFD children first so their nested IRQ users are gone, then disable wake before removing the regmap IRQ chip. Preserve the existing non-fatal behavior when IRQ wake cannot be enabled.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/mfd/da9150-core.c | 8 ++++++-- include/linux/mfd/da9150/core.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/mfd/da9150-core.c +6 -2
@@ -450,7 +450,7 @@ static int da9150_probe(struct i2c_client *client) da9150->irq_base =regmap_irq_chip_get_base (da9150->regmap_irq_data); -enable_irq_wake (da9150->irq); + da9150->irq_wake_enabled = !enable_irq_wake (da9150->irq); ret = mfd_add_devices(da9150->dev, -1, da9150_devs, ARRAY_SIZE(da9150_devs), NULL,
@@ -463,6 +463,8 @@ static int da9150_probe(struct i2c_client *client)return 0 ; mfd_fail: +if (da9150->irq_wake_enabled) +disable_irq_wake (da9150->irq);regmap_del_irq_chip (da9150->irq, da9150->regmap_irq_data); regmap_irq_fail:i2c_unregister_device (da9150->core_qif);
@@ -474,8 +476,10 @@ static void da9150_remove(struct i2c_client *client) {struct da9150 *da9150 =i2c_get_clientdata (client); -regmap_del_irq_chip (da9150->irq, da9150->regmap_irq_data);mfd_remove_devices (da9150->dev); +if (da9150->irq_wake_enabled) +disable_irq_wake (da9150->irq); +regmap_del_irq_chip (da9150->irq, da9150->regmap_irq_data);i2c_unregister_device (da9150->core_qif); }
include/linux/mfd/da9150/core.h +1 -0
@@ -65,6 +65,7 @@ struct da9150 {struct regmap_irq_chip_data *regmap_irq_data;int irq;int irq_base; +bool irq_wake_enabled; };/* Device I/O - Query Interface for FG and standard register access */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 558/1756 kconfig: warn about malformed KCONFIG_PROBABILITY values
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitrii Tulnov <[email protected]>
[ Upstream commit 9f01cd3a324390b235c67ae4ca3d35085369ebdd ]
randconfig checks the numeric range of each probability but does not validate where strtol() stops. For example, KCONFIG_PROBABILITY=50% is accepted as 50:0:0: the '%' is parsed repeatedly as zero. For the documented value 50, tristate y/m/n probabilities are 25%/25%/50%. With 50%, both y/m probabilities silently become zero, reducing the coverage of random configuration builds. Empty fields and extra fields are also accepted.
Warn when the value does not follow the documented decimal format. For malformed inputs whose parsed probabilities are in range, preserve the existing interpretation unless KCONFIG_WERROR is set. In that case, exit with an error before writing the configuration. Leading whitespace and signs are accepted by strtol(), but also trigger the warning because they are outside the documented format.
Keep the strtol() result as long until the range check. This rejects out-of-range values that narrowing to int previously made valid, such as 4294967296 becoming zero on a 64-bit host, regardless of KCONFIG_WERROR.
Add regression tests for one warning per malformed input, preserved configurations, KCONFIG_WERROR, out-of-range values, the supported probability formats, and the documented empty-value default.
--- scripts/kconfig/conf.c | 16 ++- scripts/kconfig/tests/conftest.py | 6 + .../tests/randconfig_probability/Kconfig | 12 ++ .../tests/randconfig_probability/__init__.py | 130 ++++++++++++++++++ 4 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 scripts/kconfig/tests/randconfig_probability/Kconfig create mode 100644 scripts/kconfig/tests/randconfig_probability/__init__.py
scripts/kconfig/conf.c +15 -1
@@ -186,12 +186,23 @@ static void conf_set_all_new_symbols(enum conf_def_mode mode)if (mode == def_random) {int n, p[3 ]; +bool warned = false;char *env =getenv ("KCONFIG_PROBABILITY" ); n =0 ;while (env && *env) {char *endp; -int tmp =strtol (env, &endp,10 ); +long tmp =strtol (env, &endp,10 ); + +if (!isdigit ((unsigned char )*env) || + (*endp && *endp !=':' ) || + (*endp ==':' && (!endp[1 ] || n ==2 ))) { +if (!warned) { +fprintf (stderr, +"warning: KCONFIG_PROBABILITY has malformed format\n" ); + warned = true; + } + }if (tmp >=0 && tmp <=100 ) { p[n++] = tmp;
@@ -227,6 +238,9 @@ static void conf_set_all_new_symbols(enum conf_def_mode mode)perror ("KCONFIG_PROBABILITY" );exit (1 ); } + +if (warned &&getenv ("KCONFIG_WERROR" )) +exit (1 ); }menu_for_each_entry (menu) {
scripts/kconfig/tests/conftest.py +6 -0
@@ -293,6 +293,12 @@ class Conf: return self._matches('stderr', expected) [email protected](autouse=True) +def clear_werror(monkeypatch): + # extra_env can set strict mode, but cannot remove an inherited flag. + monkeypatch.delenv('KCONFIG_WERROR', raising=False) + + @pytest.fixture(scope="module") def conf(request): """Create a Conf instance and provide it to test functions."""
scripts/kconfig/tests/randconfig_probability/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config MODULES + bool + default y + modules + +config BOOL + bool "Bool" + +config TRI + tristate "Tristate"
scripts/kconfig/tests/randconfig_probability/__init__.py new file +130 -0
130 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 559/1756 ASoC: fsl_asrc: use regmap_write_bits to update clock source registers
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengjiu Wang <[email protected]>
[ Upstream commit 92871abc1302b852b88d86114115f8fd6b50b9b9 ]
After a warm reboot the REG_ASRCSR register may not be in its hardware reset state. regmap caches the register value as 0 (the assumed default), so when the desired clock source index is also 0, regmap_update_bits() skips the actual hardware write because it believes the register already holds the correct value. This leaves a stale clock source in the hardware.
Replace regmap_update_bits() with regmap_write_bits() so that the masked fields are always written to hardware regardless of the cached value.
--- sound/soc/fsl/fsl_asrc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/fsl/fsl_asrc.c +4 -4
@@ -521,10 +521,10 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) ASRCTR_USR(index));/* Set the input and output clock sources */ -regmap_update_bits (asrc->regmap,REG_ASRCSR , -ASRCSR_AICSi_MASK (index) |ASRCSR_AOCSi_MASK (index), -ASRCSR_AICS (index, clk_index[IN ]) | -ASRCSR_AOCS (index, clk_index[OUT ])); +regmap_write_bits (asrc->regmap,REG_ASRCSR , +ASRCSR_AICSi_MASK (index) |ASRCSR_AOCSi_MASK (index), +ASRCSR_AICS (index, clk_index[IN ]) | +ASRCSR_AOCS (index, clk_index[OUT ]));/* Calculate the input clock divisors */ indiv =fsl_asrc_cal_asrck_divisor (pair, div[IN ]);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 560/1756 perf mem: Fix size tracking for mem_lvls in perf_script__meminfo_scnprintf()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Falcon <[email protected]>
[ Upstream commit 06d5ce78e4fea2cf0738da903aa248a81101c155 ]
When printing memory info in perf script, the entire size of the buffer is passed to perf_mem__lvl_scnprintf() instead of the remaining size. Pass the remaining buffer size instead.
This issue was detected by sashiko during an internal code review.
--- tools/perf/util/mem-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/mem-events.c +1 -1
@@ -591,7 +591,7 @@ int perf_script__meminfo_scnprintf(char *out, size_t sz, const struct mem_info * i +=scnprintf (out, sz,"|OP " ); i +=perf_mem__op_scnprintf (out + i, sz - i, mem_info); i +=scnprintf (out + i, sz - i,"|LVL " ); - i +=perf_mem__lvl_scnprintf (out + i, sz, mem_info); + i +=perf_mem__lvl_scnprintf (out + i, sz - i, mem_info); i +=scnprintf (out + i, sz - i,"|SNP " ); i +=perf_mem__snp_scnprintf (out + i, sz - i, mem_info); i +=scnprintf (out + i, sz - i,"|TLB " );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 561/1756 NFS: use TCP for MOUNT when xprtsec= selects TLS
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 72233aabc78cd0415c850641bc2a6e4fea23173f ]
An NFSv2 or NFSv3 text mount that specifies xprtsec= but no mountproto= crashes in nfs_init_timeout_values():
RIP: 0010:nfs_init_timeout_values+0x10a/0x110 [nfs] Call Trace: nfs_mount+0x1c3/0x330 [nfs] nfs_try_get_tree+0x1e5/0x460 [nfs] nfs_get_tree+0x64d/0x6d0 [nfs] vfs_get_tree+0x2b/0xe0 vfs_cmd_create+0x5f/0xd0 vfs_fsconfig_locked+0x50/0x130 __se_sys_fsconfig+0x2f9/0x3a0
nfs_validate_transport_protocol() sets nfs_server.protocol to XPRT_TRANSPORT_TCP_TLS when xprtsec= is present, but the switch in nfs_set_mount_transport_protocol() has no case for that value. mount_server.protocol stays zero, and nfs_init_timeout_values() calls BUG() on a transport it does not recognize.
mount.nfs always appends mountproto= after probing the server's rpcbind, so only a caller that bypasses it, such as "mount -i" or a program that drives fsconfig() directly, reaches the crash.
Select TCP for MOUNT when the NFS transport is XPRT_TRANSPORT_TCP_TLS. nfs_mount() requests no transport security, so MOUNT already runs over plain TCP whenever mount.nfs supplies mountproto=tcp.
--- fs/nfs/fs_context.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/fs_context.c +1 -0
@@ -372,6 +372,7 @@ static void nfs_set_mount_transport_protocol(struct nfs_fs_context *ctx) ctx->mount_server.protocol =XPRT_TRANSPORT_UDP ;break ;case XPRT_TRANSPORT_TCP : +case XPRT_TRANSPORT_TCP_TLS :case XPRT_TRANSPORT_RDMA : ctx->mount_server.protocol =XPRT_TRANSPORT_TCP ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 562/1756 bpf: Adjust bpf_func to account for CFI offset in bpf_jit_free on riscv
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pu Lehui <[email protected]>
[ Upstream commit 93df8ae3267f19bf0c1135d26a0e21145dd0ea1c ]
When CFI is enabled, the actual BPF program entry point is shifted forward by a CFI preamble. During bpf_jit_free(), this shifted pointer causes the wrong ro_header to be fetched, leading to a potential invalid memory free.
Fix this by subtracting cfi_get_offset() from prog->bpf_func to correctly restore the original JITed allocation address before freeing.
--- arch/riscv/net/bpf_jit_core.c | 1 + 1 file changed, 1 insertion(+)
arch/riscv/net/bpf_jit_core.c +1 -0
@@ -262,6 +262,7 @@ void bpf_jit_free(struct bpf_prog *prog)kfree (jit_data->ctx.offset);kfree (jit_data); } + prog->bpf_func = (void *)prog->bpf_func -cfi_get_offset (); hdr =bpf_jit_binary_pack_hdr (prog);bpf_jit_binary_pack_free (hdr,NULL );WARN_ON_ONCE (!bpf_prog_kallsyms_verify_off (prog));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 563/1756 ASoC: fsl_asrc: check the second front-end DMA channel
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Slavin Liu <[email protected]>
[ Upstream commit b4136c0d69ead737197af741e20edd1c3574f6b4 ]
The temporary Front-End DMA request can fail independently of the persistent channel acquired earlier in fsl_asrc_dma_hw_params(). The returned NULL pointer is immediately used to read its private data.
Check the temporary channel and release the previously acquired persistent Front-End channel on failure. Clear its slot so a later hw_free cannot release it twice. ASoC marks a component's hw_params only after success and skips unmarked components during rollback, so returning an error alone would leak the earlier channel.
Detected by static analysis and reviewed with AI-assisted source auditing.
--- sound/soc/fsl/fsl_asrc_dma.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/fsl/fsl_asrc_dma.c +5 -0
@@ -246,6 +246,11 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,/* Get DMA request of Front-End */ tmp_chan = asrc->get_dma_channel (pair, dir); +if (!tmp_chan) { +dma_release_channel (pair->dma_chan[!dir]); + pair->dma_chan[!dir] =NULL ; +return -EINVAL ; + } tmp_data = tmp_chan->private; pair->dma_data.dma_request2 = tmp_data->dma_request; pair->dma_data.peripheral_type = tmp_data->peripheral_type;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 564/1756 ASoC: adau17x1: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 8ca84987c11d11e0ba60f202e3199b3b80c87721 ]
adau17x1_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The optional switch-mode callback remains ordered before the cache replay.
The issue was found by a tool we developed.
--- sound/soc/codecs/adau17x1.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/adau17x1.c +1 -3
@@ -989,9 +989,7 @@ int adau17x1_resume(struct snd_soc_component *component)if (adau->switch_mode) adau->switch_mode (component->dev); -regcache_sync (adau->regmap); - -return 0 ; +return regcache_sync (adau->regmap); }EXPORT_SYMBOL_GPL (adau17x1_resume);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 565/1756 ASoC: ak4642: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 7142c34ed92fddca7038787b8695d22c661dc6ec ]
ak4642_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/ak4642.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/ak4642.c +1 -2
@@ -533,8 +533,7 @@ static int ak4642_resume(struct snd_soc_component *component)struct regmap *regmap =dev_get_regmap (component->dev,NULL );regcache_cache_only (regmap, false); -regcache_sync (regmap); -return 0 ; +return regcache_sync (regmap); }static int ak4642_probe (struct snd_soc_component *component) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 566/1756 ASoC: es8316: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 243d0c47e57a6af89d95aa451ef5fbf453983b1c ]
es8316_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/es8316.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/es8316.c +1 -3
@@ -808,9 +808,7 @@ static int es8316_resume(struct snd_soc_component *component)struct es8316_priv *es8316 =snd_soc_component_get_drvdata (component);regcache_cache_only (es8316->regmap, false); -regcache_sync (es8316->regmap); - -return 0 ; +return regcache_sync (es8316->regmap); }static int es8316_suspend (struct snd_soc_component *component)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 567/1756 ASoC: nau8540: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 0bf2b3411537e8e4d9c03702646a9fc87198d4b1 ]
nau8540_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/nau8540.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/nau8540.c +1 -3
@@ -897,9 +897,7 @@ static int __maybe_unused nau8540_resume(struct snd_soc_component *component)struct nau8540 *nau8540 =snd_soc_component_get_drvdata (component);regcache_cache_only (nau8540->regmap, false); -regcache_sync (nau8540->regmap); - -return 0 ; +return regcache_sync (nau8540->regmap); }static const struct snd_soc_component_driver nau8540_component_driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 568/1756 ASoC: rt1011: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 432734a00bfae17baeff1a83b61bfc9c2ab20c12 ]
rt1011_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt1011.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1011.c +1 -3
@@ -2099,9 +2099,7 @@ static int rt1011_resume(struct snd_soc_component *component)struct rt1011_priv *rt1011 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt1011->regmap, false); -regcache_sync (rt1011->regmap); - - return 0; + return regcache_sync(rt1011->regmap); }#else #define rt1011_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 569/1756 ASoC: rt1016: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 98ace05793c7b80a9f49d92b78fcc88e0970f8e4 ]
rt1016_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt1016.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1016.c +1 -3
@@ -570,9 +570,7 @@ static int rt1016_resume(struct snd_soc_component *component)struct rt1016_priv *rt1016 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt1016->regmap, false); -regcache_sync (rt1016->regmap); - - return 0; + return regcache_sync(rt1016->regmap); }#else #define rt1016_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 570/1756 ASoC: rt1305: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 30858325aa90380c6bcdde605214f1ebdbec568c ]
rt1305_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt1305.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1305.c +1 -3
@@ -896,9 +896,7 @@ static int rt1305_resume(struct snd_soc_component *component)struct rt1305_priv *rt1305 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt1305->regmap, false); -regcache_sync (rt1305->regmap); - - return 0; + return regcache_sync(rt1305->regmap); }#else #define rt1305_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 571/1756 ASoC: rt1308: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 3db3289178b94056753f7a8c6ee4ab4b232ee6a5 ]
rt1308_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt1308.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1308.c +1 -3
@@ -715,9 +715,7 @@ static int rt1308_resume(struct snd_soc_component *component)struct rt1308_priv *rt1308 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt1308->regmap, false); -regcache_sync (rt1308->regmap); - - return 0; + return regcache_sync(rt1308->regmap); }#else #define rt1308_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 572/1756 ASoC: rt1318: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit a5735b341c6e8cff5f5f9480295012a5ceebb665 ]
rt1318_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt1318.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/rt1318.c +1 -2
@@ -1076,8 +1076,7 @@ static int rt1318_resume(struct snd_soc_component *component)struct rt1318_priv *rt1318 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt1318->regmap, false); -regcache_sync (rt1318->regmap); - return 0; + return regcache_sync(rt1318->regmap); }#else #define rt1318_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 573/1756 ASoC: rt5616: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 8fc9d353d5371a946d9a9952278b96c09070374c ]
rt5616_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt5616.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/rt5616.c +1 -2
@@ -1247,8 +1247,7 @@ static int rt5616_resume(struct snd_soc_component *component)struct rt5616_priv *rt5616 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt5616->regmap, false); -regcache_sync (rt5616->regmap); - return 0; + return regcache_sync(rt5616->regmap); }#else #define rt5616_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 574/1756 ASoC: rt5659: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 3a9b5bce85a1baff95463a2bb021efac64bcf83f ]
rt5659_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt5659.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt5659.c +1 -3
@@ -3704,9 +3704,7 @@ static int rt5659_resume(struct snd_soc_component *component)struct rt5659_priv *rt5659 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt5659->regmap, false); -regcache_sync (rt5659->regmap); - - return 0; + return regcache_sync(rt5659->regmap); }#else #define rt5659_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 575/1756 ASoC: rt5660: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 70fe8997b03078ff8253d985a161fef310f7c346 ]
rt5660_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The power-off resume delay remains ordered before the cache replay.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt5660.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt5660.c +1 -3
@@ -1147,9 +1147,7 @@ static int rt5660_resume(struct snd_soc_component *component)msleep (350 );regcache_cache_only (rt5660->regmap, false); -regcache_sync (rt5660->regmap); - - return 0; + return regcache_sync(rt5660->regmap); }#else #define rt5660_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 576/1756 ASoC: rt5665: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 9f2933d9a437302d5ae32eb9022efef049d8ab22 ]
rt5665_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt5665.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt5665.c +1 -3
@@ -4485,9 +4485,7 @@ static int rt5665_resume(struct snd_soc_component *component)struct rt5665_priv *rt5665 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt5665->regmap, false); -regcache_sync (rt5665->regmap); - - return 0; + return regcache_sync(rt5665->regmap); }#else #define rt5665_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 577/1756 ASoC: mediatek: mt8188: mt8188-afe-clk: Handle tuner clock enable errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit a2c3ee3349a7da91e563b9a21a355a28fa754bc7 ]
Clock enable errors are currently ignored when enabling the APLL and tuner clocks.
Check the return values and roll back the APLL clock if the tuner clock fails to enable.
--- sound/soc/mediatek/mt8188/mt8188-afe-clk.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-clk.c +17 -4
@@ -260,15 +260,28 @@ static int mt8188_afe_enable_tuner_clk(struct mtk_base_afe *afe, unsigned int id) {struct mt8188_afe_private *afe_priv = afe->platform_priv; +int ret;switch (id) {case MT8188_AUD_PLL1 : -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL ]); -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL1_TUNER ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL ]); +if (ret) +return ret; + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL1_TUNER ]); +if (ret) { +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL ]); +return ret; + }break ;case MT8188_AUD_PLL2 : -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL2 ]); -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL2_TUNER ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL2 ]); +if (ret) +return ret; + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL2_TUNER ]); +if (ret) { +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL2 ]); +return ret; + }break ;default :return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 578/1756 ASoC: mediatek: mt8188: mt8188-afe-clk: Propagate regmap update errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 60a8112a088aee38d728457a14fa8bfb50f4c87e ]
The return values from regmap_update_bits() are currently ignored by the clock and AFE control functions.
Propagate the errors to allow callers to handle regmap update failures.
--- sound/soc/mediatek/mt8188/mt8188-afe-clk.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-clk.c +4 -10
@@ -574,9 +574,7 @@ static int mt8188_afe_enable_top_cg(struct mtk_base_afe *afe, unsigned int cg_tyunsigned int mask =get_top_cg_mask (cg_type);unsigned int val =get_top_cg_on_val (cg_type); -regmap_update_bits (afe->regmap, reg, mask, val); - -return 0 ; +return regmap_update_bits (afe->regmap, reg, mask, val); }static int mt8188_afe_disable_top_cg (struct mtk_base_afe *afe,unsigned int cg_type)
@@ -585,9 +583,7 @@ static int mt8188_afe_disable_top_cg(struct mtk_base_afe *afe, unsigned int cg_tunsigned int mask =get_top_cg_mask (cg_type);unsigned int val =get_top_cg_off_val (cg_type); -regmap_update_bits (afe->regmap, reg, mask, val); - -return 0 ; +return regmap_update_bits (afe->regmap, reg, mask, val); }int mt8188_afe_enable_reg_rw_clk (struct mtk_base_afe *afe)
@@ -627,14 +623,12 @@ int mt8188_afe_disable_reg_rw_clk(struct mtk_base_afe *afe)static int mt8188_afe_enable_afe_on (struct mtk_base_afe *afe) { -regmap_update_bits (afe->regmap,AFE_DAC_CON0 ,0x1 ,0x1 ); -return 0 ; +return regmap_update_bits (afe->regmap,AFE_DAC_CON0 ,0x1 ,0x1 ); }static int mt8188_afe_disable_afe_on (struct mtk_base_afe *afe) { -regmap_update_bits (afe->regmap,AFE_DAC_CON0 ,0x1 ,0x0 ); -return 0 ; +return regmap_update_bits (afe->regmap,AFE_DAC_CON0 ,0x1 ,0x0 ); }static int mt8188_afe_enable_a1sys (struct mtk_base_afe *afe)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 579/1756 ASoC: mediatek: mt8188: mt8188-afe-clk: Handle clock enable errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 1b65c13d1af99170e2a855ca9212a03daa3e7f04 ]
Clock enable errors are currently ignored by several AFE clock control functions.
Check the return values and roll back previously enabled clocks when a subsequent clock enable fails.
--- sound/soc/mediatek/mt8188/mt8188-afe-clk.c | 69 ++++++++++++++++++---- 1 file changed, 58 insertions(+), 11 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-clk.c +58 -11
@@ -589,22 +589,47 @@ static int mt8188_afe_disable_top_cg(struct mtk_base_afe *afe, unsigned int cg_tint mt8188_afe_enable_reg_rw_clk (struct mtk_base_afe *afe) {struct mt8188_afe_private *afe_priv = afe->platform_priv; - +int ret;/* bus clock for AFE external access, like DRAM */ -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUDIO_LOCAL_BUS_SEL ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUDIO_LOCAL_BUS_SEL ]); +if (ret) + goto err_local_bus;/* bus clock for AFE internal access, like AFE SRAM */ -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUD_INTBUS_SEL ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUD_INTBUS_SEL ]); +if (ret) + goto err_intbus;/* audio 26m clock source */ -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_ADSP_AUDIO_26M ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_ADSP_AUDIO_26M ]); +if (ret) + goto err_26m;/* AFE hw clock */ -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_AFE ]); -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS_HP ]); -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_AFE ]); +if (ret) + goto err_afe; + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS_HP ]); +if (ret) + goto err_a1sys_hp; + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS ]); +if (ret) + goto err_a1sys;return 0 ; + +err_a1sys: +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS_HP ]); +err_a1sys_hp: +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_AFE ]); +err_afe: +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_ADSP_AUDIO_26M ]); +err_26m: +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUD_INTBUS_SEL ]); +err_intbus: +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUDIO_LOCAL_BUS_SEL ]); +err_local_bus: +return ret; }int mt8188_afe_disable_reg_rw_clk (struct mtk_base_afe *afe)
@@ -640,7 +665,13 @@ static int mt8188_afe_enable_a1sys(struct mtk_base_afe *afe)if (ret)return ret; -return mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_A1SYS_TIMING ); + ret =mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_A1SYS_TIMING ); +if (ret) { +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS ]); +return ret; + } + +return 0 ; }static int mt8188_afe_disable_a1sys (struct mtk_base_afe *afe)
@@ -661,7 +692,13 @@ static int mt8188_afe_enable_a2sys(struct mtk_base_afe *afe)if (ret)return ret; -return mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_A2SYS_TIMING ); + ret =mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_A2SYS_TIMING ); +if (ret) { +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A2SYS ]); +return ret; + } + +return 0 ; }static int mt8188_afe_disable_a2sys (struct mtk_base_afe *afe)
@@ -749,8 +786,18 @@ int mt8188_apll2_disable(struct mtk_base_afe *afe)int mt8188_afe_enable_main_clock (struct mtk_base_afe *afe) { -mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_26M_TIMING ); -mt8188_afe_enable_afe_on (afe); +int ret; + + ret =mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_26M_TIMING ); +if (ret) +return ret; + + ret =mt8188_afe_enable_afe_on (afe); +if (ret) { +mt8188_afe_disable_top_cg (afe,MT8188_TOP_CG_26M_TIMING ); +return ret; + } +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 580/1756 ASoC: mediatek: mt8188: mt8188-afe-pcm: Handle runtime resume errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit f5f6941d92972ba66829a99999fa825e63da5162 ]
Errors from clock enable and regcache synchronization are currently ignored during runtime resume.
Check the return values from mt8188_afe_enable_reg_rw_clk(), regcache_sync(), and mt8188_afe_enable_main_clock(), and abort the runtime resume if any of them fails.
On failure, disable the previously enabled reg_rw clocks and restore the regmap to cache-only mode.
--- sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +16 -5
@@ -3009,22 +3009,33 @@ static int mt8188_afe_runtime_resume(struct device *dev)struct mtk_base_afe *afe =dev_get_drvdata (dev);struct mt8188_afe_private *afe_priv = afe->platform_priv;struct arm_smccc_res res; +int ret;arm_smccc_smc (MTK_SIP_AUDIO_CONTROL ,MTK_AUDIO_SMC_OP_DOMAIN_SIDEBANDS ,0 ,0 ,0 ,0 ,0 ,0 , &res); -mt8188_afe_enable_reg_rw_clk (afe); + ret =mt8188_afe_enable_reg_rw_clk (afe); +if (ret) +return ret;if (!afe->regmap || afe_priv->pm_runtime_bypass_reg_ctl) - goto skip_regmap; +return 0 ;regcache_cache_only (afe->regmap, false); -regcache_sync (afe->regmap); + ret =regcache_sync (afe->regmap); +if (ret) + goto err; + + ret =mt8188_afe_enable_main_clock (afe); +if (ret) + goto err; -mt8188_afe_enable_main_clock (afe); -skip_regmap:return 0 ; +err: +mt8188_afe_disable_reg_rw_clk (afe); +regcache_cache_only (afe->regmap, true); +return ret; }static int init_memif_priv_data (struct mtk_base_afe *afe)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 581/1756 iio: accel: bma220: publish the SPI driver ACPI alias
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit cdc7d3dd101251a6373332726b8d6fad35e83b8a ]
The SPI driver advertises an ACPI match for BMA0220 but does not export that table. A modular build therefore lacks the ACPI alias used to load the driver when the device is enumerated through ACPI.
Export the ACPI table. Move the existing SPI export next to its SPI ID table so each export is adjacent to the table it describes.
The issue was found by our static-analysis tool.
--- drivers/iio/accel/bma220_spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/accel/bma220_spi.c +2 -1
@@ -308,12 +308,13 @@ static const struct spi_device_id bma220_spi_id[] = { {"bma220", 0}, {} }; +MODULE_DEVICE_TABLE(spi, bma220_spi_id); static const struct acpi_device_id bma220_acpi_id[] = { {"BMA0220", 0}, {} }; -MODULE_DEVICE_TABLE(spi, bma220_spi_id); +MODULE_DEVICE_TABLE(acpi, bma220_acpi_id); static struct spi_driver bma220_driver = { .driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 582/1756 dt-bindings: arm: mediatek: Fix MT6779 audsys compatible
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring (Arm) <[email protected]>
[ Upstream commit 034b3b1ce25a62222920e2bb3b6a0c7ef160b108 ]
The correct name for the MediaTek MT6779 audsys compatible is "mediatek,mt6779-audio", not "mediatek,mt6779-audsys". The original .txt binding was correct.
--- .../devicetree/bindings/arm/mediatek/mediatek,audsys.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.yaml +1 -1
@@ -19,7 +19,7 @@ properties: - enum: - mediatek,mt2701-audsys - mediatek,mt6765-audsys - - mediatek,mt6779-audsys + - mediatek,mt6779-audio - mediatek,mt7622-audsys - mediatek,mt8167-audsys - mediatek,mt8173-audsys
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 583/1756 powerpc/ftrace: Dont restore r13 during ftrace_regs_caller
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shrikanth Hegde <[email protected]>
[ Upstream commit af5f0870883ae4aea7f668d06cbb7ad0e12824c8 ]
Michal reported a stack-protector failure and subsequent panic when running kernel builds. This was observed with full/lazy preemption. Initially it was suspected as KVM, but later turned out to be due to a bcc tool running in parallel.
Issue was recreated using a bcc tool.
For example, running below in parallel leads to crash. ./funccount sched* -d 100 and make -j 64
The same crash was observed when running kprobe for schedule() function, while simpler function tracer for schedule() didn't cause the crash. This helped to narrow it down to ftrace backed kprobes area.
The crash occurs as follows:
ftrace_regs_caller entry on CPU A
|
+-> save r13 = CPU A PACA into pt_regs
|
+-> call kprobe_ftrace_handler()
|
+-> ftrace_test_recursion_unlock()
|
+-> preempt_enable
+-> task can schedule and migrate to CPU B
+-> task resumes with live r13 = CPU B PACA
|
+-> REST_GPRS(2, 31)
|
+-> restore saved r13 = CPU A PACA
|
|-> The task then continues running on CPU B with r13 pointing
| to CPU A's PACA.The stack-protector canary is accessed through the PACA. After the task migrates, CPU A may run a different task and update its PACA with that task's canary. Restoring the saved r13 then causes the migrated task's saved stack canary to be compared against the canary in CPU A's PACA, resulting in a stack-protector failure.
Similarly, current is resolved through the PACA. With a stale r13, preempt_count() can access the state of the task referenced by CPU A's PACA instead of the task running on CPU B. This results in corrupted preempt-count warnings and scheduling-while-atomic failures.
This path for example is called when using kprobes and parallel kernel builds can cause preemptions during ftrace_test_recursion_unlock.
Do not restore r13 from the saved register frame. If the task did not migrate, the live r13 already has the saved value. If it migrated, the live r13 contains the correct PACA pointer for the CPU on which the task resumed.
On PPC32, r13 is regular register. So do this fix only for PPC64
--- arch/powerpc/kernel/trace/ftrace_entry.S | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/kernel/trace/ftrace_entry.S +6 -0
@@ -129,7 +129,13 @@ /* Restore gprs */ .if \allregs == 1 +#ifdef CONFIG_PPC64 + REST_GPRS(2, 12, r1) + /* Do not restore a stale PACA pointer if the task migrated */ + REST_GPRS(14, 31, r1) +#else REST_GPRS(2, 31, r1) +#endif .else REST_GPRS(3, 10, r1) #ifdef CONFIG_LIVEPATCH_64
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 584/1756 arm64: dts: qcom: x1e80100-yoga-slim7x: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit a92ac66d35dfd8438b6e40bfb956ff69365798ac ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1e80100-lenovo-yoga-slim7x.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1e80100-lenovo-yoga-slim7x.dts +1 -0
@@ -795,6 +795,7 @@ right_tweeter: speaker@0,1 { &tlmm { gpio-reserved-ranges = <34 2>, /* Unused */ <44 4>, /* SPI (TPM) */ + <65 1>, /* EC reset */ <238 1>; /* UFS Reset */ edp_reg_en: edp-reg-en-state {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 585/1756 arm64: dts: qcom: x1e80100-qcp: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit fd7d7b5d307f3a475e9555dfd89ff80cfae46b3c ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1e80100-qcp.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1e80100-qcp.dts +1 -0
@@ -812,6 +812,7 @@ wcd_tx: codec@0,3 { &tlmm { gpio-reserved-ranges = <33 3>, /* Unused */ <44 4>, /* SPI (TPM) */ + <65 1>, /* EC reset */ <238 1>; /* UFS Reset */ edp_reg_en: edp-reg-en-state {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 586/1756 dt-bindings: vendor-prefixes: Add General Mobile
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muzaffer Kadir <[email protected]>
[ Upstream commit 7034bec693b752bcd7ebb4fa00dc3b429b4dc4f7 ]
Add vendor prefix for General Mobile.
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -569,6 +569,8 @@ patternProperties: description: Gemei Digital Technology Co., Ltd. "^gemtek,.*": description: Gemtek Technology Co., Ltd. + "^generalmobile,.*": + description: General Mobile Fzc. "^genesys,.*": description: Genesys Logic, Inc. "^geniatech,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 587/1756 perf c2c: Fix documented default coalesce fields
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiebin Sun <[email protected]>
[ Upstream commit b36a6f180baad35a962677ae181681ca60dda35b ]
The default coalesce fields dropped pid in favor of iaddr, but the man page still documents the old pid,iaddr default. Update it to match the command.
--- tools/perf/Documentation/perf-c2c.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Documentation/perf-c2c.txt +1 -1
@@ -304,7 +304,7 @@ output fields set for cacheline offsets output: Code address, Code symbol, Shared Object, Source line dso - coalesced by shared object -By default the coalescing is setup with 'pid,iaddr'. +By default, coalescing uses `iaddr`. STDIO OUTPUT ------------
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 588/1756 mtd: block: prevent reclaim I/O during request processing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qingfang Deng <[email protected]>
[ Upstream commit d498b2ddda99eed28cde177b1620dbcea246a1c4 ]
The blktrans request callbacks run under dev->lock and may allocate memory with GFP_KERNEL. For example, mtdblock_writesect() uses vmalloc() to allocate its eraseblock cache. Direct reclaim can then recurse into block I/O and deadlock on resources held by the request being processed. syzbot reports a circular locking dependency involving the device mutex and fs_reclaim.
Commit d5ba1c8ffd0b ("mtd: don't use PF_MEMALLOC") removed PF_MEMALLOC from the MTD request thread. That flag had prevented direct reclaim, so its removal made allocations during request processing eligible for reclaim without excluding I/O.
Wrap request processing in mtd_queue_rq() in a NOIO scope. This covers both the request and background callbacks, including allocations made by lower MTD drivers, and prevents reclaim from initiating filesystem or block I/O.
--- drivers/mtd/mtd_blkdevs.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mtd/mtd_blkdevs.c +5 -0
@@ -18,6 +18,7 @@#include <linux/spinlock.h> #include <linux/hdreg.h> #include <linux/mutex.h> +#include <linux/sched/mm.h> #include <linux/uaccess.h> #include "mtdcore.h"
@@ -167,6 +168,7 @@ static blk_status_t mtd_queue_rq(struct blk_mq_hw_ctx *hctx, const struct blk_mq_queue_data *bd) {struct mtd_blktrans_dev *dev; +unsigned int noio_flags; dev = hctx->queue->queuedata;if (!dev) {
@@ -174,10 +176,13 @@ static blk_status_t mtd_queue_rq(struct blk_mq_hw_ctx *hctx,return BLK_STS_IOERR ; } +/* Reclaim must not recurse into I/O while processing requests. */ + noio_flags =memalloc_noio_save ();spin_lock_irq (&dev->queue_lock);list_add_tail (&bd->rq->queuelist, &dev->rq_list);mtd_blktrans_work (dev);spin_unlock_irq (&dev->queue_lock); +memalloc_noio_restore (noio_flags);return BLK_STS_OK ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 589/1756 wifi: ath11k: fix reg_info_store leak in ath11k_service_ready_ext_event()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Johnson <[email protected]>
[ Upstream commit 64828f091c7de5c1324427b140fb545f93ef073f ]
Currently, while processing the WMI Service Ready Ext event, the iterator in ath11k_service_ready_ext_event() can dispatch the HAL Regulatory Capabilities handler ath11k_wmi_tlv_ext_soc_hal_reg_caps_parse() which can allocate ab->reg_info_store.
If a subsequent failure occurs during iteration, the ab->reg_info_store allocation is leaked.
Directly free and clear the pointer on the error path.
Note that the normal cleanup function ath11k_reg_free() cannot be used since other regulatory-related fields are not yet populated at this point.
Compile tested only.
--- drivers/net/wireless/ath/ath11k/wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/ath/ath11k/wmi.c +9 -0
@@ -5084,6 +5084,15 @@ static int ath11k_service_ready_ext_event(struct ath11k_base *ab, err:kfree (svc_rdy_ext.mac_phy_caps); + +/* +* During TLV iteration the WMI_TAG_SOC_HAL_REG_CAPABILITIES +* handler may have allocated ab->reg_info_store, so free it +* on error to avoid a memory leak +*/ +kfree (ab->reg_info_store); + ab->reg_info_store =NULL ; +ath11k_wmi_free_dbring_caps (ab);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 590/1756 writeback: size foreign flushes by target wb dirty pages
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Yin <[email protected]>
[ Upstream commit 168a8c13159c6e3f0f08da6f8fa2f633a91ba9fd ]
Foreign dirty tracking records the bdi and wb memcg IDs of recently dirtied foreign inodes. When the source memcg needs foreign writeback, mem_cgroup_flush_foreign() queues WB_REASON_FOREIGN_FLUSH to the recorded target bdi_writeback.
cgroup_writeback_by_id() currently sizes this best-effort work from the target memcg's NR_FILE_DIRTY counter. The work is scoped to one target wb, so a memcg-wide dirty count can over-size a single-bdi flush when the target memcg has dirty pages on other devices. It can also under-size the flush when the target wb has dirty pages charged to other memcgs.
Over-sizing keeps the target wb busy longer and can delay later writeback work. Under-sizing can finish before enough pages are written back for the source memcg.
Use the target wb's WB_RECLAIMABLE counter and keep the existing 25% headroom. This keeps the budget aligned with the writeback object being queued.
--- fs/fs-writeback.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
fs/fs-writeback.c +7 -10
@@ -1146,7 +1146,7 @@ int cgroup_writeback_by_id(u64 bdi_id, int memcg_id,struct cgroup_subsys_state *memcg_css;struct bdi_writeback *wb;struct wb_writeback_work *work; -unsigned long dirty; +long dirty;int ret;/* lookup bdi and memcg */
@@ -1175,16 +1175,13 @@ int cgroup_writeback_by_id(u64 bdi_id, int memcg_id, }/* -* The caller is attempting to write out most of -* the currently dirty pages. Let's take the current dirty page -* count and inflate it by 25% which should be large enough to -* flush out most dirty pages while avoiding getting livelocked by -* concurrent dirtiers. -* -* BTW the memcg stats are flushed periodically and this is best-effort -* estimation, so some potential error is ok. +* The caller is attempting to write out most of the target wb's +* currently dirty pages. Size the work from the wb's reclaimable pages +* and inflate the count by 25%, which should be large enough to flush +* out most dirty pages while avoiding getting livelocked by concurrent +* dirtiers. */ - dirty =memcg_page_state (mem_cgroup_from_css (memcg_css),NR_FILE_DIRTY ); + dirty =wb_stat_sum (wb,WB_RECLAIMABLE ); dirty = dirty *10 /8 ;/* issue the writeback work */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 591/1756 ACPICA: Fix memory leak in acpi_ds_create_field()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit dbb3d99ee95c32711950850ddd33eb22a6042eb2 ]
acpi_ds_create_field() allocates internal_pcc_buffer for operation regions in the PCC address space.
The function runs once per field, so a second field on the same region overwrites the pointer and orphans the previous buffer.
The matching ACPI_FREE() in acpi_ut_delete_internal_obj() only ever sees the last one.
An arm64 platform whose SSDT declares regions with multiple fields each leaks two buffers at boot, as detected by kmemleak:
unreferenced object 0xffff000051e65400 (size 192):
comm "swapper/0", pid 1, jiffies 4294668436 backtrace (crc 0):
__kmalloc_noprof
acpi_ds_create_field acpi_ds_load2_end_op acpi_ds_exec_end_op
acpi_ps_parse_loop
acpi_ps_parse_aml
acpi_ns_load_table
acpi_load_tables
acpi_init
Do not allocate a region if it was previously allocated before, preserving the current design, but, not leaking memory.
--- drivers/acpi/acpica/dsfield.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/acpica/dsfield.c +2 -1
@@ -522,7 +522,8 @@ acpi_ds_create_field(union acpi_parse_object *op, }if (info.region_node->object->region.space_id == -ACPI_ADR_SPACE_PLATFORM_COMM ) { +ACPI_ADR_SPACE_PLATFORM_COMM && + !region_node->object->field.internal_pcc_buffer) { region_node->object->field.internal_pcc_buffer =ACPI_ALLOCATE_ZEROED (info.region_node->object->region. length);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 592/1756 ACPICA: Fix PCC OperationRegion command offsets
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 888dab4b04ea8725168c6d50d0bfb8057fccca18 ]
ACPI 6.3, section 5.5.2.4.7.3, states that the PCC Operation Region is associated with the region of shared memory that follows the PCC signature.
The generic and extended PCC shared memory layouts include the 4-byte signature at offset 0, so their raw shared memory COMMAND fields are at offsets 4 and 12 respectively. Since AML field offsets for the PCC OperationRegion are relative to the region after that signature, ACPICA must look for those COMMAND fields at OperationRegion offsets 0 and 8.
Adjust the generic and master subspace command checks to use those OperationRegion-relative offsets. Otherwise writes to the COMMAND field can fail to invoke the PCC address space handler at the offset described by the PCC OperationRegion definition.
--- drivers/acpi/acpica/exfield.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/acpi/acpica/exfield.c +6 -5
@@ -45,12 +45,13 @@ static const u8 acpi_protocol_lengths[] = {/* * The following macros determine a given offset is a COMD field. -* According to the specification, generic subspaces (types 0-2) contains a -* 2-byte COMD field at offset 4 and master subspaces (type 3) contains a 4-byte -* COMD field starting at offset 12. +* According to the specification, the PCC OperationRegion begins after +* the PCC signature. The raw shared memory COMD offsets of 4 for generic +* subspaces (types 0-2) and 12 for master subspaces (type 3) therefore +* appear at OperationRegion offsets 0 and 8. */ -#define GENERIC_SUBSPACE_COMMAND (a) (4 == a || a == 5) -#define MASTER_SUBSPACE_COMMAND (a) (12 <= a && a <= 15) +#define GENERIC_SUBSPACE_COMMAND (a) (0 == a || a == 1) +#define MASTER_SUBSPACE_COMMAND (a) (8 <= a && a <= 11)/******************************************************************************* *
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 593/1756 perf annotate-data: Resolve type DIEs in the debug file they came from
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 14ca0a28de37849afdda6ffd4c9047f58d8906c2 ]
'perf report -s type' hangs burning CPU on the dwz compressed debug info of libz.so.1 (zlib-ng): die_collect_vars() saves the dwarf_dieoffset() of the type DIE, which is relative to the file it lives in - the dwz alt file for the types shared by more than one CU - and update_var_state() resolves that offset in the main debug file, parsing whatever is at it, here a typedef whose DW_AT_type refers to itself.
Record whether the type DIE came from the alt file and resolve the offset with die_get_type_die() in that file, with no fallback.
--- tools/perf/util/annotate-data.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
tools/perf/util/annotate-data.c +15 -6
@@ -591,6 +591,8 @@ struct global_var_entry {u64 start;u64 end;u64 die_offset; +int die_tag; +bool from_alt;/* die_offset is relative to the alt (dwz) file */ };static int global_var_cmp (const void *_key,const struct rb_node *node)
@@ -628,7 +630,7 @@ static struct global_var_entry *global_var__find(struct data_loc_info *dloc, u64 }static bool global_var__add (struct data_loc_info *dloc,u64 addr, -const char *name,Dwarf_Die *type_die) +const char *name,Dwarf_Die *type_die,bool from_alt) {struct dso *dso =map__dso (dloc->ms->map);struct global_var_entry *gvar;
@@ -650,6 +652,8 @@ static bool global_var__add(struct data_loc_info *dloc, u64 addr, gvar->start = addr; gvar->end = addr + size; gvar->die_offset =dwarf_dieoffset (type_die); + gvar->die_tag =dwarf_tag (type_die); + gvar->from_alt = from_alt;rb_add (&gvar->node,dso__global_vars (dso), global_var_less);return true;
@@ -724,7 +728,8 @@ static void global_var__collect(struct data_loc_info *dloc)if (pos->reg !=-1 )continue ; -if (!dwarf_offdie (dwarf, pos->die_off, &type_die)) +if (!die_get_type_die (dwarf, pos->die_off, pos->die_tag, + pos->from_alt, &type_die))continue ; if (!get_global_var_info(dloc, pos->addr, &var_name,
@@ -734,7 +739,8 @@ static void global_var__collect(struct data_loc_info *dloc)if (var_offset !=0 )continue ; -global_var__add (dloc, pos->addr, var_name, &type_die); +global_var__add (dloc, pos->addr, var_name, &type_die, + pos->from_alt); }delete_var_types (var_types);
@@ -759,7 +765,8 @@ bool get_global_var_type(Dwarf_Die *cu_die, struct data_loc_info *dloc, gvar =global_var__find (dloc, var_addr);if (gvar) { -if (!dwarf_offdie (dloc->di->dbg, gvar->die_offset, type_die)) +if (!die_get_type_die (dloc->di->dbg, gvar->die_offset, + gvar->die_tag, gvar->from_alt, type_die))return false; *var_offset = var_addr - gvar->start;
@@ -790,7 +797,8 @@ bool get_global_var_type(Dwarf_Die *cu_die, struct data_loc_info *dloc, ok:/* The address should point to the start of the variable */ -global_var__add (dloc, var_addr - *var_offset, var_name, type_die); +global_var__add (dloc, var_addr - *var_offset, var_name, type_die, + !die_same_file (cu_die, type_die));return true; }
@@ -827,7 +835,8 @@ static void update_var_state(struct type_state *state, struct data_loc_info *dloif (var->addr != addr)continue ;/* Get the type DIE using the offset */ -if (!dwarf_offdie (dloc->di->dbg, var->die_off, &mem_die)) +if (!die_get_type_die (dloc->di->dbg, var->die_off, + var->die_tag, var->from_alt, &mem_die))continue ;if (var->reg ==DWARF_REG_FB || var->reg == fbreg) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 594/1756 ACPI: PCC: Simplify PCC shared memory region handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 8960c45a0f41399770d408921180231395604e2f ]
The PCC driver now handles mapping and unmapping of shared memory areas as part of pcc_mbox_{request,free}_channel(). Without these before, this ACPI PCC opregion driver did handling of those mappings like several other PCC mailbox client drivers.
There were redundant operations, leading to unnecessary code. Maintaining the consistency across these driver was harder due to scattered handling of shmem.
Just use the mapped shmem and remove all redundant operations from this driver.
Stable-dep-of: 46c263c21387 ("ACPI: PCC: Preserve shared memory signature in OpRegion handler")
--- drivers/acpi/acpi_pcc.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/acpi/acpi_pcc.c +2 -11
@@ -31,7 +31,6 @@struct pcc_data {struct pcc_mbox_chan *pcc_chan; -void __iomem *pcc_comm_addr;struct completion done;struct mbox_client cl;struct acpi_pcc_info ctx;
@@ -81,14 +80,6 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, ret =AE_SUPPORT ; goto err_free_channel; } - data->pcc_comm_addr =acpi_os_ioremap (pcc_chan->shmem_base_addr, - pcc_chan->shmem_size); -if (!data->pcc_comm_addr) { -pr_err ("Failed to ioremap PCC comm region mem for %d\n" , - ctx->subspace_id); - ret =AE_NO_MEMORY ; - goto err_free_channel; - } *region_context = data;return AE_OK ;
@@ -113,7 +104,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,reinit_completion (&data->done);/* Write to Shared Memory */ -memcpy_toio (data->pcc_comm_addr, (void *)value, data->ctx.length); +memcpy_toio (data->pcc_chan->shmem, (void *)value, data->ctx.length); ret =mbox_send_message (data->pcc_chan->mchan,NULL );if (ret <0 )
@@ -134,7 +125,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,mbox_chan_txdone (data->pcc_chan->mchan, ret); -memcpy_fromio (value, data->pcc_comm_addr, data->ctx.length); +memcpy_fromio (value, data->pcc_chan->shmem, data->ctx.length);return AE_OK ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 595/1756 ACPI: PCC: Preserve shared memory signature in OpRegion handler
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 46c263c213876bdc2297ef61aa90f0b210ebac73 ]
ACPI 6.3 introduced PCC OperationRegions. Section 5.5.2.4.7.3, "Declaring message fields within a PCC OperationRegion", states that, for all PCC subspace types, the PCC Operation Region pertains to the region of PCC subspace that succeeds the PCC signature. Its length therefore excludes the 4-byte signature.
The PCC address space handler currently copies the OperationRegion buffer to and from the start of the shared memory. This overwrites or exposes the platform-populated signature and omits the final four bytes of the OperationRegion.
Offset the copies by the size of the signature and reject an OperationRegion that does not fit in the remaining shared memory.
The example added by commit 77e2a04745ff ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") incorrectly included the signature as an OperationRegion field. A Type 3 OperationRegion containing a 100-byte communication area is declared as follows:
OperationRegion (PFRM, PCC, 2, 0x70)
Field (PFRM, ByteAcc, NoLock, Preserve)
{
FLGS, 32,
LEN, 32,
CMD, 32,
DATA, 800
}This contains three 32-bit fields followed by a 100-byte DATA field. The fields correspond to the Type 3 shared memory layout in ACPI 6.3, Table 14-372, after excluding its 4-byte signature.
--- drivers/acpi/acpi_pcc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/acpi/acpi_pcc.c +16 -4
@@ -28,6 +28,7 @@* to PCC commands */ #define PCC_CMD_WAIT_RETRIES_NUM 500ULL +#define PCC_SIGNATURE_SIZE sizeof(u32)struct pcc_data {struct pcc_mbox_chan *pcc_chan;
@@ -74,6 +75,14 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, } pcc_chan = data->pcc_chan; +if (pcc_chan->shmem_size <PCC_SIGNATURE_SIZE || + ctx->length > pcc_chan->shmem_size -PCC_SIGNATURE_SIZE ) { +pr_err ("PCC channel-%d shared memory is too small.\n" , + ctx->subspace_id); + ret =AE_AML_REGION_LIMIT ; + goto err_free_channel; + } +if (!pcc_chan->mchan->mbox->txdone_irq) {pr_err ("This channel-%d does not support interrupt.\n" , ctx->subspace_id);
@@ -97,14 +106,17 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr, u32 bits, acpi_integer *value, void *handler_context, void *region_context) { - int ret; struct pcc_data *data = region_context; +void __iomem *pcc_opregion;u64 usecs_lat; +int ret; + + pcc_opregion = data->pcc_chan->shmem +PCC_SIGNATURE_SIZE ;reinit_completion (&data->done); -/* Write to Shared Memory */ -memcpy_toio (data->pcc_chan->shmem, (void *)value, data->ctx.length); +/* Write to the PCC OperationRegion after the shared memory signature. */ +memcpy_toio (pcc_opregion, (void *)value, data->ctx.length); ret =mbox_send_message (data->pcc_chan->mchan,NULL );if (ret <0 )
@@ -125,7 +137,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,mbox_chan_txdone (data->pcc_chan->mchan, ret); -memcpy_fromio (value, data->pcc_chan->shmem, data->ctx.length); +memcpy_fromio (value, pcc_opregion, data->ctx.length);return AE_OK ; }
Signature · 1 line
2.53.0