For RAID management passthrough commands, the driver embeds the
scatter-gather list directly inside the kernel DMA buffer immediately
following the user data payload. Previously, the driver did not verify
that the kernel buffer had sufficient room to hold both the user data
and the required scatter-gather element.
If a userland request supplied a buffer length that left less space than
a single scatter-gather element, unsigned subtraction underflowed the
available descriptor calculation. This bypassed subsequent bounds checks
and resulted in memory corruption when constructing the scatter-gather list
past the end of the allocated buffer.
Validate that the user buffer length leaves sufficient space for the
scatter-gather element overhead, safely rejecting oversized requests
before constructing the scatter-gather list.