In the Linux kernel, the following vulnerability has been resolved:
tee: add overflow check in registershmhelper()
With special lengths supplied by user space, registershmhelper() has an integer overflow when calculating the number of pages covered by a supplied user space memory region.
This causes internalgetuserpagesfast() a helper function of pinuserpages_fast() to do a NULL pointer dereference:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010 Modules linked in: CPU: 1 PID: 173 Comm: opteeexamplea Not tainted 5.19.0 #11 Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015 pc : internalgetuserpagesfast+0x474/0xa80 Call trace: internalgetuserpagesfast+0x474/0xa80 pinuserpagesfast+0x24/0x4c registershmhelper+0x194/0x330 teeshmregisteruserbuf+0x78/0x120 teeioctl+0xd0/0x11a0 _arm64sysioctl+0xa8/0xec invokesyscall+0x48/0x114
Fix this by adding an an explicit call to accessok() in teeshmregisteruser_buf() to catch an invalid user space address early.