From: sashiko-bot@kernel.org
To: "Hungyu Lin" <dennylin0707@gmail.com>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH] dmaengine: qcom: hidma: avoid world-writable channel sysfs files
Date: Sat, 07 Nov 2026 22:19:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-203364@kernel.org> (raw)
In-Reply-To: <20261107221500.96825-1-dennylin0707@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] dmaengine: qcom: hidma_mgmt: kobject leak and UAF in
hidma_mgmt_init_sys() [1]
--
commit 44ad6eea44504d623e4ff527b7da4680661c450d
Author: Hungyu Lin <dennylin0707@gmail.com>
dmaengine: qcom: hidma: avoid world-writable channel sysfs files
This commit restricts the per-channel priority and weight sysfs attributes
in hidma_mgmt_init_sys() from world-writable (S_IRUGO | S_IWUGO) to 0644.
> diff --git a/drivers/dma/qcom/hidma_mgmt_sys.c b/drivers/dma/qcom/hidma_mgmt_sys.c
> index 9672ef9ee8fc0..53b991752e805 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;
[Severity: Critical]
This problem wasn't introduced by this patch, but does hidma_mgmt_init_sys()
leak kobjects and leave dangling sysfs attributes on failure or driver
unbind [1]?
If any step in hidma_mgmt_init_sys() fails, it returns without calling
kobject_put() on chanops or mdev->chroots[i] or removing previously created
sysfs files, and hidma_mgmt_driver has no .remove callback to clean them up
on unbind either. Because the attribute structs, names, and mdev itself are
allocated with devm_kmalloc(), devres frees them on probe failure or device
unbind while the sysfs files remain exposed, causing a use-after-free when
userspace reads or writes those attributes.
[1] https://sashiko.dev/#/bug/linux-68f0e3d9-2e4a-4922-9d34-c92a40fad2aa
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261107221500.96825-1-dennylin0707@gmail.com?part=1
prev parent reply other threads:[~2026-11-07 22:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 22:15 [PATCH] dmaengine: qcom: hidma: avoid world-writable channel sysfs files Hungyu Lin
2026-11-07 22:19 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-203364@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dennylin0707@gmail.com \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.