Skip to content

nfc: Fix potential memory leak of skb

Shang XiaoJing netdev 1 version Applied

Status from this message: This series was applied to netdev/net.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesApplied 4/4

Patches in v1 All 4 applied

#Subject and filesSizeRepliesApplied
1/4nfc: fdp: Fix potential memory leak in fdp_nci_send()drivers/nfc/fdp/fdp.c+9 -10 repliesApplied
2/4nfc: nxp-nci: Fix potential memory leak in nxp_nci_send()drivers/nfc/nxp-nci/core.c+5 -20 repliesApplied
3/4nfc: s3fwrn5: Fix potential memory leak in s3fwrn5_nci_send()drivers/nfc/s3fwrn5/core.c+6 -20 repliesApplied
4/4nfc: nfcmrvl: Fix potential memory leak in nfcmrvl_i2c_nci_send()drivers/nfc/nfcmrvl/i2c.c+6 -10 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] nfc: Fix potential memory leak of skb

There are 6 kinds of send functions can be called by nci_send_frame():

	virtual_nci_send(),
	fdp_nci_send(),
	nxp_nci_send(),
	s3fwrn5_nci_send(),
	nfcmrvl_nci_send(),
	st_nci_send();

1. virtual_nci_send() will memleak the skb, and has been fixed before.

2. fdp_nci_send() won't free the skb no matter whether write() succeed.

3-4. nxp_nci_send() and s3fwrn5_nci_send() will only free the skb when write() failed, however write() will not free the skb by itself for when succeeds.

5. nfcmrvl_nci_send() will call nfcmrvl_XXX_nci_send(), where some of them will free the skb, but nfcmrvl_i2c_nci_send() only free the skb when i2c_master_send() return >=0, and memleak will happen when i2c_master_send() failed in nfcmrvl_i2c_nci_send().

6. st_nci_send() will queue the skb into other list and finally be freed.

Fix the potential memory leak of skb.

Shang XiaoJing (4):
nfc: fdp: Fix potential memory leak in fdp_nci_send()
nfc: nxp-nci: Fix potential memory leak in nxp_nci_send()
nfc: s3fwrn5: Fix potential memory leak in s3fwrn5_nci_send()
nfc: nfcmrvl: Fix potential memory leak in nfcmrvl_i2c_nci_send()

 drivers/nfc/fdp/fdp.c      | 10 +++++++++-
 drivers/nfc/nfcmrvl/i2c.c  |  7 ++++++-
 drivers/nfc/nxp-nci/core.c |  7 +++++--
 drivers/nfc/s3fwrn5/core.c |  8 ++++++--
 4 files changed, 26 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.1