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>
Thu, 18 Nov 2021 18:17:10 +0000 (19:17 +0100)
commit2d2dfc33ef4437fe0823ad666e51bf0eeea4a926
tree6a3f02f9ee6e7924dab577a4558d173b837646d9
parent72fb40d87c59229e465fdf0c3d63481e1f6189d8
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