mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 17:59:32 +00:00
nl80211: don't crash sending invalid chandef
One of the cases for an invalid channel definition is that the channel pointer is NULL, in which case the warning is a bit late since we'll dereference the pointer. Bail out of the function upon warning about this. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
98f0334263
commit
601555cd75
1 changed files with 2 additions and 1 deletions
|
@ -2317,7 +2317,8 @@ static inline u64 wdev_id(struct wireless_dev *wdev)
|
|||
static int nl80211_send_chandef(struct sk_buff *msg,
|
||||
const struct cfg80211_chan_def *chandef)
|
||||
{
|
||||
WARN_ON(!cfg80211_chandef_valid(chandef));
|
||||
if (WARN_ON(!cfg80211_chandef_valid(chandef)))
|
||||
return -EINVAL;
|
||||
|
||||
if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ,
|
||||
chandef->chan->center_freq))
|
||||
|
|
Loading…
Reference in a new issue