patch-2.2.8 linux/drivers/net/ibmtr.c

Next file: linux/drivers/net/ppp.c
Previous file: linux/drivers/net/ethertap.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.7/linux/drivers/net/ibmtr.c linux/drivers/net/ibmtr.c
@@ -513,6 +513,7 @@
 	/* How much shared RAM is on adapter ? */
 #ifdef PCMCIA
 	ti->avail_shared_ram = pcmcia_reality_check(get_sram_size(ti));
+	ibmtr_mem_base = ti->sram_base ; 
 #else
 	ti->avail_shared_ram = get_sram_size(ti);
 #endif
@@ -1498,6 +1499,7 @@
 	       ti->asb + offsetof(struct asb_rec, rec_buf_addr));
 
 	lan_hdr_len=readb(ti->arb + offsetof(struct arb_rec_req, lan_hdr_len));
+	hdr_len = lan_hdr_len + sizeof(struct trllc) + sizeof(struct iphdr);
 	
 	llc=(rbuffer + offsetof(struct rec_buf, data) + lan_hdr_len);
 
@@ -1524,8 +1526,10 @@
 		return;
 	}
 
+	length = ntohs(readw(ti->arb+offsetof(struct arb_rec_req, frame_len)));
        	if ((readb(llc + offsetof(struct trllc, dsap))==EXTENDED_SAP) &&
-       	    (readb(llc + offsetof(struct trllc, ssap))==EXTENDED_SAP)) {
+       	    (readb(llc + offsetof(struct trllc, ssap))==EXTENDED_SAP) &&
+		(length>=hdr_len)) {
        		IPv4_p = 1;
        	}
 
@@ -1556,7 +1560,6 @@
        	}
 #endif
 
-       	length = ntohs(readw(ti->arb+offsetof(struct arb_rec_req, frame_len)));
        	skb_size = length-lan_hdr_len+sizeof(struct trh_hdr)+sizeof(struct trllc);
  
        	if (!(skb=dev_alloc_skb(skb_size))) {
@@ -1576,7 +1579,6 @@
 
 	if (IPv4_p) {
                 /* Copy the headers without checksumming */
-		hdr_len = lan_hdr_len + sizeof(struct trllc) + sizeof(struct iphdr);
 		memcpy_fromio(data, rbufdata, hdr_len);
 
 		/* Watch for padded packets and bogons */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)