wifi: mac80211: check S1G action frame size
authorJohannes Berg <johannes.berg@intel.com>
Tue, 15 Aug 2023 15:51:05 +0000 (17:51 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 22 Aug 2023 12:01:18 +0000 (14:01 +0200)
Before checking the action code, check that it even
exists in the frame.

Reported-by: syzbot+be9c824e6f269d608288@syzkaller.appspotmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rx.c

index 4f707d2..33f9764 100644 (file)
@@ -3732,6 +3732,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
                        break;
                goto queue;
        case WLAN_CATEGORY_S1G:
+               if (len < offsetofend(typeof(*mgmt),
+                                     u.action.u.s1g.action_code))
+                       break;
+
                switch (mgmt->u.action.u.s1g.action_code) {
                case WLAN_S1G_TWT_SETUP:
                case WLAN_S1G_TWT_TEARDOWN: