* [PATCH v2] dmaengine: qcom: hidma: avoid world-writable channel sysfs files
@ 2026-11-20 10:37 Hungyu Lin
2026-11-20 17:16 ` Frank Li
0 siblings, 1 reply; 2+ messages in thread
From: Hungyu Lin @ 2026-11-20 10:37 UTC (permalink / raw)
To: okaya, vkoul
Cc: Frank.Li, andy.shevchenko, linux-arm-kernel, linux-arm-msm,
dmaengine, linux-kernel, dennylin0707, Frank Li
hidma_mgmt_init_sys() creates the per-channel priority and weight
attributes with S_IRUGO | S_IWUGO, so any local user can write them.
A write stores the new value and calls hidma_mgmt_setup(), which
programs it into the channel's QoS register.
Attributes declared with __ATTR() are checked at build time by
VERIFY_OCTAL_PERMISSIONS(), which rejects world-writable modes. These
two are created at runtime with a mode passed to
create_sysfs_entry_channel(), so the check does not reach them.
Make them writable by the owner only, the 0644 that __ATTR_RW() uses.
Fixes: 7f8f209fd6e0 ("dmaengine: add Qualcomm Technologies HIDMA management driver")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Cc: stable@vger.kernel.org
---
v2: Collect Reviewed-by tag; no code change.
v1: https://lore.kernel.org/all/20261107221500.96825-1-dennylin0707@gmail.com/
drivers/dma/qcom/hidma_mgmt_sys.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/qcom/hidma_mgmt_sys.c b/drivers/dma/qcom/hidma_mgmt_sys.c
index 9672ef9ee8fc..53b991752e80 100644
--- a/drivers/dma/qcom/hidma_mgmt_sys.c
+++ b/drivers/dma/qcom/hidma_mgmt_sys.c
@@ -265,13 +265,13 @@ int hidma_mgmt_init_sys(struct hidma_mgmt_dev *mdev)
/* populate parameters that are per channel */
for (i = 0; i < mdev->dma_channels; i++) {
rc = create_sysfs_entry_channel(mdev, "priority",
- (S_IRUGO | S_IWUGO), i,
+ 0644, i,
mdev->chroots[i]);
if (rc)
return rc;
rc = create_sysfs_entry_channel(mdev, "weight",
- (S_IRUGO | S_IWUGO), i,
+ 0644, i,
mdev->chroots[i]);
if (rc)
return rc;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] dmaengine: qcom: hidma: avoid world-writable channel sysfs files
2026-11-20 10:37 [PATCH v2] dmaengine: qcom: hidma: avoid world-writable channel sysfs files Hungyu Lin
@ 2026-11-20 17:16 ` Frank Li
0 siblings, 0 replies; 2+ messages in thread
From: Frank Li @ 2026-11-20 17:16 UTC (permalink / raw)
To: Hungyu Lin
Cc: okaya, vkoul, Frank.Li, andy.shevchenko, linux-arm-kernel,
linux-arm-msm, dmaengine, linux-kernel, Frank Li
On Fri, Nov 20, 2026 at 10:37:53AM +0000, Hungyu Lin wrote:
> hidma_mgmt_init_sys() creates the per-channel priority and weight
> attributes with S_IRUGO | S_IWUGO, so any local user can write them.
> A write stores the new value and calls hidma_mgmt_setup(), which
> programs it into the channel's QoS register.
>
> Attributes declared with __ATTR() are checked at build time by
> VERIFY_OCTAL_PERMISSIONS(), which rejects world-writable modes. These
> two are created at runtime with a mode passed to
> create_sysfs_entry_channel(), so the check does not reach them.
>
> Make them writable by the owner only, the 0644 that __ATTR_RW() uses.
>
> Fixes: 7f8f209fd6e0 ("dmaengine: add Qualcomm Technologies HIDMA management driver")
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Cc: stable@vger.kernel.org
> ---
> v2: Collect Reviewed-by tag; no code change.
If only collect tags, needn't repost new version. B4 can auto do that when
apply patch. And repost it will cause I have to mark patchwork status twice.
Frank
> v1: https://lore.kernel.org/all/20261107221500.96825-1-dennylin0707@gmail.com/
>
> drivers/dma/qcom/hidma_mgmt_sys.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/qcom/hidma_mgmt_sys.c b/drivers/dma/qcom/hidma_mgmt_sys.c
> index 9672ef9ee8fc..53b991752e80 100644
> --- a/drivers/dma/qcom/hidma_mgmt_sys.c
> +++ b/drivers/dma/qcom/hidma_mgmt_sys.c
> @@ -265,13 +265,13 @@ int hidma_mgmt_init_sys(struct hidma_mgmt_dev *mdev)
> /* populate parameters that are per channel */
> for (i = 0; i < mdev->dma_channels; i++) {
> rc = create_sysfs_entry_channel(mdev, "priority",
> - (S_IRUGO | S_IWUGO), i,
> + 0644, i,
> mdev->chroots[i]);
> if (rc)
> return rc;
>
> rc = create_sysfs_entry_channel(mdev, "weight",
> - (S_IRUGO | S_IWUGO), i,
> + 0644, i,
> mdev->chroots[i]);
> if (rc)
> return rc;
> --
> 2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 17:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 10:37 [PATCH v2] dmaengine: qcom: hidma: avoid world-writable channel sysfs files Hungyu Lin
2026-11-20 17:16 ` Frank Li
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.