freebsd-dev/sys/compat
Austin Shafer 3f686532c9 linuxkpi: Fix __sg_alloc_table_from_pages loop
Commit 3e0856b63f updated
__sg_alloc_table_from_pages to use the same API as linux, but modified
the loop condition when going over the pages in a sg list. Part of the
change included moving the sg_next call out of the for loop and into the
body, which causes an off by one error when traversing the list. Since
sg_next is called before the loop body it will skip the first element
and read one past the last element.

This caused panics when running PRIME with nvidia-drm as the off-by-one
issue causes a NULL dereference.

Reviewed by:	bz, hselasky
Differential Revision:	https://reviews.freebsd.org/D39628
Fixes:	3e0856b63f ("linuxkpi: Fix `sg_alloc_table_from_pages()` to have the same API as Linux")
2023-04-21 09:56:50 +02:00
..
freebsd32 Regen 2023-04-04 16:19:08 +03:00
ia32 Retire sv_transtrap 2022-05-20 14:54:03 +03:00
lindebugfs lindebugfs: Add debugfs_create_file_size() 2023-01-25 23:23:16 +01:00
linprocfs linux(4): Migrate to IfAPI 2023-03-04 12:11:38 +03:00
linsysfs linsysfs(4): Reimplement listnics() using ifAPI 2023-04-03 11:22:16 +03:00
linux net: replace IFF_KNOWSEPOCH with IFF_NEEDSEPOCH 2023-04-17 09:08:35 -07:00
linuxkpi linuxkpi: Fix __sg_alloc_table_from_pages loop 2023-04-21 09:56:50 +02:00
x86bios pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t. 2022-09-22 15:08:52 -07:00