Patch "net:nfc:digital: Fix a double free in digital_tg_recv_dep_req" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net:nfc:digital: Fix a double free in digital_tg_recv_dep_req

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-nfc-digital-fix-a-double-free-in-digital_tg_recv.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b664c98eeb66d2a81b9c48ceec9fd6446f951a33
Author: Lv Yunlong <lyl2019@xxxxxxxxxxxxxxxx>
Date:   Tue Apr 27 09:22:58 2021 -0700

    net:nfc:digital: Fix a double free in digital_tg_recv_dep_req
    
    [ Upstream commit 75258586793efc521e5dd52a5bf6c7a4cf7002be ]
    
    In digital_tg_recv_dep_req, it calls nfc_tm_data_received(..,resp).
    If nfc_tm_data_received() failed, the callee will free the resp via
    kfree_skb() and return error. But in the exit branch, the resp
    will be freed again.
    
    My patch sets resp to NULL if nfc_tm_data_received() failed, to
    avoid the double free.
    
    Fixes: 1c7a4c24fbfd9 ("NFC Digital: Add target NFC-DEP support")
    Signed-off-by: Lv Yunlong <lyl2019@xxxxxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c
index f72be7433df3..46375ff214c0 100644
--- a/net/nfc/digital_dep.c
+++ b/net/nfc/digital_dep.c
@@ -1187,6 +1187,8 @@ static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg,
 	}
 
 	rc = nfc_tm_data_received(ddev->nfc_dev, resp);
+	if (rc)
+		resp = NULL;
 
 exit:
 	kfree_skb(ddev->chaining_skb);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux