nfc/nci: fix race with opening and closing
stable inclusion from stable-v5.10.157 commit 398a860a44297245ed4cb7ff59b37fef89c379f8 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7MU59 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=398a860a44297245ed4cb7ff59b37fef89c379f8 -------------------------------- [ 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:<syzbot+43475bf3cfbd6e41f5b7@syzkaller.appspotmail.com> Fixes: 48b71a9e ("NFC: add NCI_UNREG flag to eliminate the race") Signed-off-by:
Lin Ma <linma@zju.edu.cn> Signed-off-by:
David S. Miller <davem@davemloft.net> Signed-off-by:
Sasha Levin <sashal@kernel.org> Signed-off-by:
sanglipeng <sanglipeng1@jd.com>
Loading
Please sign in to comment