linux-uconsole/drivers/net
Pavel Skripkin 6bd3d80d1f can: mcba_usb: fix memory leak in mcba_usb
commit 91c0255717 upstream.

Syzbot reported memory leak in SocketCAN driver for Microchip CAN BUS
Analyzer Tool. The problem was in unfreed usb_coherent.

In mcba_usb_start() 20 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 mcba_usb_start) and this flag cannot be used with
   coherent buffers.

Fail log:
| [ 1354.053291][ T8413] mcba_usb 1-1:0.0 can0: device disconnected
| [ 1367.059384][ T8420] kmemleak: 20 new suspected memory leaks (see /sys/kernel/debug/kmem)

So, all allocated buffers should be freed with usb_free_coherent()
explicitly

NOTE:
The same pattern for allocating and freeing coherent buffers
is used in drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c

Fixes: 51f3baad7d ("can: mcba_usb: Add support for Microchip CAN BUS Analyzer")
Link: https://lore.kernel.org/r/20210609215833.30393-1-paskripkin@gmail.com
Cc: linux-stable <stable@vger.kernel.org>
Reported-and-tested-by: syzbot+57281c762a3922e14dfe@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-23 14:42:50 +02:00
..
appletalk net: appletalk: cops: Fix data race in cops_probe1 2021-06-16 12:01:37 +02:00
arcnet
bonding bonding: init notify_work earlier to avoid uninitialized use 2021-06-16 12:01:36 +02:00
caif net: caif: remove BUG_ON(dev == NULL) in caif_xmit 2021-06-03 09:00:41 +02:00
can can: mcba_usb: fix memory leak in mcba_usb 2021-06-23 14:42:50 +02:00
dsa net: dsa: microchip: enable phy errata workaround on 9567 2021-06-16 12:01:37 +02:00
ethernet net: ethernet: fix potential use-after-free in ec_bhf_remove 2021-06-23 14:42:47 +02:00
fddi FDDI: defxx: Make MMIO the configuration default except for EISA 2021-05-14 09:50:00 +02:00
fjes
hamradio net: hamradio: fix memory leak in mkiss_close 2021-06-23 14:42:46 +02:00
hippi
hyperv hv_netvsc: Reset the RSC count if NVSP_STAT_FAIL in netvsc_receive() 2021-02-17 11:02:26 +01:00
ieee802154 drivers: net: fix memory leak in atusb_probe 2021-04-14 08:42:13 +02:00
ipa net: ipa: memory region array is variable size 2021-06-03 09:00:46 +02:00
ipvlan
mdio net: mdio: octeon: Fix some double free issues 2021-06-03 09:00:47 +02:00
netdevsim netdevsim: dev: Initialize FIB module after debugfs 2021-04-07 15:00:07 +02:00
pcs
phy net: mdiobus: get rid of a BUG_ON() 2021-06-16 12:01:36 +02:00
plip
ppp tty: convert tty_ldisc_ops 'read()' function to take a kernel pointer 2021-03-04 11:37:36 +01:00
slip
team team: protect features update by RCU to avoid deadlock 2021-02-03 23:28:51 +01:00
usb net: cdc_eem: fix tx fixup skb leak 2021-06-23 14:42:47 +02:00
vmxnet3
wan net: lapbether: Prevent racing when checking whether the netif is running 2021-05-14 09:50:29 +02:00
wimax staging: wimax/i2400m: fix byte-order issue 2021-05-11 14:47:16 +02:00
wireguard wireguard: allowedips: free empty intermediate nodes when removing single node 2021-06-10 13:39:24 +02:00
wireless brcmfmac: properly check for bus register errors 2021-06-03 09:00:43 +02:00
xen-netback xen-netback: take a reference to the RX task thread 2021-06-10 13:39:29 +02:00
bareudp.c
dummy.c
eql.c
geneve.c net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb 2021-05-14 09:50:43 +02:00
gtp.c net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending 2021-03-04 11:38:46 +01:00
ifb.c
Kconfig crypto: mips/poly1305 - enable for all MIPS processors 2021-03-17 17:06:10 +01:00
LICENSE.SRC
loopback.c
macsec.c
macvlan.c
macvtap.c
Makefile
mdio.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c net: fix dev_ifsioc_locked() race condition 2021-03-07 12:34:07 +01:00
thunderbolt.c
tun.c net: tun: set tun->dev->addr_len during TUNSETLINK processing 2021-04-14 08:42:13 +02:00
veth.c veth: Store queue_mapping independently of XDP prog presence 2021-03-30 14:31:56 +02:00
virtio_net.c virtio_net: Do not pull payload in skb->head 2021-05-22 11:40:52 +02:00
vrf.c vrf: fix maximum MTU 2021-06-23 14:42:41 +02:00
vsockmon.c
vxlan.c vxlan: do not modify the shared tunnel info when PMTU triggers an ICMP reply 2021-04-14 08:42:06 +02:00
xen-netfront.c