Subject: kern/11937: wavelan driver panics on alpha cpus
To: None <gnats-bugs@gnats.netbsd.org>
From: None <weiss@uni-mainz.de>
List: netbsd-bugs
Date: 01/11/2001 12:25:13
>Number:         11937
>Category:       kern
>Synopsis:       wavelan driver panics on alpha cpus
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 11 12:25:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Juergen Weiss
>Release:        1.5
>Organization:
	Universitaet Mainz
>Environment:
NetBSD netzadmin.zdv.Uni-Mainz.DE 1.5 NetBSD 1.5 (MULTIA) #0: Sun Dec  3 21:02:14 MET 2000     root@netzadmin.zdv.Uni-Mainz.DE:/usr/src/sys/arch/alpha/compile/MULTIA alpha

>Description:
	the wi device driver for pcmcia wavelan cards shows problems with buffer
        alignment. This leads to kernel panics because of unaligned access
        on alpha cpus (Dec Multia for example).
>How-To-Repeat:
	Use the wi driver on the alpha platform.
>Fix:
	The following diffs fix the problem.

diff -rc /usr/src.orig/sys/dev/pcmcia/if_wi.c /usr/src/sys/dev/pcmcia/if_wi.c
*** /usr/src.orig/sys/dev/pcmcia/if_wi.c	Tue Oct 17 02:56:32 2000
--- /usr/src/sys/dev/pcmcia/if_wi.c	Sun Dec  3 17:29:47 2000
***************
*** 498,510 ****
  		return;
  	}
  
  	eh = mtod(m, struct ether_header *);
  	m->m_pkthdr.rcvif = ifp;
  
  	if (rx_frame.wi_status == WI_STAT_1042 ||
  	    rx_frame.wi_status == WI_STAT_TUNNEL ||
  	    rx_frame.wi_status == WI_STAT_WMP_MSG) {
! 		if((rx_frame.wi_dat_len + WI_SNAPHDR_LEN) > MCLBYTES) {
  			printf("%s: oversized packet received "
  			    "(wi_dat_len=%d, wi_status=0x%x)\n",
  			    sc->sc_dev.dv_xname,
--- 498,511 ----
  		return;
  	}
  
+ 	m->m_data += 2;
  	eh = mtod(m, struct ether_header *);
  	m->m_pkthdr.rcvif = ifp;
  
  	if (rx_frame.wi_status == WI_STAT_1042 ||
  	    rx_frame.wi_status == WI_STAT_TUNNEL ||
  	    rx_frame.wi_status == WI_STAT_WMP_MSG) {
! 		if((rx_frame.wi_dat_len + WI_SNAPHDR_LEN) > MCLBYTES-2) {
  			printf("%s: oversized packet received "
  			    "(wi_dat_len=%d, wi_status=0x%x)\n",
  			    sc->sc_dev.dv_xname,
***************
*** 532,538 ****
  		}
  	} else {
  		if((rx_frame.wi_dat_len +
! 		    sizeof(struct ether_header)) > MCLBYTES) {
  			printf("%s: oversized packet received "
  			    "(wi_dat_len=%d, wi_status=0x%x)\n",
  			    sc->sc_dev.dv_xname,
--- 533,539 ----
  		}
  	} else {
  		if((rx_frame.wi_dat_len +
! 		    sizeof(struct ether_header)) > MCLBYTES-2) {
  			printf("%s: oversized packet received "
  			    "(wi_dat_len=%d, wi_status=0x%x)\n",
  			    sc->sc_dev.dv_xname,
diff -rc /usr/src.orig/sys/dev/pcmcia/if_wivar.h /usr/src/sys/dev/pcmcia/if_wivar.h
*** /usr/src.orig/sys/dev/pcmcia/if_wivar.h	Fri Jul 21 20:52:11 2000
--- /usr/src/sys/dev/pcmcia/if_wivar.h	Sun Dec  3 17:30:20 2000
***************
*** 76,82 ****
  	struct ieee80211_nwid	wi_netid;
  	struct ieee80211_nwid	wi_ibssid;
  
! 	u_int8_t		wi_txbuf[1596];
  	int                     wi_has_wep;
  	int                     wi_use_wep;
  	int                     wi_tx_key;
--- 76,82 ----
  	struct ieee80211_nwid	wi_netid;
  	struct ieee80211_nwid	wi_ibssid;
  
! 	u_int16_t		wi_txbuf[1596/2];
  	int                     wi_has_wep;
  	int                     wi_use_wep;
  	int                     wi_tx_key;


>Release-Note:
>Audit-Trail:
>Unformatted: