Subject: GPF on memory allocation, bisected down to "iwlwifi: fix leaks/bad data after failed firmware load"

Hi,

After updating from 5.15.14 to 5.16.5, I started getting GPF at
seemingly random places, but always(?) related to some memory allocation
(kmalloc, kmem_cache_alloc_trace etc). Since I had very specific good
and bad versions, and trivial reproducer (it crashes on boot rather
quickly), I bisected it, and ended up with:

iwlwifi: fix leaks/bad data after failed firmware load

If firmware load fails after having loaded some parts of the
firmware, e.g. the IML image, then this would leak. For the
host command list we'd end up running into a WARN on the next
attempt to load another firmware image.

Fix this by calling iwl_dealloc_ucode() on failures, and make
that also clear the data so we start fresh on the next round.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
Link: https://lore.kernel.org/r/iwlwifi.20211210110539.1f742f0eb58a.I1315f22f6aa632d94ae2069f85e1bca5e734dce0@changeid
Signed-off-by: Luca Coelho <[email protected]>

as the first bad commit.

And indeed, after reverting it on top of 5.16.5, the problem disappears.

What I think is an important details, I don't have any firmware for the
network card on this setup, so all attempts fails (several messages
about failed firmware load, for a variety of versions).

Some more details (including specific crash log) are at https://github.com/QubesOS/qubes-issues/issues/7241


--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab


Attachments:
(No filename) (1.53 kB)
signature.asc (499.00 B)
Download all attachments