diff options
| author | Yu Zhang <yuz08559@gmail.com> | 2026-10-31 19:06:50 +1000 |
|---|---|---|
| committer | Mathieu Poirier <mathieu.poirier@linaro.org> | 2026-11-05 10:52:21 -0600 |
| commit | 2334150bcdc61a89594c44c9a52302f939151a5c (patch) | |
| tree | 5280710e627e9fc76a9cd0f5c48c5bded35b0beb /scripts/Makefile.thinlto | |
| parent | 39906a171f91c862d7de436bcf9b83a0c9bd89f6 (diff) | |
| download | linux-next-2334150bcdc61a89594c44c9a52302f939151a5c.tar.gz linux-next-2334150bcdc61a89594c44c9a52302f939151a5c.zip | |
rpmsg: char: take ept_lock in the SET_INCOMING_FLOWCONTROL ioctl
rpmsg_eptdev_ioctl() handles RPMSG_SET_INCOMING_FLOWCONTROL by calling
rpmsg_set_flow_control(eptdev->ept, ...) without holding eptdev->ept_lock
and without checking eptdev->ept for NULL. rpmsg_set_flow_control()
dereferences ept->ops, so this is the only eptdev->ept user that does not
honour the ept_lock discipline.
eptdev->ept is torn down under ept_lock: rpmsg_chrdev_eptdev_destroy()
(reached via RPMSG_DESTROY_EPT_IOCTL on a second fd, or when the rpmsg
device is removed) and rpmsg_eptdev_release() both do
mutex_lock(&eptdev->ept_lock);
rpmsg_destroy_ept(eptdev->ept);
eptdev->ept = NULL;
mutex_unlock(&eptdev->ept_lock);
and rpmsg_destroy_ept() drops the endpoint's last reference and frees it.
A SET_INCOMING_FLOWCONTROL ioctl running concurrently can therefore read
eptdev->ept just as it is freed and dereference ept->ops -> use-after-free
(or a NULL dereference once ept has been cleared).
Fixes: 5550201c0fe2 ("rpmsg: char: Add RPMSG GET/SET FLOWCONTROL IOCTL support")
Cc: stable@vger.kernel.org
Signed-off-by: Yu Zhang <yuz08559@gmail.com>
Link: https://lore.kernel.org/r/20261031090650.23701-1-yuz08559@gmail.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
