• Johan Hovold's avatar
    serdev: fix registration of second slave · 668a1285
    Johan Hovold authored
    commit 08fcee289f341786eb3b44e5f2d1dc850943238e upstream.
    
    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: cd6484e1 ("serdev: Introduce new bus for serial attached devices")
    Cc: Rob Herring <robh@kernel.org>
    Signed-off-by: 's avatarJohan Hovold <johan@kernel.org>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    668a1285
Name
Last commit
Last update
..
hvc Loading commit data...
ipwireless Loading commit data...
serdev Loading commit data...
serial Loading commit data...
vt Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
amiserial.c Loading commit data...
bfin_jtag_comm.c Loading commit data...
cyclades.c Loading commit data...
ehv_bytechan.c Loading commit data...
goldfish.c Loading commit data...
isicom.c Loading commit data...
metag_da.c Loading commit data...
mips_ejtag_fdc.c Loading commit data...
moxa.c Loading commit data...
moxa.h Loading commit data...
mxser.c Loading commit data...
mxser.h Loading commit data...
n_gsm.c Loading commit data...
n_hdlc.c Loading commit data...
n_null.c Loading commit data...
n_r3964.c Loading commit data...
n_tracerouter.c Loading commit data...
n_tracesink.c Loading commit data...
n_tracesink.h Loading commit data...
n_tty.c Loading commit data...
nozomi.c Loading commit data...
pty.c Loading commit data...
rocket.c Loading commit data...
rocket.h Loading commit data...
rocket_int.h Loading commit data...
synclink.c Loading commit data...
synclink_gt.c Loading commit data...
synclinkmp.c Loading commit data...
sysrq.c Loading commit data...
tty_audit.c Loading commit data...
tty_baudrate.c Loading commit data...
tty_buffer.c Loading commit data...
tty_io.c Loading commit data...
tty_ioctl.c Loading commit data...
tty_jobctrl.c Loading commit data...
tty_ldisc.c Loading commit data...
tty_ldsem.c Loading commit data...
tty_mutex.c Loading commit data...
tty_port.c Loading commit data...
vcc.c Loading commit data...