From: Simon Horman <simon.horman@corigine.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>, Jia-Ju Bai <baijiaju@buaa.edu.cn>
Cc: johannes@sipsolutions.net, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: mac80211: Add NULL checks for sta->sdata
Date: Mon, 20 Mar 2023 17:49:08 +0100 [thread overview]
Message-ID: <ZBiOhAJswYcAo8kv@corigine.com> (raw)
In-Reply-To: <20230320133809.2448047-1-baijiaju@buaa.edu.cn> <20230320133601.2443821-1-baijiaju1990@gmail.com> <20230320133644.2445321-1-baijiaju1990@gmail.com> <20230320133533.2442889-1-baijiaju1990@gmail.com>
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
>
> 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.
Also, are these theoretical bugs?
Or something that has been observed?
And has a reproducer?
> 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@gmail.com>
> Reported-by: TOTE Robot <baijiaju@buaa.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
next prev parent reply other threads:[~2023-03-20 17:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 13:38 [PATCH] net: mac80211: Add NULL checks for sta->sdata Jia-Ju Bai
2023-03-20 13:36 ` Jia-Ju Bai
2023-03-20 13:36 ` Jia-Ju Bai
2023-03-20 13:35 ` Jia-Ju Bai
2023-03-20 16:49 ` Simon Horman [this message]
2023-03-21 7:40 ` Jia-Ju Bai
2023-03-21 8:36 ` Simon Horman
2023-03-21 9:37 ` Jia-Ju Bai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZBiOhAJswYcAo8kv@corigine.com \
--to=simon.horman@corigine.com \
--cc=baijiaju1990@gmail.com \
--cc=baijiaju@buaa.edu.cn \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).