Hi! > From: Shang XiaoJing <shangxiaojing@xxxxxxxxxx> > > [ Upstream commit 3a146b7e3099dc7cf3114f627d9b79291e2d2203 ] > > s3fwrn5_nci_send() will call s3fwrn5_i2c_write() or s3fwrn82_uart_write(), > and free the skb if write() failed. However, even if the write() run > succeeds, the skb will not be freed in write(). As the result, the skb > will memleak. s3fwrn5_nci_send() should also free the skb when write() > succeeds. There are more error returns in that function that do not free anything. Do they need to be fixed, too? Same goes for "nfc: nxp-nci: Fix potential memory leak in nxp_nci_send()". Best regards, Pavel > +++ b/drivers/nfc/s3fwrn5/core.c > @@ -97,11 +97,15 @@ static int s3fwrn5_nci_send(struct nci_dev *ndev, struct sk_buff *skb) > } > > ret = s3fwrn5_write(info, skb); > - if (ret < 0) > + if (ret < 0) { > kfree_skb(skb); > + mutex_unlock(&info->mutex); > + return ret; > + } > > + consume_skb(skb); > mutex_unlock(&info->mutex); > - return ret; > + return 0; > } > > static int s3fwrn5_nci_post_setup(struct nci_dev *ndev) -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Attachment:
signature.asc
Description: PGP signature