Blob Blame History Raw
From 265698d7e6132a2d41471135534f4f36ad15b09c Mon Sep 17 00:00:00 2001
From: Johannes Berg <johannes.berg@intel.com>
Date: Mon, 18 Sep 2017 22:46:36 +0200
Subject: [PATCH] nl80211: fix null-ptr dereference on invalid mesh configuration
Git-commit: 265698d7e6132a2d41471135534f4f36ad15b09c
Patch-mainline: v4.14-rc2
References: bsc#1051510

If TX rates are specified during mesh join, the channel must
also be specified. Check the channel pointer to avoid a null
pointer dereference if it isn't.

Reported-by: Jouni Malinen <j@w1.fi>
Fixes: 8564e38206de ("cfg80211: add checks for beacon rate, extend to mesh")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 net/wireless/nl80211.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -9960,6 +9960,9 @@ static int nl80211_join_mesh(struct sk_b
 		if (err)
 			return err;
 
+		if (!setup.chandef.chan)
+			return -EINVAL;
+
 		err = validate_beacon_tx_rate(rdev, setup.chandef.chan->band,
 					      &setup.beacon_rate);
 		if (err)