From: David S. Miller Date: Sun, 30 Oct 2022 21:43:26 +0000 (+0000) Subject: Merge branch 'nfc-skb-leaks' X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5715a502447b07f067ee5af36465c7c2b813ff38;p=users%2Fjedix%2Flinux-maple.git Merge branch 'nfc-skb-leaks' Shang XiaoJing says: ==================== 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. ==================== Signed-off-by: David S. Miller --- 5715a502447b07f067ee5af36465c7c2b813ff38