linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Kazior <michal.kazior@tieto.com>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, Michal Kazior <michal.kazior@tieto.com>
Subject: [PATCH 2/2] mac80211: guard against invalid ptr deref
Date: Tue, 19 May 2015 14:37:01 +0200	[thread overview]
Message-ID: <1432039021-29666-2-git-send-email-michal.kazior@tieto.com> (raw)
In-Reply-To: <1432039021-29666-1-git-send-email-michal.kazior@tieto.com>

Without "cfg80211: ignore netif running state when
changing iftype" it was possible for mac80211 to
crash the system due to an unexpected (and
incorrect) flow.

Even with cfg80211 being fixed it still makes
sense to add a sanity check just in case.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 net/mac80211/cfg.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 3469bbdc891c..74cc789f9c8e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1395,6 +1395,12 @@ static int ieee80211_change_station(struct wiphy *wiphy,
 		vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
 
 		if (params->vlan->ieee80211_ptr->use_4addr) {
+			if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN) {
+				WARN_ON(1);
+				err = -EINVAL;
+				goto out_err;
+			}
+
 			if (vlansdata->u.vlan.sta) {
 				err = -EBUSY;
 				goto out_err;
-- 
2.1.4


  reply	other threads:[~2015-05-19 12:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19 12:37 [PATCH 1/2] cfg80211: ignore netif running state when changing iftype Michal Kazior
2015-05-19 12:37 ` Michal Kazior [this message]
2015-05-20 13:23   ` [PATCH 2/2] mac80211: guard against invalid ptr deref Johannes Berg
2015-05-20 13:17 ` [PATCH 1/2] cfg80211: ignore netif running state when changing iftype Johannes Berg
2015-05-20 13:19   ` Johannes Berg
2015-05-21  7:44     ` Michal Kazior
2015-05-22  8:34       ` Johannes Berg
2015-05-22  8:57 ` [PATCH v2 " Michal Kazior
2015-05-22  8:57   ` [PATCH v2 2/2] mac80211: guard against invalid ptr deref Michal Kazior
2015-05-29 11:10     ` Johannes Berg
2015-05-29 11:34       ` Michal Kazior
2015-05-29 11:39         ` Johannes Berg
2015-05-29 11:48           ` Michal Kazior
2015-05-29 11:07   ` [PATCH v2 1/2] cfg80211: ignore netif running state when changing iftype Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432039021-29666-2-git-send-email-michal.kazior@tieto.com \
    --to=michal.kazior@tieto.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).