nvkm/core: don't pass a potentially remapped address to sg_init_one
The nouveau driver crashes at firmware load time after commit 2541626c, which after skimming through the various subsystems, I've traced down to iommu_dma_alloc
returning a vmap
'd address in certain cases via iommu_dma_alloc_remap
and dma_common_pages_remap
: https://gitlab.freedesktop.org/drm/nouveau/-/blob/nouveau-next/drivers/iommu/dma-iommu.c?ref_type=heads#L1495
Note that the bug is ALWAYS caught before anything goes wrong by the sanity checks enabled by CONFIG_DEBUG_SG
, however it goes unnoticed without that option enabled on certain kernels due to UB (eg. the driver was working fine on Arch despite this bug but crashed instantly on my custom kernel)
This is my first time working with kernel code so I'm not familiar with all the nuances, but I still think that the fix is not super ideal since it pokes into the implementation details of dma_alloc_coherent
...
the actual details are present in the commit message
references