diff options
author | Kees Cook <keescook@chromium.org> | 2021-08-06 14:53:05 -0700 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2021-08-13 09:58:25 +0200 |
commit | 8c89f7b3d3f2880c57b0bc96c72ccd98fe354399 (patch) | |
tree | 071abf84b4bde5a46a6fecd9473cbaa3ce4e8fee /net/wireless | |
parent | 5cafd3784a738eab8bbfcda17e8571050794ef32 (diff) | |
download | linux-stable-8c89f7b3d3f2880c57b0bc96c72ccd98fe354399.tar.gz linux-stable-8c89f7b3d3f2880c57b0bc96c72ccd98fe354399.tar.bz2 linux-stable-8c89f7b3d3f2880c57b0bc96c72ccd98fe354399.zip |
mac80211: Use flex-array for radiotap header bitmap
In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy(), memmove(), and memset(), avoid
intentionally writing across neighboring fields.
The it_present member of struct ieee80211_radiotap_header is treated as a
flexible array (multiple u32s can be conditionally present). In order for
memcpy() to reason (or really, not reason) about the size of operations
against this struct, use of bytes beyond it_present need to be treated
as part of the flexible array. Add a trailing flexible array and
initialize its initial index via pointer arithmetic.
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210806215305.2875621-1-keescook@chromium.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/radiotap.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/wireless/radiotap.c b/net/wireless/radiotap.c index 8099c9564a59..ae2e1a896461 100644 --- a/net/wireless/radiotap.c +++ b/net/wireless/radiotap.c @@ -115,10 +115,9 @@ int ieee80211_radiotap_iterator_init( iterator->_max_length = get_unaligned_le16(&radiotap_header->it_len); iterator->_arg_index = 0; iterator->_bitmap_shifter = get_unaligned_le32(&radiotap_header->it_present); - iterator->_arg = (uint8_t *)radiotap_header + sizeof(*radiotap_header); + iterator->_arg = (uint8_t *)radiotap_header->it_optional; iterator->_reset_on_ext = 0; - iterator->_next_bitmap = &radiotap_header->it_present; - iterator->_next_bitmap++; + iterator->_next_bitmap = radiotap_header->it_optional; iterator->_vns = vns; iterator->current_namespace = &radiotap_ns; iterator->is_radiotap_ns = 1; |