Commit 7ff379ba authored by Johannes Berg's avatar Johannes Berg
Browse files

mac80211: twt: don't use potentially unaligned pointer



Since we're pointing into a frame, the pointer to the
twt_agrt->req_type struct member is potentially not
aligned properly. Open-code le16p_replace_bits() to
avoid passing an unaligned pointer.

Reported-by: default avatarkernel test robot <lkp@intel.com>
Fixes: f5a4c24e ("mac80211: introduce individual TWT support in AP mode")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20210927115124.e1208694f37b.Ie3de9bcc5dde5a79e3ac81f3185beafe4d214e57@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent e306784a
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -104,8 +104,10 @@ ieee80211_s1g_rx_twt_setup(struct ieee80211_sub_if_data *sdata,

	/* broadcast TWT not supported yet */
	if (twt->control & IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST) {
		le16p_replace_bits(&twt_agrt->req_type,
				   TWT_SETUP_CMD_REJECT,
		twt_agrt->req_type &=
			~cpu_to_le16(IEEE80211_TWT_REQTYPE_SETUP_CMD);
		twt_agrt->req_type |=
			le16_encode_bits(TWT_SETUP_CMD_REJECT,
					 IEEE80211_TWT_REQTYPE_SETUP_CMD);
		goto out;
	}