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
| ||
|
Message-ID: <f8daa53ee8a8019e4fd2b823c1fcb85a6cc4d806.camel@sipsolutions.net> Date: Tue, 24 Oct 2023 22:49:29 +0200 From: Johannes Berg <johannes@...solutions.net> To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>, 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 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()? johannes
Powered by blists - more mailing lists