mbox series

[0/2] iwlwifi: Fix a crash at loading

Message ID 20210112132449.22243-1-tiwai@suse.de
Headers show
Series iwlwifi: Fix a crash at loading | expand

Message

Takashi Iwai Jan. 12, 2021, 1:24 p.m. UTC
Hi,

this is the fix for the recently introduced regression of iwlwifi
driver (since 5.10), a crash at the module loading [1][2].
The first patch actually fixes the bug, and this should go to 5.11-rc.
The second patch is an enhancement to make pointers const for safety.


Takashi

[1] https://bugzilla.suse.com/show_bug.cgi?id=1180344
[2] https://bugzilla.kernel.org/show_bug.cgi?id=210733

===

Takashi Iwai (2):
  iwlwifi: dbg: Don't touch the tlv data
  iwlwifi: dbg: Mark ucode tlv data as const

 .../net/wireless/intel/iwlwifi/iwl-dbg-tlv.c  | 57 +++++++++----------
 .../net/wireless/intel/iwlwifi/iwl-dbg-tlv.h  |  2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c  |  2 +-
 3 files changed, 28 insertions(+), 33 deletions(-)

Comments

Takashi Iwai Jan. 12, 2021, 4:05 p.m. UTC | #1
On Tue, 12 Jan 2021 16:50:54 +0100,
Kalle Valo wrote:
> 
> Takashi Iwai <tiwai@suse.de> writes:
> 
> > The ucode TLV data may be read-only and should be treated as const
> > pointers, but currently a few code forcibly cast to the writable
> > pointer unnecessarily.  This gave developers a wrong impression as if
> > it can be modified, resulting in crashing regressions already a couple
> > of times.
> >
> > This patch adds the const prefix to those cast pointers, so that such
> > attempt can be caught more easily in future.
> >
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> 
> So this need to go to -next, right?

Yes, this isn't urgently needed for 5.11.

> Does this depend on patch 1 or can
> this be applied independently?

It depends on the first patch, otherwise you'll get the warning in the
code changing the const data (it must warn -- that's the purpose of
this change :)

So, if applying to a separate branch is difficult, applying together
for 5.11 would be an option.


thanks,

Takashi
Coelho, Luciano Jan. 12, 2021, 5:13 p.m. UTC | #2
On Tue, 2021-01-12 at 17:05 +0100, Takashi Iwai wrote:
> On Tue, 12 Jan 2021 16:50:54 +0100,

> Kalle Valo wrote:

> > 

> > Takashi Iwai <tiwai@suse.de> writes:

> > 

> > > The ucode TLV data may be read-only and should be treated as const

> > > pointers, but currently a few code forcibly cast to the writable

> > > pointer unnecessarily.  This gave developers a wrong impression as if

> > > it can be modified, resulting in crashing regressions already a couple

> > > of times.

> > > 

> > > This patch adds the const prefix to those cast pointers, so that such

> > > attempt can be caught more easily in future.

> > > 

> > > Signed-off-by: Takashi Iwai <tiwai@suse.de>

> > 

> > So this need to go to -next, right?

> 

> Yes, this isn't urgently needed for 5.11.


Acked-by: Luca Coelho <luciano.coelho@intel.com>



> > Does this depend on patch 1 or can

> > this be applied independently?

> 

> It depends on the first patch, otherwise you'll get the warning in the

> code changing the const data (it must warn -- that's the purpose of

> this change :)

> 

> So, if applying to a separate branch is difficult, applying together

> for 5.11 would be an option.


It doesn't matter to me how you apply it.  Applying together is
obviously going to be easier, but applying separately wouldn't be that
hard either.  You'd just have to track when 1/2 went into net-next
before applying this one.  Kalle's call.

--
Cheers,
Luca.
Kalle Valo Jan. 13, 2021, 6:50 a.m. UTC | #3
"Coelho, Luciano" <luciano.coelho@intel.com> writes:

> On Tue, 2021-01-12 at 17:05 +0100, Takashi Iwai wrote:

>> On Tue, 12 Jan 2021 16:50:54 +0100,

>> Kalle Valo wrote:

>> > 

>> > Takashi Iwai <tiwai@suse.de> writes:

>> > 

>> > > The ucode TLV data may be read-only and should be treated as const

>> > > pointers, but currently a few code forcibly cast to the writable

>> > > pointer unnecessarily.  This gave developers a wrong impression as if

>> > > it can be modified, resulting in crashing regressions already a couple

>> > > of times.

>> > > 

>> > > This patch adds the const prefix to those cast pointers, so that such

>> > > attempt can be caught more easily in future.

>> > > 

>> > > Signed-off-by: Takashi Iwai <tiwai@suse.de>

>> > 

>> > So this need to go to -next, right?

>> 

>> Yes, this isn't urgently needed for 5.11.

>

> Acked-by: Luca Coelho <luciano.coelho@intel.com>

>

>

>> > Does this depend on patch 1 or can

>> > this be applied independently?

>> 

>> It depends on the first patch, otherwise you'll get the warning in the

>> code changing the const data (it must warn -- that's the purpose of

>> this change :)

>> 

>> So, if applying to a separate branch is difficult, applying together

>> for 5.11 would be an option.

>

> It doesn't matter to me how you apply it.  Applying together is

> obviously going to be easier, but applying separately wouldn't be that

> hard either.  You'd just have to track when 1/2 went into net-next

> before applying this one.  Kalle's call.


Ok, I'll apply this to wireless-drivers-next after wireless-drivers is
merged to -next. It might take a while.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches