HomeFreeBSD

linuxkpi: fix iteration in __sg_alloc_table_from_pages

Description

linuxkpi: fix iteration in __sg_alloc_table_from_pages

Commit 3f686532c9b4 tried to fix an issue with not properly starting
at the first page in the sg list to prevent a panic. This worked but
with the side effect of incrementing "s" during the final iteration
causing it to be NULL since the list had ended.
In cases non-DEBUG kernels this causes a panic with drm-5.15, since
"s" is NULL when we later pass it to sg_mark_end().
This change decouples the iteration sg from the return value so that
it is never incremented past the final page in the chain.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D41574

(cherry picked from commit 09b0401e91a92bcb58ea1873857b42f8211f660f)

Details

Provenance
ashafer_badland.ioAuthored on Sep 6 2023, 2:08 PM
bzCommitted on Oct 6 2023, 12:47 PM
Reviewer
manu
Differential Revision
D41574: linuxkpi: Fix iteration in __sg_alloc_table_from_pages again
Parents
rG1e853a1196fc: sbuf.9: Add LIBRARY section
Branches
Unknown
Tags
Unknown