mt76: usb: fix possible memory leak in mt76u_buf_free
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Sun, 10 Feb 2019 21:49:14 +0000 (22:49 +0100)
committerFelix Fietkau <nbd@nbd.name>
Mon, 18 Feb 2019 18:55:50 +0000 (19:55 +0100)
commitcb83585e1121bd6d6c039cf09fa32380bf8b6258
treee5b99c17950e303e3a26a7ad1fafb045befb86c0
parentbdba48d57a5509a6531e162394f157250d893aaf
mt76: usb: fix possible memory leak in mt76u_buf_free

Move q->ndesc initialization before the for loop in mt76u_alloc_rx
since otherwise allocated urbs will not be freed in mt76u_buf_free
Double-check scatterlist pointer in mt76u_buf_free

Fixes: b40b15e1521f ("mt76: add usb support to mt76 layer")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/usb.c