aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-05-23 13:40:19 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-05-23 13:40:19 -0400
commit9cfe864842c755ea6dd683e2449016c7c4ca9867 (patch)
treeae5e77ed14f6bd1d04f4e632a62c48e90a17ee40
parentfd0ff8aa1d95a896b3627bc62d42d6d002ac0bc3 (diff)
parentf41d5bb1d9f49b03af7126d07a511facbe283a92 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [NETFILTER]: SNMP NAT: fix memory corruption [IRDA]: fixup type of ->lsap_state [IRDA]: fix 16/32 bit confusion [NET]: Fix "ntohl(ntohs" bugs [BNX2]: Use kmalloc instead of array [BNX2]: Fix bug in bnx2_nvram_write() [TG3]: Add some missing rx error counters
-rw-r--r--drivers/net/bnx2.c20
-rw-r--r--drivers/net/tg3.c8
-rw-r--r--include/net/irda/irlmp.h2
-rw-r--r--net/ipv4/ipcomp.c2
-rw-r--r--net/ipv4/netfilter/ip_nat_snmp_basic.c15
-rw-r--r--net/ipv4/xfrm4_policy.c2
-rw-r--r--net/ipv6/ipcomp6.c2
-rw-r--r--net/irda/iriap.c3
-rw-r--r--net/xfrm/xfrm_input.c2
9 files changed, 35 insertions, 21 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 5ca99e26660a..54161aef3cac 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -55,8 +55,8 @@
55 55
56#define DRV_MODULE_NAME "bnx2" 56#define DRV_MODULE_NAME "bnx2"
57#define PFX DRV_MODULE_NAME ": " 57#define PFX DRV_MODULE_NAME ": "
58#define DRV_MODULE_VERSION "1.4.39" 58#define DRV_MODULE_VERSION "1.4.40"
59#define DRV_MODULE_RELDATE "March 22, 2006" 59#define DRV_MODULE_RELDATE "May 22, 2006"
60 60
61#define RUN_AT(x) (jiffies + (x)) 61#define RUN_AT(x) (jiffies + (x))
62 62
@@ -2945,7 +2945,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
2945 int buf_size) 2945 int buf_size)
2946{ 2946{
2947 u32 written, offset32, len32; 2947 u32 written, offset32, len32;
2948 u8 *buf, start[4], end[4]; 2948 u8 *buf, start[4], end[4], *flash_buffer = NULL;
2949 int rc = 0; 2949 int rc = 0;
2950 int align_start, align_end; 2950 int align_start, align_end;
2951 2951
@@ -2985,12 +2985,19 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
2985 memcpy(buf + align_start, data_buf, buf_size); 2985 memcpy(buf + align_start, data_buf, buf_size);
2986 } 2986 }
2987 2987
2988 if (bp->flash_info->buffered == 0) {
2989 flash_buffer = kmalloc(264, GFP_KERNEL);
2990 if (flash_buffer == NULL) {
2991 rc = -ENOMEM;
2992 goto nvram_write_end;
2993 }
2994 }
2995
2988 written = 0; 2996 written = 0;
2989 while ((written < len32) && (rc == 0)) { 2997 while ((written < len32) && (rc == 0)) {
2990 u32 page_start, page_end, data_start, data_end; 2998 u32 page_start, page_end, data_start, data_end;
2991 u32 addr, cmd_flags; 2999 u32 addr, cmd_flags;
2992 int i; 3000 int i;
2993 u8 flash_buffer[264];
2994 3001
2995 /* Find the page_start addr */ 3002 /* Find the page_start addr */
2996 page_start = offset32 + written; 3003 page_start = offset32 + written;
@@ -3061,7 +3068,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3061 } 3068 }
3062 3069
3063 /* Loop to write the new data from data_start to data_end */ 3070 /* Loop to write the new data from data_start to data_end */
3064 for (addr = data_start; addr < data_end; addr += 4, i++) { 3071 for (addr = data_start; addr < data_end; addr += 4, i += 4) {
3065 if ((addr == page_end - 4) || 3072 if ((addr == page_end - 4) ||
3066 ((bp->flash_info->buffered) && 3073 ((bp->flash_info->buffered) &&
3067 (addr == data_end - 4))) { 3074 (addr == data_end - 4))) {
@@ -3109,6 +3116,9 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3109 } 3116 }
3110 3117
3111nvram_write_end: 3118nvram_write_end:
3119 if (bp->flash_info->buffered == 0)
3120 kfree(flash_buffer);
3121
3112 if (align_start || align_end) 3122 if (align_start || align_end)
3113 kfree(buf); 3123 kfree(buf);
3114 return rc; 3124 return rc;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index e1b33a25a25f..49ad60b72657 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -69,8 +69,8 @@
69 69
70#define DRV_MODULE_NAME "tg3" 70#define DRV_MODULE_NAME "tg3"
71#define PFX DRV_MODULE_NAME ": " 71#define PFX DRV_MODULE_NAME ": "
72#define DRV_MODULE_VERSION "3.57" 72#define DRV_MODULE_VERSION "3.58"
73#define DRV_MODULE_RELDATE "Apr 28, 2006" 73#define DRV_MODULE_RELDATE "May 22, 2006"
74 74
75#define TG3_DEF_MAC_MODE 0 75#define TG3_DEF_MAC_MODE 0
76#define TG3_DEF_RX_MODE 0 76#define TG3_DEF_RX_MODE 0
@@ -6488,6 +6488,10 @@ static void tg3_periodic_fetch_stats(struct tg3 *tp)
6488 TG3_STAT_ADD32(&sp->rx_frame_too_long_errors, MAC_RX_STATS_FRAME_TOO_LONG); 6488 TG3_STAT_ADD32(&sp->rx_frame_too_long_errors, MAC_RX_STATS_FRAME_TOO_LONG);
6489 TG3_STAT_ADD32(&sp->rx_jabbers, MAC_RX_STATS_JABBERS); 6489 TG3_STAT_ADD32(&sp->rx_jabbers, MAC_RX_STATS_JABBERS);
6490 TG3_STAT_ADD32(&sp->rx_undersize_packets, MAC_RX_STATS_UNDERSIZE); 6490 TG3_STAT_ADD32(&sp->rx_undersize_packets, MAC_RX_STATS_UNDERSIZE);
6491
6492 TG3_STAT_ADD32(&sp->rxbds_empty, RCVLPC_NO_RCV_BD_CNT);
6493 TG3_STAT_ADD32(&sp->rx_discards, RCVLPC_IN_DISCARDS_CNT);
6494 TG3_STAT_ADD32(&sp->rx_errors, RCVLPC_IN_ERRORS_CNT);
6491} 6495}
6492 6496
6493static void tg3_timer(unsigned long __opaque) 6497static void tg3_timer(unsigned long __opaque)
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h
index 86aefb1fda5e..c0c895d379ba 100644
--- a/include/net/irda/irlmp.h
+++ b/include/net/irda/irlmp.h
@@ -112,7 +112,7 @@ struct lsap_cb {
112 112
113 struct timer_list watchdog_timer; 113 struct timer_list watchdog_timer;
114 114
115 IRLMP_STATE lsap_state; /* Connection state */ 115 LSAP_STATE lsap_state; /* Connection state */
116 notify_t notify; /* Indication/Confirm entry points */ 116 notify_t notify; /* Indication/Confirm entry points */
117 struct qos_info qos; /* QoS for this connection */ 117 struct qos_info qos; /* QoS for this connection */
118 118
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index cd810f41af1a..95278b22b669 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -210,7 +210,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
210 skb->h.icmph->code != ICMP_FRAG_NEEDED) 210 skb->h.icmph->code != ICMP_FRAG_NEEDED)
211 return; 211 return;
212 212
213 spi = ntohl(ntohs(ipch->cpi)); 213 spi = htonl(ntohs(ipch->cpi));
214 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, 214 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr,
215 spi, IPPROTO_COMP, AF_INET); 215 spi, IPPROTO_COMP, AF_INET);
216 if (!x) 216 if (!x)
diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c
index c62253845538..688a2f29fadf 100644
--- a/net/ipv4/netfilter/ip_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c
@@ -1003,12 +1003,12 @@ static unsigned char snmp_trap_decode(struct asn1_ctx *ctx,
1003 1003
1004 return 1; 1004 return 1;
1005 1005
1006err_addr_free:
1007 kfree((unsigned long *)trap->ip_address);
1008
1006err_id_free: 1009err_id_free:
1007 kfree(trap->id); 1010 kfree(trap->id);
1008 1011
1009err_addr_free:
1010 kfree((unsigned long *)trap->ip_address);
1011
1012 return 0; 1012 return 0;
1013} 1013}
1014 1014
@@ -1126,11 +1126,10 @@ static int snmp_parse_mangle(unsigned char *msg,
1126 struct snmp_v1_trap trap; 1126 struct snmp_v1_trap trap;
1127 unsigned char ret = snmp_trap_decode(&ctx, &trap, map, check); 1127 unsigned char ret = snmp_trap_decode(&ctx, &trap, map, check);
1128 1128
1129 /* Discard trap allocations regardless */ 1129 if (ret) {
1130 kfree(trap.id); 1130 kfree(trap.id);
1131 kfree((unsigned long *)trap.ip_address); 1131 kfree((unsigned long *)trap.ip_address);
1132 1132 } else
1133 if (!ret)
1134 return ret; 1133 return ret;
1135 1134
1136 } else { 1135 } else {
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index f285bbf296e2..8604c747bca5 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -221,7 +221,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl)
221 if (pskb_may_pull(skb, xprth + 4 - skb->data)) { 221 if (pskb_may_pull(skb, xprth + 4 - skb->data)) {
222 u16 *ipcomp_hdr = (u16 *)xprth; 222 u16 *ipcomp_hdr = (u16 *)xprth;
223 223
224 fl->fl_ipsec_spi = ntohl(ntohs(ipcomp_hdr[1])); 224 fl->fl_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
225 } 225 }
226 break; 226 break;
227 default: 227 default:
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 05eb67def39f..48636436028a 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -208,7 +208,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
208 if (type != ICMPV6_DEST_UNREACH && type != ICMPV6_PKT_TOOBIG) 208 if (type != ICMPV6_DEST_UNREACH && type != ICMPV6_PKT_TOOBIG)
209 return; 209 return;
210 210
211 spi = ntohl(ntohs(ipcomph->cpi)); 211 spi = htonl(ntohs(ipcomph->cpi));
212 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, IPPROTO_COMP, AF_INET6); 212 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, IPPROTO_COMP, AF_INET6);
213 if (!x) 213 if (!x)
214 return; 214 return;
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index 254f90746900..2d2e2b1919f4 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -544,7 +544,8 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self,
544{ 544{
545 struct sk_buff *tx_skb; 545 struct sk_buff *tx_skb;
546 int n; 546 int n;
547 __u32 tmp_be32, tmp_be16; 547 __u32 tmp_be32;
548 __be16 tmp_be16;
548 __u8 *fp; 549 __u8 *fp;
549 550
550 IRDA_DEBUG(4, "%s()\n", __FUNCTION__); 551 IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index b54971059f16..891a6090cc09 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -62,7 +62,7 @@ int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq)
62 case IPPROTO_COMP: 62 case IPPROTO_COMP:
63 if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr))) 63 if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr)))
64 return -EINVAL; 64 return -EINVAL;
65 *spi = ntohl(ntohs(*(u16*)(skb->h.raw + 2))); 65 *spi = htonl(ntohs(*(u16*)(skb->h.raw + 2)));
66 *seq = 0; 66 *seq = 0;
67 return 0; 67 return 0;
68 default: 68 default: