All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Bob Copeland <me@bobcopeland.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, devel@lists.open80211s.org,
	Bob Copeland <me@bobcopeland.com>
Subject: [PATCH v3 2/5] mac80211: add missing length check for confirm frames
Date: Tue, 14 Jul 2015 08:31:56 -0400	[thread overview]
Message-ID: <1436877119-17577-3-git-send-email-me@bobcopeland.com> (raw)
In-Reply-To: <1436877119-17577-1-git-send-email-me@bobcopeland.com>

Although mesh_rx_plink_frame() already checks that frames have enough
bytes for the action code plus another two bytes for capability/reason
code, it doesn't take into account that confirm frames also have an
additional two-byte aid.  As a result, a corrupt frame could cause a
subsequent subtraction to wrap around to ill effect.  Add another
check for this case.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
---

v3: newly introduced

 net/mac80211/mesh_plink.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 956384087e12..ac1029f28133 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -1123,6 +1123,9 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
 						WLAN_SP_MESH_PEERING_CONFIRM) {
 		baseaddr += 4;
 		baselen += 4;
+
+		if (baselen > len)
+			return;
 	}
 	ieee802_11_parse_elems(baseaddr, len - baselen, true, &elems);
 	mesh_process_plink_frame(sdata, mgmt, &elems);
-- 
2.1.4


  parent reply	other threads:[~2015-07-14 12:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 12:31 [PATCH v3 0/5] mesh AID fixes Bob Copeland
2015-07-14 12:31 ` [PATCH v3 1/5] mac80211: correct aid location in peering frames Bob Copeland
2015-07-17 12:38   ` Johannes Berg
2015-07-14 12:31 ` Bob Copeland [this message]
2015-07-17 12:39   ` [PATCH v3 2/5] mac80211: add missing length check for confirm frames Johannes Berg
2015-07-14 12:31 ` [PATCH v3 3/5] mac80211: reorder mesh_plink to remove forward decl Bob Copeland
2015-07-14 12:31 ` [PATCH v3 4/5] mac80211: mesh: separate plid and aid concepts Bob Copeland
2015-07-14 12:31 ` [PATCH v3 5/5] mac80211: select an AID when creating new mesh STAs Bob Copeland
2015-07-17 13:48   ` Johannes Berg
2015-07-17 14:48     ` Johannes Berg
2015-07-17 14:50       ` Johannes Berg
2015-07-17 15:13         ` Bob Copeland

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=1436877119-17577-3-git-send-email-me@bobcopeland.com \
    --to=me@bobcopeland.com \
    --cc=devel@lists.open80211s.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.