diff options
author | Pavel Skripkin | 2021-07-27 20:00:33 +0300 |
---|---|---|
committer | Marc Kleine-Budde | 2021-07-30 08:47:24 +0200 |
commit | 9969e3c5f40c166e3396acc36c34f9de502929f6 (patch) | |
tree | fd7b7796376cb26b6cff8ea834e6bd335d829e2c /mm | |
parent | 0e865f0c31928d6a313269ef624907eec55287c4 (diff) |
can: ems_usb: fix memory leak
In ems_usb_start() MAX_RX_URBS coherent buffers are allocated and
there is nothing, that frees them:
1) In callback function the urb is resubmitted and that's all
2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER
is not set (see ems_usb_start) and this flag cannot be used with
coherent buffers.
So, all allocated buffers should be freed with usb_free_coherent()
explicitly.
Side note: This code looks like a copy-paste of other can drivers. The
same patch was applied to mcba_usb driver and it works nice with real
hardware. There is no change in functionality, only clean-up code for
coherent buffers.
Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface")
Link: https://lore.kernel.org/r/59aa9fbc9a8cbf9af2bbd2f61a659c480b415800.1627404470.git.paskripkin@gmail.com
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions