mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
filelock: Correct the filelock owner in fcntl_setlk/fcntl_setlk64
The locks_remove_posix() function in fcntl_setlk/fcntl_setlk64 is designed to reliably remove locks when an fcntl/close race is detected. However, it was passing in the wrong filelock owner, it looks like a mistake and resulting in a failure to remove locks. More critically, if the lock removal fails, it could lead to a uaf issue while traversing the locks. This problem occurs only in the 4.19/5.4 stable version. Fixes: a561145f3ae9 ("filelock: Fix fcntl/close race recovery compat path") Fixes: d30ff3304083 ("filelock: Remove locks reliably when fcntl/close race is detected") Cc: stable@vger.kernel.org Signed-off-by: Long Li <leo.lilong@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit a1177ea83da87a87cc352aa41f24d61c08c80b5d) Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
This commit is contained in:
parent
2df5bdcc5b
commit
3ae8e60551
@ -2324,7 +2324,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
|
||||
f = fcheck(fd);
|
||||
spin_unlock(¤t->files->file_lock);
|
||||
if (f != filp) {
|
||||
locks_remove_posix(filp, ¤t->files);
|
||||
locks_remove_posix(filp, current->files);
|
||||
error = -EBADF;
|
||||
}
|
||||
}
|
||||
@ -2454,7 +2454,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
|
||||
f = fcheck(fd);
|
||||
spin_unlock(¤t->files->file_lock);
|
||||
if (f != filp) {
|
||||
locks_remove_posix(filp, ¤t->files);
|
||||
locks_remove_posix(filp, current->files);
|
||||
error = -EBADF;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user