FAILED: patch "[PATCH] nl80211: validate key indexes for cfg80211_registered_device" failed to apply to 5.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 2d9463083ce92636a1bdd3e30d1236e3e95d859e Mon Sep 17 00:00:00 2001
From: Anant Thazhemadam <[email protected]>
Date: Sat, 5 Dec 2020 03:28:25 +0530
Subject: [PATCH] nl80211: validate key indexes for cfg80211_registered_device
syzbot discovered a bug in which an OOB access was being made because an unsuitable key_idx value was wrongly considered to be acceptable while deleting a key in nl80211_del_key().
Since we don't know the cipher at the time of deletion, if cfg80211_validate_key_settings() were to be called directly in nl80211_del_key(), even valid keys would be wrongly determined invalid, and deletion wouldn't occur correctly.
For this reason, a new function - cfg80211_valid_key_idx(), has been created, to determine if the key_idx value provided is valid or not. cfg80211_valid_key_idx() is directly called in 2 places - nl80211_del_key(), and cfg80211_validate_key_settings().
net/wireless/core.h +2 -0
@@ -433,6 +433,8 @@ void cfg80211_sme_abandon_assoc(struct wireless_dev *wdev);/* internal helpers */ bool cfg80211_supported_cipher_suite (struct wiphy *wiphy,u32 cipher); +bool cfg80211_valid_key_idx (struct cfg80211_registered_device *rdev, +int key_idx,bool pairwise);int cfg80211_validate_key_settings (struct cfg80211_registered_device *rdev,struct key_params *params,int key_idx,bool pairwise,const u8 *mac_addr);
net/wireless/nl80211.c +4 -3
@@ -4239,9 +4239,6 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info)if (err)return err; -if (key.idx <0 ) -return -EINVAL ; -if (info->attrs[NL80211_ATTR_MAC ]) mac_addr =nla_data (info->attrs[NL80211_ATTR_MAC ]);
@@ -4257,6 +4254,10 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info) key.type != NL80211_KEYTYPE_GROUP)return -EINVAL ; +if (!cfg80211_valid_key_idx (rdev, key.idx, + key.type ==NL80211_KEYTYPE_PAIRWISE )) +return -EINVAL ; +if (!rdev->ops->del_key)return -EOPNOTSUPP ;
net/wireless/util.c +43 -8
61 lines not on this page · raw message