Skip to content

Commit

Permalink
mt76: mt76u: add missing release on skb in __mt76x02u_mcu_send_msg
Browse files Browse the repository at this point in the history
In the implementation of __mt76x02u_mcu_send_msg() the skb is consumed
all execution paths except one. Release skb before returning if
test_bit() fails.

Signed-off-by: Navid Emamdoost <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
Navidem authored and nbd168 committed Jul 21, 2020
1 parent 2bccc84 commit 5648d1c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
u32 info;
int ret;

if (test_bit(MT76_REMOVED, &dev->phy.state))
return 0;
if (test_bit(MT76_REMOVED, &dev->phy.state)) {
ret = 0;
goto out;
}

if (wait_resp) {
seq = ++dev->mcu.msg_seq & 0xf;
Expand All @@ -111,6 +113,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
if (wait_resp)
ret = mt76x02u_mcu_wait_resp(dev, seq);

out:
consume_skb(skb);

return ret;
Expand Down

0 comments on commit 5648d1c

Please sign in to comment.