]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
95c238d8758ab404443b3bad242beeb1476af32b
[thirdparty/kernel/stable-queue.git] /
1 From f764cd68d9036498f08fe8834deb6a367b5c2542 Mon Sep 17 00:00:00 2001
2 From: Larry Finger <Larry.Finger@lwfinger.net>
3 Date: Wed, 16 Apr 2014 14:49:33 -0500
4 Subject: staging: r8712u: Fix case where ethtype was never obtained and always be checked against 0
5
6 From: Larry Finger <Larry.Finger@lwfinger.net>
7
8 commit f764cd68d9036498f08fe8834deb6a367b5c2542 upstream.
9
10 Zero-initializing ether_type masked that the ether type would never be
11 obtained for 8021x packets and the comparison against eapol_type
12 would always fail.
13
14 Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
15 Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17
18 ---
19 drivers/staging/rtl8712/rtl871x_recv.c | 13 ++++++-------
20 1 file changed, 6 insertions(+), 7 deletions(-)
21
22 --- a/drivers/staging/rtl8712/rtl871x_recv.c
23 +++ b/drivers/staging/rtl8712/rtl871x_recv.c
24 @@ -254,7 +254,7 @@ union recv_frame *r8712_portctrl(struct
25 struct sta_info *psta;
26 struct sta_priv *pstapriv;
27 union recv_frame *prtnframe;
28 - u16 ether_type = 0;
29 + u16 ether_type;
30
31 pstapriv = &adapter->stapriv;
32 ptr = get_recvframe_data(precv_frame);
33 @@ -263,15 +263,14 @@ union recv_frame *r8712_portctrl(struct
34 psta = r8712_get_stainfo(pstapriv, psta_addr);
35 auth_alg = adapter->securitypriv.AuthAlgrthm;
36 if (auth_alg == 2) {
37 + /* get ether_type */
38 + ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE;
39 + memcpy(&ether_type, ptr, 2);
40 + ether_type = ntohs((unsigned short)ether_type);
41 +
42 if ((psta != NULL) && (psta->ieee8021x_blocked)) {
43 /* blocked
44 * only accept EAPOL frame */
45 - prtnframe = precv_frame;
46 - /*get ether_type */
47 - ptr = ptr + pfhdr->attrib.hdrlen +
48 - pfhdr->attrib.iv_len + LLC_HEADER_SIZE;
49 - memcpy(&ether_type, ptr, 2);
50 - ether_type = ntohs((unsigned short)ether_type);
51 if (ether_type == 0x888e)
52 prtnframe = precv_frame;
53 else {