diff options
author | Deepak Kumar Singh <quic_deesin@quicinc.com> | 2022-09-19 12:54:00 +0200 |
---|---|---|
committer | Bjorn Andersson <andersson@kernel.org> | 2022-12-28 16:54:03 +0100 |
commit | c23965b7f7d99bbb2604f1f02aa26fb6d1d5864d (patch) | |
tree | c1018d6da20e4c0a4c7e3832000efc2451583b0a /drivers/rtc/rtc-m41t94.c | |
parent | rpmsg: char: Add lock to avoid race when rpmsg device is released (diff) | |
download | linux-c23965b7f7d99bbb2604f1f02aa26fb6d1d5864d.tar.xz linux-c23965b7f7d99bbb2604f1f02aa26fb6d1d5864d.zip |
rpmsg: ctrl: Add lock to rpmsg_ctrldev_remove
Call to rpmsg_ctrldev_ioctl() and rpmsg_ctrldev_remove() must be synchronized.
In present code rpmsg_ctrldev_remove() is not protected with lock, therefore
new char device creation can succeed through rpmsg_ctrldev_ioctl() call. At the
same time call to rpmsg_ctrldev_remove() function for ctrl device removal will
free associated rpdev device. As char device creation already succeeded, user
space is free to issue open() call which maps to rpmsg_create_ept() in kernel.
rpmsg_create_ept() function tries to reference rpdev which has already been
freed through rpmsg_ctrldev_remove(). Issue is predominantly seen in aggressive
reboot tests where rpmsg_ctrldev_ioctl() and rpmsg_ctrldev_remove() can race with
each other.
Adding lock in rpmsg_ctrldev_remove() avoids any new char device creation
through rpmsg_ctrldev_ioctl() while remove call is already in progress.
Signed-off-by: Deepak Kumar Singh <quic_deesin@quicinc.com>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/1663584840-15762-3-git-send-email-quic_deesin@quicinc.com
Diffstat (limited to 'drivers/rtc/rtc-m41t94.c')
0 files changed, 0 insertions, 0 deletions