diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-01-01 20:15:05 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-01-01 20:15:05 +0100 |
commit | 95d248d16f9cb42de717367832cffa0f83e97fde (patch) | |
tree | 7d1fc6162e413a987dc43d466df2573da1e0bfd0 /kernel/futex | |
parent | Merge tag 'drm-fixes-2023-01-01' of git://anongit.freedesktop.org/drm/drm (diff) | |
parent | futex: Fix futex_waitv() hrtimer debug object leak on kcalloc error (diff) | |
download | linux-95d248d16f9cb42de717367832cffa0f83e97fde.tar.xz linux-95d248d16f9cb42de717367832cffa0f83e97fde.zip |
Merge tag 'locking_urgent_for_v6.2_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fixes from Borislav Petkov:
- Prevent the leaking of a debug timer in futex_waitv()
- A preempt-RT mutex locking fix, adding the proper acquire semantics
* tag 'locking_urgent_for_v6.2_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
futex: Fix futex_waitv() hrtimer debug object leak on kcalloc error
rtmutex: Add acquire semantics for rtmutex lock acquisition slow path
Diffstat (limited to 'kernel/futex')
-rw-r--r-- | kernel/futex/syscalls.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/kernel/futex/syscalls.c b/kernel/futex/syscalls.c index 086a22d1adb7..a8074079b09e 100644 --- a/kernel/futex/syscalls.c +++ b/kernel/futex/syscalls.c @@ -286,19 +286,22 @@ SYSCALL_DEFINE5(futex_waitv, struct futex_waitv __user *, waiters, } futexv = kcalloc(nr_futexes, sizeof(*futexv), GFP_KERNEL); - if (!futexv) - return -ENOMEM; + if (!futexv) { + ret = -ENOMEM; + goto destroy_timer; + } ret = futex_parse_waitv(futexv, waiters, nr_futexes); if (!ret) ret = futex_wait_multiple(futexv, nr_futexes, timeout ? &to : NULL); + kfree(futexv); + +destroy_timer: if (timeout) { hrtimer_cancel(&to.timer); destroy_hrtimer_on_stack(&to.timer); } - - kfree(futexv); return ret; } |