Skip to content

Commit

Permalink
NFC: st21nfca: fix double free
Browse files Browse the repository at this point in the history
The variable nfcid_skb is not changed in the callee nfc_hci_get_param()
if error occurs. Consequently, the freed variable nfcid_skb will be
freed again, resulting in a double free bug. Set nfcid_skb to NULL after
releasing it to fix the bug.

Signed-off-by: Pan Bian <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
SinkFinder authored and davem330 committed Nov 7, 2019
1 parent 648db05 commit 99a8efb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/nfc/st21nfca/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ static int st21nfca_hci_complete_target_discovered(struct nfc_hci_dev *hdev,
NFC_PROTO_FELICA_MASK;
} else {
kfree_skb(nfcid_skb);
nfcid_skb = NULL;
/* P2P in type A */
r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_F_GATE,
ST21NFCA_RF_READER_F_NFCID1,
Expand Down

0 comments on commit 99a8efb

Please sign in to comment.