Patch "nfc/nci: fix race with opening and closing" has been added to the 5.10-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

    nfc/nci: fix race with opening and closing

to the 5.10-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:
     nfc-nci-fix-race-with-opening-and-closing.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 4bf8bd86d4d9a93c6d32ab49a6f0782ff7314232
Author: Lin Ma <linma@xxxxxxxxxx>
Date:   Wed Nov 16 21:02:49 2022 +0800

    nfc/nci: fix race with opening and closing
    
    [ Upstream commit 0ad6bded175e829c2ca261529c9dce39a32a042d ]
    
    Previously we leverage NCI_UNREG and the lock inside nci_close_device to
    prevent the race condition between opening a device and closing a
    device. However, it still has problem because a failed opening command
    will erase the NCI_UNREG flag and allow another opening command to
    bypass the status checking.
    
    This fix corrects that by making sure the NCI_UNREG is held.
    
    Reported-by: syzbot+43475bf3cfbd6e41f5b7@xxxxxxxxxxxxxxxxxxxxxxxxx
    Fixes: 48b71a9e66c2 ("NFC: add NCI_UNREG flag to eliminate the race")
    Signed-off-by: Lin Ma <linma@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 2cfff70f70e0..ed9019d807c7 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -530,7 +530,7 @@ static int nci_open_device(struct nci_dev *ndev)
 		skb_queue_purge(&ndev->tx_q);
 
 		ndev->ops->close(ndev);
-		ndev->flags = 0;
+		ndev->flags &= BIT(NCI_UNREG);
 	}
 
 done:



[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