qtnfmac: fix firmware command error path
authorDmitry Lebed <dlebed@quantenna.com>
Tue, 29 May 2018 12:00:02 +0000 (15:00 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 30 May 2018 19:20:06 +0000 (22:20 +0300)
Free command skb if bus state is not QTNF_FW_STATE_ACTIVE.

Signed-off-by: Dmitry Lebed <dlebed@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/quantenna/qtnfmac/commands.c
drivers/net/wireless/quantenna/qtnfmac/trans.c

index 9dc4560be5d84059380a8353c1924ae3b846d9a9..e2fc57be1cdd3961e6643c8131c306e7092576f7 100644 (file)
@@ -102,6 +102,7 @@ static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus,
                pr_warn("VIF%u.%u: drop cmd 0x%.4X in fw state %d\n",
                        mac_id, vif_id, le16_to_cpu(cmd->cmd_id),
                        bus->fw_state);
+               dev_kfree_skb(cmd_skb);
                return -ENODEV;
        }
 
index ccddfebc508abdee03eddc33a63b66aee4fe10a3..345f34ec9750f0fa28752179d28be2eda8151136 100644 (file)
@@ -35,8 +35,10 @@ int qtnf_trans_send_cmd_with_resp(struct qtnf_bus *bus, struct sk_buff *cmd_skb,
        bool resp_not_handled = true;
        struct sk_buff *resp_skb = NULL;
 
-       if (unlikely(!response_skb))
+       if (unlikely(!response_skb)) {
+               dev_kfree_skb(cmd_skb);
                return -EFAULT;
+       }
 
        spin_lock(&ctl_node->resp_lock);
        ctl_node->seq_num++;