From: Kees Cook <keescook@chromium.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Gregory Greenman <gregory.greenman@intel.com>,
Kalle Valo <kvalo@kernel.org>,
Johannes Berg <johannes.berg@intel.com>,
linux-wireless@vger.kernel.org,
Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [PATCH] wifi: iwlwifi: dvm: Fix memcpy: detected field-spanning write backtrace
Date: Tue, 18 Apr 2023 08:33:30 -0700 [thread overview]
Message-ID: <643eb84b.170a0220.30557.565c@mx.google.com> (raw)
In-Reply-To: <20230418132546.45297-1-hdegoede@redhat.com>
On Tue, Apr 18, 2023 at 03:25:46PM +0200, Hans de Goede wrote:
> A received TKIP key may be up to 32 bytes because it may contain
> MIC rx/tx keys too. These are not used by iwl and copying these
> over overflows the iwl_keyinfo.key field.
>
> Add a check to not copy more data to iwl_keyinfo.key then will fit.
>
> This fixes backtraces like this one:
>
> memcpy: detected field-spanning write (size 32) of single field "sta_cmd.key.key" at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 (size 16)
> WARNING: CPU: 1 PID: 946 at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 iwlagn_send_sta_key+0x375/0x390 [iwldvm]
> <snip>
> Hardware name: Dell Inc. Latitude E6430/0H3MT5, BIOS A21 05/08/2017
> RIP: 0010:iwlagn_send_sta_key+0x375/0x390 [iwldvm]
> <snip>
> Call Trace:
> <TASK>
> iwl_set_dynamic_key+0x1f0/0x220 [iwldvm]
> iwlagn_mac_set_key+0x1e4/0x280 [iwldvm]
> drv_set_key+0xa4/0x1b0 [mac80211]
> ieee80211_key_enable_hw_accel+0xa8/0x2d0 [mac80211]
> ieee80211_key_replace+0x22d/0x8e0 [mac80211]
> <snip>
>
> Link: https://www.alionet.org/index.php?topic=1469.0
> Link: https://lore.kernel.org/linux-wireless/20230218191056.never.374-kees@kernel.org/
> Link: https://lore.kernel.org/linux-wireless/68760035-7f75-1b23-e355-bfb758a87d83@redhat.com/
> Cc: Kees Cook <keescook@chromium.org>
> Suggested-by: Johannes Berg <johannes@sipsolutions.net>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Thanks for chasing this down -- I hadn't had time to come back around to
it.
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
prev parent reply other threads:[~2023-04-18 15:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 13:25 [PATCH] wifi: iwlwifi: dvm: Fix memcpy: detected field-spanning write backtrace Hans de Goede
2023-04-18 14:43 ` Johannes Berg
2023-04-18 15:28 ` Hans de Goede
2023-04-18 15:33 ` Kees Cook [this message]
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=643eb84b.170a0220.30557.565c@mx.google.com \
--to=keescook@chromium.org \
--cc=gregory.greenman@intel.com \
--cc=hdegoede@redhat.com \
--cc=johannes.berg@intel.com \
--cc=johannes@sipsolutions.net \
--cc=kvalo@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;
as well as URLs for NNTP newsgroup(s).