qtnfmac: fix resource leaks on unsupported iftype error return path
authorColin Ian King <colin.king@canonical.com>
Fri, 25 Sep 2020 13:22:24 +0000 (14:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:07:06 +0000 (09:07 +0100)
[ Upstream commit 63f6982075d890d7563e2469643f05a37d193f01 ]

Currently if an unsupported iftype is detected the error return path
does not free the cmd_skb leading to a resource leak. Fix this by
free'ing cmd_skb.

Addresses-Coverity: ("Resource leak")
Fixes: 805b28c05c8e ("qtnfmac: prepare for AP_VLAN interface type support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200925132224.21638-1-colin.king@canonical.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/quantenna/qtnfmac/commands.c

index ed087bbc6f6313bd34f9d00d2a84e79694698f0e..f37fda2238accc76ad4b819fbfc217b5553fdbf7 100644 (file)
@@ -796,6 +796,7 @@ int qtnf_cmd_send_del_intf(struct qtnf_vif *vif)
        default:
                pr_warn("VIF%u.%u: unsupported iftype %d\n", vif->mac->macid,
                        vif->vifid, vif->wdev.iftype);
+               dev_kfree_skb(cmd_skb);
                ret = -EINVAL;
                goto out;
        }
@@ -1882,6 +1883,7 @@ int qtnf_cmd_send_change_sta(struct qtnf_vif *vif, const u8 *mac,
                break;
        default:
                pr_err("unsupported iftype %d\n", vif->wdev.iftype);
+               dev_kfree_skb(cmd_skb);
                ret = -EINVAL;
                goto out;
        }