diff options
author | Johan Hovold <johan@kernel.org> | 2017-10-10 19:09:49 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-23 12:25:33 +0300 |
commit | 08fcee289f341786eb3b44e5f2d1dc850943238e (patch) | |
tree | 12079fbb97bc680d770fe21ef7bebfb74bb92416 /drivers/tty/tty_baudrate.c | |
parent | 7c63838ea5afb15a60c58a2f0fe8ac093fc9f1a5 (diff) | |
download | linux-08fcee289f341786eb3b44e5f2d1dc850943238e.tar.xz |
serdev: fix registration of second slave
Serdev currently only supports a single slave device, but the required
sanity checks to prevent further registration attempts were missing.
If a serial-port node has two child nodes with compatible properties,
the OF code would try to register two slave devices using the same id
and name. Driver core will not allow this (and there will be loud
complaints), but the controller's slave pointer would already have been
set to address of the soon to be deallocated second struct
serdev_device. As the first slave device remains registered, this can
lead to later use-after-free issues when the slave callbacks are
accessed.
Note that while the serdev registration helpers are exported, they are
typically only called by serdev core. Any other (out-of-tree) callers
must serialise registration and deregistration themselves.
Fixes: cd6484e1830b ("serdev: Introduce new bus for serial attached devices")
Cc: stable <stable@vger.kernel.org> # 4.11
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_baudrate.c')
0 files changed, 0 insertions, 0 deletions