]> git.baikalelectronics.ru Git - kernel.git/commit
rsi: fix memory leak on buf and usb_reg_buf
authorColin Ian King <colin.king@canonical.com>
Thu, 16 Nov 2017 17:39:18 +0000 (17:39 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 18 Nov 2017 01:32:41 +0000 (10:32 +0900)
commitd9d6ab03e1951ed4f9e4ad52c3d8766c6ec121d3
treedd3b11543c59e224056177959bc16fe9120f31d9
parent3a991cd47f2a093d7b7f7483933b0f2e95da2548
rsi: fix memory leak on buf and usb_reg_buf

In the cases where len is too long, the error return path fails to
kfree allocated buffers buf and usb_reg_buf.  The simplest fix is to
perform the sanity check on len before the allocations to avoid having
to do the kfree'ing in the first place.

Detected by CoverityScan, CID#1452258,1452259 ("Resource Leak")

Fixes: b6befd708ed4 ("rsi: check length before USB read/write register")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wireless/rsi/rsi_91x_usb.c