cifsd: fix reference count decrement of unclaimed file in __ksmbd_lookup_fd
authorHyunchul Lee <hyc.lee@gmail.com>
Tue, 13 Apr 2021 04:24:43 +0000 (13:24 +0900)
committerSteve French <stfrench@microsoft.com>
Tue, 11 May 2021 00:15:41 +0000 (19:15 -0500)
commit24b626967d9574a477acf2ab94f55c847d04939a
treeeab673c3974b22041960fbc68dd354878fb7e222
parent3c20378325c710e7257b22ba333310771be51192
cifsd: fix reference count decrement of unclaimed file in __ksmbd_lookup_fd

__ksmbd_lookup_fd could decrement the reference count of
unclaimed ksmbd_file to 0 but not release this ksmbd_file.

ksmbd_file cannot be unclaimed except ksmbd_close_inode_fds(),
because ksmbd_file is only removed from the m_fp_list list
after the reference count of ksmbd_file becomes 0. And if the
count is 0, __ksmbd_lookup_fd does not use ksmbd_file found
from idr due to atomic_inc_not_zero.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifsd/smb2pdu.c
fs/cifsd/vfs_cache.c