[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b213efb-8c7a-497d-2e08-f404d174a6ae@buaa.edu.cn>
Date: Tue, 21 Mar 2023 15:40:40 +0800
From: Jia-Ju Bai <baijiaju@...a.edu.cn>
To: Simon Horman <simon.horman@...igine.com>
Cc: johannes@...solutions.net, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: mac80211: Add NULL checks for sta->sdata
Hello Simon,
Thanks for the reply!
On 2023/3/21 0:49, Simon Horman wrote:
> On Mon, Mar 20, 2023 at 09:35:33PM +0800, Jia-Ju Bai wrote:
>> In a previous commit 69403bad97aa, sta->sdata can be NULL, and thus it
>> should be checked before being used.
> Please run checkpatch on this patch, and correct the commit description
> style.
>
> ./scripts/checkpatch.pl -g HEAD
> ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 69403bad97aa ("wifi: mac80211: sdata can be NULL during AMPDU start")'
> #6:
> In a previous commit 69403bad97aa, sta->sdata can be NULL, and thus it
Okay, I will revise it and run checkpatch.
>
>> However, in the same call stack, sta->sdata is also used in the
>> following functions:
>>
>> ieee80211_ba_session_work()
>> ___ieee80211_stop_rx_ba_session(sta)
>> ht_dbg(sta->sdata, ...); -> No check
>> sdata_info(sta->sdata, ...); -> No check
>> ieee80211_send_delba(sta->sdata, ...) -> No check
>> ___ieee80211_start_rx_ba_session(sta)
>> ht_dbg(sta->sdata, ...); -> No check
>> ht_dbg_ratelimited(sta->sdata, ...); -> No check
>> ieee80211_tx_ba_session_handle_start(sta)
>> sdata = sta->sdata; if (!sdata) -> Add check by previous commit
>> ___ieee80211_stop_tx_ba_session(sdata)
>> ht_dbg(sta->sdata, ...); -> No check
>> ieee80211_start_tx_ba_cb(sdata)
>> sdata = sta->sdata; local = sdata->local -> No check
>> ieee80211_stop_tx_ba_cb(sdata)
>> ht_dbg(sta->sdata, ...); -> No check
> I wonder if it would be better to teach ht_* do do nothing
> if the first argument is NULL.
Okay, I will use this way in patch v2.
>
> Also, are these theoretical bugs?
> Or something that has been observed?
> And has a reproducer?
These bugs are found by my static analysis tool, by extending a known
bug fixed in a previous commit 69403bad97aa.
Thus, they could be theoretical bugs.
>
>> Thus, to avoid possible null-pointer dereferences, the related checks
>> should be added.
>>
>> These results are reported by a static tool designed by myself.
>>
>> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
>> Reported-by: TOTE Robot <baijiaju@...a.edu.cn>
> I see 4 copies of this patch in a few minutes.
> As per the FAQ [1], please leave at least 24h between posts of a patch.
>
> [1] https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
I am quite sorry for this, because my script of git send email was buggy.
I noticed this problem after sending the e-mail, and now I have fixed it :)
Best wishes,
Jia-Ju Bai
Powered by blists - more mailing lists