lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8219c79e-0359-4136-afa4-fba76fde191a@embeddedor.com>
Date:   Tue, 24 Oct 2023 20:37:31 -0600
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Johannes Berg <johannes@...solutions.net>,
        Kalle Valo <kvalo@...nel.org>,
        Jeff Johnson <quic_jjohnson@...cinc.com>
Cc:     ath10k@...ts.infradead.org, linux-wireless@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        linux-hardening@...r.kernel.org
Subject: Re: [RFC - is this a bug?] wifi: ath10k: Asking for some light on
 this, please :)



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.

Thanks
--
Gustavo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ