Commit bdba48d5 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: usb: fix possible NULL pointer dereference in mt76u_mcu_deinit

Fix possible NULL pointer dereference in mt76u_mcu_deinit routine that
can occur if initialization path fails before calling mt76u_mcu_init_rx

Fixes: ee676cd5 ("mt76: add driver code for MT76x2u based devices")
Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 5de4db8f
...@@ -48,9 +48,11 @@ EXPORT_SYMBOL_GPL(mt76u_mcu_init_rx); ...@@ -48,9 +48,11 @@ EXPORT_SYMBOL_GPL(mt76u_mcu_init_rx);
void mt76u_mcu_deinit(struct mt76_dev *dev) void mt76u_mcu_deinit(struct mt76_dev *dev)
{ {
struct mt76_usb *usb = &dev->usb; struct mt76u_buf *buf = &dev->usb.mcu.res;
usb_kill_urb(usb->mcu.res.urb); if (buf->urb) {
mt76u_buf_free(&usb->mcu.res); usb_kill_urb(buf->urb);
mt76u_buf_free(buf);
}
} }
EXPORT_SYMBOL_GPL(mt76u_mcu_deinit); EXPORT_SYMBOL_GPL(mt76u_mcu_deinit);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment