]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nfc: pn533: Fix double free when pn533_fill_fragment_skbs() fails
authorChengfeng Ye <cyeaa@connect.ust.hk>
Fri, 5 Nov 2021 13:36:36 +0000 (06:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 10:36:16 +0000 (11:36 +0100)
commit2c5a51f91f970b824970d0f127e0ff0bd14427e9
treef39568246f83b22d8f04ea657d24a975886e5c13
parent0c727425668ddc43bcf1a19c77bad215de966e65
nfc: pn533: Fix double free when pn533_fill_fragment_skbs() fails

[ Upstream commit 9fec40f850658e00a14a7dd9e06f7fbc7e59cc4a ]

skb is already freed by dev_kfree_skb in pn533_fill_fragment_skbs,
but follow error handler branch when pn533_fill_fragment_skbs()
fails, skb is freed again, results in double free issue. Fix this
by not free skb in error path of pn533_fill_fragment_skbs.

Fixes: 963a82e07d4e ("NFC: pn533: Split large Tx frames in chunks")
Fixes: 93ad42020c2d ("NFC: pn533: Target mode Tx fragmentation support")
Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nfc/pn533/pn533.c