summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/wm831x-ldo.c
diff options
context:
space:
mode:
authorArnaud Pouliquen <arnaud.pouliquen@foss.st.com>2022-01-04 17:35:45 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-26 14:50:26 +0100
commitdb7f19c0aa0abcb751ff0ed694a071363f702b1d (patch)
treef8c2fc5ca568e8c7ddd325c9d913b961ae89de68 /drivers/regulator/wm831x-ldo.c
parenttty: Partially revert the removal of the Cyclades public API (diff)
downloadlinux-db7f19c0aa0abcb751ff0ed694a071363f702b1d.tar.xz
linux-db7f19c0aa0abcb751ff0ed694a071363f702b1d.zip
tty: rpmsg: Fix race condition releasing tty port
The tty_port struct is part of the rpmsg_tty_port structure. The issue is that the rpmsg_tty_port structure is freed on rpmsg_tty_remove while it is still referenced in the tty_struct. Its release is not predictable due to workqueues. For instance following ftrace shows that rpmsg_tty_close is called after rpmsg_tty_release_cport: nr_test.sh-389 [000] ..... 212.093752: rpmsg_tty_remove <-rpmsg_dev_ remove cat-1191 [001] ..... 212.095697: tty_release <-__fput nr_test.sh-389 [000] ..... 212.099166: rpmsg_tty_release_cport <-rpm sg_tty_remove cat-1191 [001] ..... 212.115352: rpmsg_tty_close <-tty_release cat-1191 [001] ..... 212.115371: release_tty <-tty_release_str As consequence, the port must be free only when user has released the TTY interface. This path : - Introduce the .destruct port tty ops function to release the allocated rpmsg_tty_port structure. - Introduce the .hangup tty ops function to call tty_port_hangup. - Manages the tty port refcounting to trig the .destruct port ops, - Introduces the rpmsg_tty_cleanup function to ensure that the TTY is removed before decreasing the port refcount. Fixes: 7c0408d80579 ("tty: add rpmsg driver") Cc: stable <stable@vger.kernel.org> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Link: https://lore.kernel.org/r/20220104163545.34710-1-arnaud.pouliquen@foss.st.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/regulator/wm831x-ldo.c')
0 files changed, 0 insertions, 0 deletions