linux/drivers/ptp
Yuran Pereira 8a4f030dbc ptp: Fixes a null pointer dereference in ptp_ioctl
Syzkaller found a null pointer dereference in ptp_ioctl
originating from the lack of a null check for tsevq.

```
general protection fault, probably for non-canonical
	address 0xdffffc000000020b: 0000 [#1] PREEMPT SMP KASAN
KASAN: probably user-memory-access in range
	[0x0000000000001058-0x000000000000105f]
CPU: 0 PID: 5053 Comm: syz-executor353 Not tainted
	6.6.0-syzkaller-10396-g4652b8e4f3ff #0
Hardware name: Google Google Compute Engine/Google Compute Engine,
	BIOS Google 10/09/2023
RIP: 0010:ptp_ioctl+0xcb7/0x1d10 drivers/ptp/ptp_chardev.c:476
...
Call Trace:
 <TASK>
 posix_clock_ioctl+0xf8/0x160 kernel/time/posix-clock.c:86
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:871 [inline]
 __se_sys_ioctl fs/ioctl.c:857 [inline]
 __x64_sys_ioctl+0x18f/0x210 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
```

This patch fixes the issue by adding a check for tsevq and
ensuring ptp_ioctl returns with an error if tsevq is null.

Reported-by: syzbot+8a78ecea7ac1a2ea26e5@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8a78ecea7ac1a2ea26e5
Fixes: c5a445b1e9 ("ptp: support event queue reader channel masks")
Signed-off-by: Yuran Pereira <yuran.pereira@hotmail.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-11-10 08:35:59 +00:00
..
Kconfig ptp_ocp: implement DPLL ops 2023-09-17 11:50:20 +01:00
Makefile net: ptp: create a mock-up PTP Hardware Clock driver 2023-08-09 15:59:21 -07:00
ptp_chardev.c ptp: Fixes a null pointer dereference in ptp_ioctl 2023-11-10 08:35:59 +00:00
ptp_clock.c ptp: fix corrupted list in ptp_open 2023-11-08 18:47:07 -08:00
ptp_clockmatrix.c ptp: ptp_clockmatrix: Add .getmaxphase ptp_clock_info callback 2023-06-20 09:02:33 +01:00
ptp_clockmatrix.h ptp: ptp_clockmatrix: Add .getmaxphase ptp_clock_info callback 2023-06-20 09:02:33 +01:00
ptp_dfl_tod.c ptp: add ToD device driver for Intel FPGA cards 2023-03-29 21:25:48 -07:00
ptp_dte.c
ptp_idt82p33.c ptp: idt82p33: Add .getmaxphase ptp_clock_info callback 2023-06-20 09:02:33 +01:00
ptp_idt82p33.h ptp: idt82p33: Add .getmaxphase ptp_clock_info callback 2023-06-20 09:02:33 +01:00
ptp_ines.c ptp: ines: drop of_match_ptr for ID table 2023-03-15 21:14:57 -07:00
ptp_kvm_arm.c ptp: kvm: Use decrypted memory in confidential guest on x86 2023-03-17 21:57:52 -07:00
ptp_kvm_common.c ptp: kvm: Use decrypted memory in confidential guest on x86 2023-03-17 21:57:52 -07:00
ptp_kvm_x86.c ptp: kvm: Use decrypted memory in confidential guest on x86 2023-03-17 21:57:52 -07:00
ptp_mock.c net: ptp: create a mock-up PTP Hardware Clock driver 2023-08-09 15:59:21 -07:00
ptp_ocp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-05 13:16:47 -07:00
ptp_pch.c
ptp_private.h ptp: fix corrupted list in ptp_open 2023-11-08 18:47:07 -08:00
ptp_qoriq.c ptp: Explicitly include correct DT includes 2023-07-18 11:27:49 +02:00
ptp_qoriq_debugfs.c
ptp_sysfs.c ptp: support multiple timestamp event readers 2023-10-15 20:07:52 +01:00
ptp_vclock.c ptp: vclock: use mutex to fix "sleep on atomic" bug 2023-02-22 21:23:48 -08:00
ptp_vmw.c Networking changes for 6.2. 2022-12-13 15:47:48 -08:00