Commit 9ab000d9 authored by David S. Miller's avatar David S. Miller

Merge branch 'nfc-leaks'

Shang XiaoJing says:

====================
nfc: Fix potential memory leak of skb

There are still somewhere maybe leak the skb, fix the memleaks by adding
fail path.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7cef6b73 60dcb5ff
......@@ -112,8 +112,10 @@ static int nfcmrvl_i2c_nci_send(struct nfcmrvl_private *priv,
struct nfcmrvl_i2c_drv_data *drv_data = priv->drv_data;
int ret;
if (test_bit(NFCMRVL_PHY_ERROR, &priv->flags))
if (test_bit(NFCMRVL_PHY_ERROR, &priv->flags)) {
kfree_skb(skb);
return -EREMOTEIO;
}
ret = i2c_master_send(drv_data->i2c, skb->data, skb->len);
......
......@@ -73,11 +73,15 @@ static int nxp_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
struct nxp_nci_info *info = nci_get_drvdata(ndev);
int r;
if (!info->phy_ops->write)
if (!info->phy_ops->write) {
kfree_skb(skb);
return -EOPNOTSUPP;
}
if (info->mode != NXP_NCI_MODE_NCI)
if (info->mode != NXP_NCI_MODE_NCI) {
kfree_skb(skb);
return -EINVAL;
}
r = info->phy_ops->write(info->phy_id, skb);
if (r < 0) {
......
......@@ -105,6 +105,7 @@ static int s3fwrn5_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
mutex_lock(&info->mutex);
if (s3fwrn5_get_mode(info) != S3FWRN5_MODE_NCI) {
kfree_skb(skb);
mutex_unlock(&info->mutex);
return -EINVAL;
}
......
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