Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: r8712u: Fix case where ethtype was never obtained and always be checked against 0

Zero-initializing ether_type masked that the ether type would never be
obtained for 8021x packets and the comparison against eapol_type
would always fail.

Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Larry Finger and committed by
Greg Kroah-Hartman
f764cd68 9452bf56

+6 -7
+6 -7
drivers/staging/rtl8712/rtl871x_recv.c
··· 254 254 struct sta_info *psta; 255 255 struct sta_priv *pstapriv; 256 256 union recv_frame *prtnframe; 257 - u16 ether_type = 0; 257 + u16 ether_type; 258 258 259 259 pstapriv = &adapter->stapriv; 260 260 ptr = get_recvframe_data(precv_frame); ··· 263 263 psta = r8712_get_stainfo(pstapriv, psta_addr); 264 264 auth_alg = adapter->securitypriv.AuthAlgrthm; 265 265 if (auth_alg == 2) { 266 + /* get ether_type */ 267 + ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE; 268 + memcpy(&ether_type, ptr, 2); 269 + ether_type = ntohs((unsigned short)ether_type); 270 + 266 271 if ((psta != NULL) && (psta->ieee8021x_blocked)) { 267 272 /* blocked 268 273 * only accept EAPOL frame */ 269 - prtnframe = precv_frame; 270 - /*get ether_type */ 271 - ptr = ptr + pfhdr->attrib.hdrlen + 272 - pfhdr->attrib.iv_len + LLC_HEADER_SIZE; 273 - memcpy(&ether_type, ptr, 2); 274 - ether_type = ntohs((unsigned short)ether_type); 275 274 if (ether_type == 0x888e) 276 275 prtnframe = precv_frame; 277 276 else {