From: Simon Horman <horms@kernel.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Kenton Groombridge <concord@gentoo.org>,
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,
linux-hardening@vger.kernel.org,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH v2] wifi: mac80211: Avoid address calculations via out of bounds array indexing
Date: Fri, 31 May 2024 14:24:31 +0100 [thread overview]
Message-ID: <20240531132431.GH123401@kernel.org> (raw)
In-Reply-To: <9fca4c0d496eb731f571cd8eacd409b9a9e61dae.camel@sipsolutions.net>
On Thu, May 23, 2024 at 11:35:37AM +0200, Johannes Berg wrote:
> On Fri, 2024-05-17 at 21:45 +0100, Simon Horman wrote:
> >
> > FWWIW, it seems unfortunate to me that the __counted_by field (n_channels)
> > is set some distance away from the allocation of the flex-array (channels)
> > whose bounds it checks. It seems it would be pretty easy for a bug in the
> > code being updated here to result in an overrun.
> >
>
> In a way, this is a more general problem, this allocates the max we know
> we might need, but then filter it down. It'd have to iterate twice to
> actually allocate the "correct" size, but then you could still have bugs
> by having different filter conditions in the two loops ...
Yes, I agree this problem is more general than this patch or the code it
updates.
> Don't see any good solutions to this kind of code?
I was hoping you might :)
next prev parent reply other threads:[~2024-05-31 13:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-17 14:54 [PATCH v2] wifi: mac80211: Avoid address calculations via out of bounds array indexing Kenton Groombridge
2024-05-17 20:45 ` Simon Horman
2024-05-23 9:35 ` Johannes Berg
2024-05-31 13:24 ` Simon Horman [this message]
2024-05-29 14:54 ` Johannes Berg
2024-06-04 18:53 ` Kenton Groombridge
2024-06-04 19:29 ` Johannes Berg
2024-06-05 14:52 ` Kenton Groombridge
2024-06-03 7:20 ` kernel test robot
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=20240531132431.GH123401@kernel.org \
--to=horms@kernel.org \
--cc=concord@gentoo.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=johannes@sipsolutions.net \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=linux-hardening@vger.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).