diff options
| author | Raghavendra Rao Ananta <rananta@codeaurora.org> | 2020-04-27 20:26:01 -0700 |
|---|---|---|
| committer | Sasha Levin <sashal@kernel.org> | 2020-06-29 20:07:50 -0400 |
| commit | ba3badce3e0581ad6bb726f6a586625c622ec6c5 (patch) | |
| tree | 467d59564cfa54438e42aad3854edbea023ce481 /drivers/base/platform.c | |
| parent | 4e22955825919d871f5d70bbbfe6f50dc89550a8 (diff) | |
tty: hvc: Fix data abort due to race in hvc_open
[ Upstream commit e2bd1dcbe1aa34ff5570b3427c530e4332ecf0fe ]
Potentially, hvc_open() can be called in parallel when two tasks calls
open() on /dev/hvcX. In such a scenario, if the hp->ops->notifier_add()
callback in the function fails, where it sets the tty->driver_data to
NULL, the parallel hvc_open() can see this NULL and cause a memory abort.
Hence, serialize hvc_open and check if tty->private_data is NULL before
proceeding ahead.
The issue can be easily reproduced by launching two tasks simultaneously
that does nothing but open() and close() on /dev/hvcX.
For example:
$ ./simple_open_close /dev/hvc0 & ./simple_open_close /dev/hvc0 &
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
Link: https://lore.kernel.org/r/20200428032601.22127-1-rananta@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/base/platform.c')
0 files changed, 0 insertions, 0 deletions
