linux/include
Suren Baghdasaryan a06247c680 psi: Fix uaf issue when psi trigger is destroyed while being polled
With write operation on psi files replacing old trigger with a new one,
the lifetime of its waitqueue is totally arbitrary. Overwriting an
existing trigger causes its waitqueue to be freed and pending poll()
will stumble on trigger->event_wait which was destroyed.
Fix this by disallowing to redefine an existing psi trigger. If a write
operation is used on a file descriptor with an already existing psi
trigger, the operation will fail with EBUSY error.
Also bypass a check for psi_disabled in the psi_trigger_destroy as the
flag can be flipped after the trigger is created, leading to a memory
leak.

Fixes: 0e94682b73 ("psi: introduce psi monitor")
Reported-by: syzbot+cdb5dd11c97cc532efad@syzkaller.appspotmail.com
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Analyzed-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220111232309.1786347-1-surenb@google.com
2022-01-18 12:09:57 +01:00
..
acpi USB/Thunderbolt changes for 5.17-rc1 2022-01-12 11:27:57 -08:00
asm-generic Peter Zijlstra says: 2022-01-11 17:24:45 -08:00
clocksource
crypto tpmdd updates for Linux v5.17 2022-01-11 12:58:41 -08:00
drm Merge tag 'drm-msm-next-2021-12-26' of ssh://gitlab.freedesktop.org/drm/msm into drm-next 2021-12-29 14:02:44 +10:00
dt-bindings - qcom: misc updates to qcom-ipcc driver 2022-01-13 11:19:07 -08:00
keys keys: X.509 public key issuer lookup without AKID 2022-01-09 00:18:42 +02:00
kunit
kvm KVM: arm64: Hide kvm_arm_pmu_available behind CONFIG_HW_PERF_EVENTS=y 2021-11-17 14:49:11 +01:00
linux psi: Fix uaf issue when psi trigger is destroyed while being polled 2022-01-18 12:09:57 +01:00
math-emu
media media: dmxdev: drop unneeded <linux/kernel.h> inclusion from other headers 2021-12-14 16:19:04 +01:00
memory memory: renesas-rpc-if: Add support for RZ/G2L 2021-11-16 12:09:11 +01:00
misc
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-01-09 17:00:17 -08:00
pcmcia
ras
rdma RDMA/core: Calculate UDP source port based on flow label or lqpn/rqpn 2022-01-07 19:34:01 -04:00
scsi scsi: remove the gendisk argument to scsi_ioctl 2021-11-29 06:41:29 -07:00
soc Networking changes for 5.17. 2022-01-10 19:06:09 -08:00
sound ASoC: Fixes for v5.16 2021-11-25 14:35:24 +01:00
target
trace IOMMU Updates for Linux v5.17 2022-01-12 16:15:51 -08:00
uapi RDMA v5.17 merge window pull request 2022-01-13 11:09:11 -08:00
vdso
video
xen xen: branch for v5.17-rc1 2022-01-12 16:42:00 -08:00