android_kernel_samsung_sm8650/fs/smb
Namjae Jeon 0090f0bfc2 ksmbd: fix race condition from parallel smb2 lock requests
[ Upstream commit 75ac9a3dd65f7eab4d12b0a0f744234b5300a491 ]

There is a race condition issue between parallel smb2 lock request.

                                            Time
                                             +
Thread A                                     | Thread A
smb2_lock                                    | smb2_lock
                                             |
 insert smb_lock to lock_list                |
 spin_unlock(&work->conn->llist_lock)        |
                                             |
                                             |   spin_lock(&conn->llist_lock);
                                             |   kfree(cmp_lock);
                                             |
 // UAF!                                     |
 list_add(&smb_lock->llist, &rollback_list)  +

This patch swaps the line for adding the smb lock to the rollback list and
adding the lock list of connection to fix the race issue.

Reported-by: luosili <rootlab@huawei.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-05 15:18:33 +01:00
..
client smb: client: fix OOB in smbCalcSize() 2024-01-01 12:39:05 +00:00
common ksmbd: fix wrong name of SMB2_CREATE_ALLOCATION_SIZE 2023-12-20 17:00:21 +01:00
server ksmbd: fix race condition from parallel smb2 lock requests 2024-01-05 15:18:33 +01:00
Kconfig
Makefile