Re: [PATCH v2 2/2] firmware_loader: fix soundness issue in `request_internal`

From: Luis Chamberlain
Date: Mon Jul 08 2024 - 16:38:01 EST


On Mon, Jul 08, 2024 at 10:07:21PM +0200, Danilo Krummrich wrote:
> `request_internal` must be called with one of the following function
> pointers: request_firmware(), firmware_request_nowarn(),
> firmware_request_platform() or request_firmware_direct().
>
> The previous `FwFunc` alias did not guarantee this, which is unsound.
>
> In order to fix this up, implement `FwFunc` as new type with a
> corresponding type invariant.
>
> Reported-by: Gary Guo <gary@xxxxxxxxxxx>
> Closes: https://lore.kernel.org/lkml/20240620143611.7995e0bb@eugeo/
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>

While you're at it, can you go ahead and extend out selftest coverage
for the firmware_loader so we can test Rust too? Could these issues
have been caught with a selftest? If not why not?

Luis