]> git.baikalelectronics.ru Git - kernel.git/commit
USB: keyspan: fix NULL-pointer dereferences and memory leaks
authorJohan Hovold <jhovold@gmail.com>
Thu, 25 Oct 2012 08:29:15 +0000 (10:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Oct 2012 16:37:13 +0000 (09:37 -0700)
commit831b1c2e95263aba173e68429b44af3c08d977ae
tree2f5ff17fa309a58dc3745ffb9560ce134bd88f12
parente9cfd628d4ae355c1fd078965fc47c04cdf657cf
USB: keyspan: fix NULL-pointer dereferences and memory leaks

Fix NULL-pointer dereference at release by moving port data allocation
and deallocation to port_probe and port_remove.

Fix NULL-pointer dereference at disconnect by stopping port urbs at
port_remove.

Since commit bcb6fcf1119586a (device-core: Ensure drvdata = NULL when no
driver is bound) the port private data is no longer accessible at
disconnect or release.

Note that this patch also fixes port and interface-data memory leaks in
the error path of attach should port initialisation fail for any port.

Compile-only tested.

Cc: <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/keyspan.c
drivers/usb/serial/keyspan.h