]> git.baikalelectronics.ru Git - kernel.git/commit
USB: serial: mos7720: fix mos_parport refcount imbalance on error path
authorLin Yi <teroincn@163.com>
Wed, 20 Mar 2019 11:04:56 +0000 (19:04 +0800)
committerJohan Hovold <johan@kernel.org>
Wed, 20 Mar 2019 12:58:42 +0000 (13:58 +0100)
commit71158be0cf327b8590fa1242a8adbf37dcc39233
treea4b033d46b7951c04eafd98b4ebe2caa3a37b406
parent1243a85bafb47ff9c307b4c29a6463ac73ad2184
USB: serial: mos7720: fix mos_parport refcount imbalance on error path

The write_parport_reg_nonblock() helper takes a reference to the struct
mos_parport, but failed to release it in a couple of error paths after
allocation failures, leading to a memory leak.

Johan said that move the kref_get() and mos_parport assignment to the
end of urbtrack initialisation is a better way, so move it. and
mos_parport do not used until urbtrack initialisation.

Signed-off-by: Lin Yi <teroincn@163.com>
Fixes: 7e8d093cdbdb ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
Cc: stable <stable@vger.kernel.org> # 2.6.35
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/mos7720.c