Commit e204ead3 authored by Shang XiaoJing's avatar Shang XiaoJing Committed by David S. Miller

nfc: nfcmrvl: Fix potential memory leak in nfcmrvl_i2c_nci_send()

nfcmrvl_i2c_nci_send() will be called by nfcmrvl_nci_send(), and skb
should be freed in nfcmrvl_i2c_nci_send(). However, nfcmrvl_nci_send()
won't free the skb when it failed for the test_bit(). Free the skb when
test_bit() failed.

Fixes: b5b3e23e ("NFC: nfcmrvl: add i2c driver")
Signed-off-by: default avatarShang XiaoJing <shangxiaojing@huawei.com>
Suggested-by: default avatarPavel Machek <pavel@denx.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7cef6b73
...@@ -112,8 +112,10 @@ static int nfcmrvl_i2c_nci_send(struct nfcmrvl_private *priv, ...@@ -112,8 +112,10 @@ static int nfcmrvl_i2c_nci_send(struct nfcmrvl_private *priv,
struct nfcmrvl_i2c_drv_data *drv_data = priv->drv_data; struct nfcmrvl_i2c_drv_data *drv_data = priv->drv_data;
int ret; int ret;
if (test_bit(NFCMRVL_PHY_ERROR, &priv->flags)) if (test_bit(NFCMRVL_PHY_ERROR, &priv->flags)) {
kfree_skb(skb);
return -EREMOTEIO; return -EREMOTEIO;
}
ret = i2c_master_send(drv_data->i2c, skb->data, skb->len); ret = i2c_master_send(drv_data->i2c, skb->data, skb->len);
......
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