From: Johannes Berg <johannes@sipsolutions.net>
To: Simon Horman <horms@kernel.org>, Kenton Groombridge <concord@gentoo.org>
Cc: 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: Thu, 23 May 2024 11:35:37 +0200 [thread overview]
Message-ID: <9fca4c0d496eb731f571cd8eacd409b9a9e61dae.camel@sipsolutions.net> (raw)
In-Reply-To: <20240517204532.GC475595@kernel.org>
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 ...
Don't see any good solutions to this kind of code?
johannes
next prev parent reply other threads:[~2024-05-23 9:35 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 [this message]
2024-05-31 13:24 ` Simon Horman
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=9fca4c0d496eb731f571cd8eacd409b9a9e61dae.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=concord@gentoo.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--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