ATH10K Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Johnson <quic_jjohnson@quicinc.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Kalle Valo <kvalo@kernel.org>
Cc: <ath10k@lists.infradead.org>, <linux-wireless@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	<linux-hardening@vger.kernel.org>
Subject: Re: [RFC - is this a bug?] wifi: ath10k: Asking for some light on this, please :)
Date: Tue, 12 Dec 2023 15:26:59 -0800	[thread overview]
Message-ID: <ada88ef1-d290-441a-b6f1-97d7f478cccc@quicinc.com> (raw)
In-Reply-To: <afaadf5e-556c-4fd6-bfd3-9c486a35a08f@quicinc.com>

On 10/25/2023 8:52 AM, Jeff Johnson wrote:
> On 10/24/2023 7:37 PM, Gustavo A. R. Silva wrote:
>>
>>
>> On 10/24/23 14:49, Johannes Berg wrote:
>>> On Tue, 2023-10-24 at 14:41 -0600, Gustavo A. R. Silva wrote:
>>>>
>>>> It seems we run into the same issue in the function below, even in the
>>>> case this `memset()` is unnecessary (which it seems it's not):
>>>>
>>>>     8920         memset(skb->data, 0, sizeof(*cmd));
>>>>
>>>> Notice that if `cap->peer_chan_len == 0` or `cap->peer_chan_len == 1`,
>>>> in the original code, we have `len == sizeof(*cmd) == 128`:
>>>
>>> Right.
>>>
>>>> -       /* tdls peer update cmd has place holder for one channel*/
>>>> -       chan_len = cap->peer_chan_len ? (cap->peer_chan_len - 1) : 0;
>>>> -
>>>> -       len = sizeof(*cmd) + chan_len * sizeof(*chan);
>>>> +       len = struct_size(cmd, peer_capab.peer_chan_list, 
>>>> cap->peer_chan_len);
>>>>
>>>>           skb = ath10k_wmi_alloc_skb(ar, len);
>>>>           if (!skb)
>>>>
>>>> which makes `round_len == roundup(len, 4) == struct_size(cmd,...,...) 
>>>> == 104`
>>>> when `cap->peer_chan_len == 0`
>>>
>>> And yeah, that's really the issue, it only matters for ==0. For a moment
>>> there I thought that doesn't even make sense, but it looks like it never
>>> even becomes non-zero.
>>>
>>> No idea then, sorry. You'd hope firmware doesn't care about the actual
>>> message size if the inner data says "0 entries", but who knows? And how
>>> many firmware versions are there? :)
>>>
>>> So I guess you'd want to stay compatible, even if it means having a
>>>
>>>     chan_len = min(cap->peer_chan_len, 1);
>>>
>>> for the struct_size()?
>>
>> Yeah, that's an alternative.
>>
>> I'll wait for the maintainers to chime in and see if they have a different
>> opinion.
> 
> I'm seeing clarification from the development team.
> 
> /jeff
> 

I was not able to get a response from the firmware team.

I have gone ahead and created a series of patches to fix the remaining
flexible array issues in ath10k including the one discussed here. I
should be able to post those sometime this week.

/jeff


  reply	other threads:[~2023-12-12 23:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 19:50 [RFC - is this a bug?] wifi: ath10k: Asking for some light on this, please :) Gustavo A. R. Silva
2023-10-24 20:11 ` Johannes Berg
2023-10-24 20:41   ` Gustavo A. R. Silva
2023-10-24 20:49     ` Johannes Berg
2023-10-25  2:37       ` Gustavo A. R. Silva
2023-10-25 15:52         ` Jeff Johnson
2023-12-12 23:26           ` Jeff Johnson [this message]
2023-10-25  1:06 ` Gustavo A. R. Silva

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=ada88ef1-d290-441a-b6f1-97d7f478cccc@quicinc.com \
    --to=quic_jjohnson@quicinc.com \
    --cc=ath10k@lists.infradead.org \
    --cc=gustavo@embeddedor.com \
    --cc=gustavoars@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=kvalo@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /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