mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
nfc: nxp-nci: Fix potential memory leak in nxp_nci_send()
nxp_nci_send() will call nxp_nci_i2c_write(), and only free skb when
nxp_nci_i2c_write() failed. However, even if the nxp_nci_i2c_write()
run succeeds, the skb will not be freed in nxp_nci_i2c_write(). As the
result, the skb will memleak. nxp_nci_send() should also free the skb
when nxp_nci_i2c_write() succeeds.
Fixes: dece45855a
("NFC: nxp-nci: Add support for NXP NCI chips")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8e4aae6b8c
commit
7bf1ed6aff
1 changed files with 5 additions and 2 deletions
|
@ -80,10 +80,13 @@ static int nxp_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
r = info->phy_ops->write(info->phy_id, skb);
|
r = info->phy_ops->write(info->phy_id, skb);
|
||||||
if (r < 0)
|
if (r < 0) {
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
consume_skb(skb);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nxp_nci_rf_pll_unlocked_ntf(struct nci_dev *ndev,
|
static int nxp_nci_rf_pll_unlocked_ntf(struct nci_dev *ndev,
|
||||||
|
|
Loading…
Reference in a new issue