Skip to content
Commit 97ca66a0 authored by Lin Ma's avatar Lin Ma Committed by Greg Kroah-Hartman
Browse files

nfc/nci: fix race with opening and closing

[ Upstream commit 0ad6bded

 ]

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: default avatar <syzbot+43475bf3cfbd6e41f5b7@syzkaller.appspotmail.com>
Fixes: 48b71a9e

 ("NFC: add NCI_UNREG flag to eliminate the race")
Signed-off-by: default avatarLin Ma <linma@zju.edu.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 0ba41180
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment