]> git.baikalelectronics.ru Git - kernel.git/commit
nfc: nfcmrvl: Fix potential memory leak in nfcmrvl_i2c_nci_send()
authorShang XiaoJing <shangxiaojing@huawei.com>
Thu, 27 Oct 2022 14:03:32 +0000 (22:03 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 30 Oct 2022 21:43:26 +0000 (21:43 +0000)
commit86899a14a3af5fd07b27d937098be1e149815cd6
tree358abf6f470edc7dc072ccf4eb9782448606d4d9
parent7e00873e1c47824daf3042e7f9f5402f0843490c
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()
will only free skb when i2c_master_send() return >=0, which means skb
will memleak when i2c_master_send() failed. Free skb no matter whether
i2c_master_send() succeeds.

Fixes: a1db6ddfdf0e ("NFC: nfcmrvl: add i2c driver")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/nfc/nfcmrvl/i2c.c