diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-11-08 07:34:11 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-11-08 07:34:11 -0800 |
commit | 3ee783a3e4867ce5691bfa6a818959e88a50f209 (patch) | |
tree | 4263289a5f8551500c0c66bbb0c7ab01a4e8e075 /net/decnet/af_decnet.c | |
parent | 80c218812786f619c9a1ce50d0e7c32c7afde4de (diff) | |
parent | 375d9d71838970030c8e0bf0ac2abcc1a3487df8 (diff) | |
download | kernel_samsung_smdk4412-3ee783a3e4867ce5691bfa6a818959e88a50f209.tar.gz kernel_samsung_smdk4412-3ee783a3e4867ce5691bfa6a818959e88a50f209.tar.bz2 kernel_samsung_smdk4412-3ee783a3e4867ce5691bfa6a818959e88a50f209.zip |
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:
[DECNET]: Endianess fixes (try #2)
[TG3]: Fix array overrun in tg3_read_partno().
[NET]: Set truesize in pskb_copy
[NETPOLL]: Compute checksum properly in netpoll_send_udp().
[PKT_SCHED] sch_htb: Use hlist_del_init().
[TCP]: Don't use highmem in tcp hash size calculation.
[NET]: kconfig, correct traffic shaper
Diffstat (limited to 'net/decnet/af_decnet.c')
-rw-r--r-- | net/decnet/af_decnet.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 3456cd33183..21f20f21dd3 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c @@ -166,7 +166,7 @@ static struct hlist_head *dn_find_list(struct sock *sk) if (scp->addr.sdn_flags & SDF_WILD) return hlist_empty(&dn_wild_sk) ? &dn_wild_sk : NULL; - return &dn_sk_hash[scp->addrloc & DN_SK_HASH_MASK]; + return &dn_sk_hash[dn_ntohs(scp->addrloc) & DN_SK_HASH_MASK]; } /* @@ -180,7 +180,7 @@ static int check_port(__le16 port) if (port == 0) return -1; - sk_for_each(sk, node, &dn_sk_hash[port & DN_SK_HASH_MASK]) { + sk_for_each(sk, node, &dn_sk_hash[dn_ntohs(port) & DN_SK_HASH_MASK]) { struct dn_scp *scp = DN_SK(sk); if (scp->addrloc == port) return -1; @@ -194,12 +194,12 @@ static unsigned short port_alloc(struct sock *sk) static unsigned short port = 0x2000; unsigned short i_port = port; - while(check_port(++port) != 0) { + while(check_port(dn_htons(++port)) != 0) { if (port == i_port) return 0; } - scp->addrloc = port; + scp->addrloc = dn_htons(port); return 1; } @@ -418,7 +418,7 @@ struct sock *dn_find_by_skb(struct sk_buff *skb) struct dn_scp *scp; read_lock(&dn_hash_lock); - sk_for_each(sk, node, &dn_sk_hash[cb->dst_port & DN_SK_HASH_MASK]) { + sk_for_each(sk, node, &dn_sk_hash[dn_ntohs(cb->dst_port) & DN_SK_HASH_MASK]) { scp = DN_SK(sk); if (cb->src != dn_saddr2dn(&scp->peer)) continue; @@ -1016,13 +1016,14 @@ static void dn_access_copy(struct sk_buff *skb, struct accessdata_dn *acc) static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt) { - unsigned char *ptr = skb->data; - - opt->opt_optl = *ptr++; - opt->opt_status = 0; - memcpy(opt->opt_data, ptr, opt->opt_optl); - skb_pull(skb, dn_ntohs(opt->opt_optl) + 1); - + unsigned char *ptr = skb->data; + u16 len = *ptr++; /* yes, it's 8bit on the wire */ + + BUG_ON(len > 16); /* we've checked the contents earlier */ + opt->opt_optl = dn_htons(len); + opt->opt_status = 0; + memcpy(opt->opt_data, ptr, len); + skb_pull(skb, len + 1); } static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo) |