From 047f7617eba3653ff3bcfbe902986903fff2ed3b Mon Sep 17 00:00:00 2001 From: Bernard Pidoux Date: Sun, 20 Apr 2008 15:58:07 -0700 Subject: [ROSE]: Fix soft lockup wrt. rose_node_list_lock [ INFO: possible recursive locking detected ] 2.6.25 #3 --------------------------------------------- ax25ipd/3811 is trying to acquire lock: (rose_node_list_lock){-+..}, at: [] rose_get_neigh+0x1a/0xa0 [rose] but task is already holding lock: (rose_node_list_lock){-+..}, at: [] rose_route_frame+0x4d/0x620 [rose] other info that might help us debug this: 6 locks held by ax25ipd/3811: #0: (&tty->atomic_write_lock){--..}, at: [] tty_write_lock+0x1c/0x50 #1: (rcu_read_lock){..--}, at: [] net_rx_action+0x96/0x230 #2: (rcu_read_lock){..--}, at: [] netif_receive_skb+0x100/0x2f0 #3: (rose_node_list_lock){-+..}, at: [] rose_route_frame+0x4d/0x620 [rose] #4: (rose_neigh_list_lock){-+..}, at: [] rose_route_frame+0x57/0x620 [rose] #5: (rose_route_list_lock){-+..}, at: [] rose_route_frame+0x61/0x620 [rose] stack backtrace: Pid: 3811, comm: ax25ipd Not tainted 2.6.25 #3 [] print_deadlock_bug+0xc7/0xd0 [] check_deadlock+0x9a/0xb0 [] validate_chain+0x1e2/0x310 [] ? validate_chain+0xa5/0x310 [] ? native_sched_clock+0x88/0xc0 [] __lock_acquire+0x1a1/0x750 [] lock_acquire+0x81/0xa0 [] ? rose_get_neigh+0x1a/0xa0 [rose] [] _spin_lock_bh+0x33/0x60 [] ? rose_get_neigh+0x1a/0xa0 [rose] [] rose_get_neigh+0x1a/0xa0 [rose] [] rose_route_frame+0x464/0x620 [rose] [] ? _read_unlock+0x1d/0x20 [] ? rose_route_frame+0x0/0x620 [rose] [] ax25_rx_iframe+0x66/0x3b0 [ax25] [] ? ax25_start_t3timer+0x1f/0x40 [ax25] [] ax25_std_frame_in+0x7fb/0x890 [ax25] [] ? _spin_unlock_bh+0x25/0x30 [] ax25_kiss_rcv+0x2c6/0x800 [ax25] [] ? sock_def_readable+0x59/0x80 [] ? __lock_release+0x47/0x70 [] ? sock_def_readable+0x59/0x80 [] ? _read_unlock+0x1d/0x20 [] ? sock_def_readable+0x59/0x80 [] ? sock_queue_rcv_skb+0x13a/0x1d0 [] ? sock_queue_rcv_skb+0x45/0x1d0 [] ? ax25_kiss_rcv+0x0/0x800 [ax25] [] netif_receive_skb+0x255/0x2f0 [] ? netif_receive_skb+0x100/0x2f0 [] process_backlog+0x7c/0xf0 [] net_rx_action+0x16c/0x230 [] ? net_rx_action+0x96/0x230 [] __do_softirq+0x93/0x120 [] ? mkiss_receive_buf+0x33a/0x3f0 [mkiss] [] do_softirq+0x57/0x60 [] local_bh_enable_ip+0xa5/0xe0 [] _spin_unlock_bh+0x25/0x30 [] mkiss_receive_buf+0x33a/0x3f0 [mkiss] [] pty_write+0x47/0x60 [] write_chan+0x1b0/0x220 [] ? tty_write_lock+0x1c/0x50 [] ? default_wake_function+0x0/0x10 [] tty_write+0x12a/0x1c0 [] ? write_chan+0x0/0x220 [] vfs_write+0x96/0x130 [] ? tty_write+0x0/0x1c0 [] sys_write+0x3d/0x70 [] sysenter_past_esp+0x5f/0xa5 ======================= BUG: soft lockup - CPU#0 stuck for 61s! [ax25ipd:3811] Pid: 3811, comm: ax25ipd Not tainted (2.6.25 #3) EIP: 0060:[] EFLAGS: 00000246 CPU: 0 EIP is at native_read_tsc+0xb/0x20 EAX: b404aa2c EBX: b404a9c9 ECX: 017f1000 EDX: 0000076b ESI: 00000001 EDI: 00000000 EBP: ecc83afc ESP: ecc83afc DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 CR0: 8005003b CR2: b7f5f000 CR3: 2cd8e000 CR4: 000006f0 DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000 DR6: ffff0ff0 DR7: 00000400 [] delay_tsc+0x17/0x30 [] __delay+0x9/0x10 [] __spin_lock_debug+0x76/0xf0 [] ? spin_bug+0x18/0x100 [] ? __lock_contended+0xa3/0x110 [] _raw_spin_lock+0x68/0x90 [] _spin_lock_bh+0x4f/0x60 [] ? rose_get_neigh+0x1a/0xa0 [rose] [] rose_get_neigh+0x1a/0xa0 [rose] [] rose_route_frame+0x464/0x620 [rose] [] ? _read_unlock+0x1d/0x20 [] ? rose_route_frame+0x0/0x620 [rose] [] ax25_rx_iframe+0x66/0x3b0 [ax25] [] ? ax25_start_t3timer+0x1f/0x40 [ax25] [] ax25_std_frame_in+0x7fb/0x890 [ax25] [] ? _spin_unlock_bh+0x25/0x30 [] ax25_kiss_rcv+0x2c6/0x800 [ax25] [] ? sock_def_readable+0x59/0x80 [] ? __lock_release+0x47/0x70 [] ? sock_def_readable+0x59/0x80 [] ? _read_unlock+0x1d/0x20 [] ? sock_def_readable+0x59/0x80 [] ? sock_queue_rcv_skb+0x13a/0x1d0 [] ? sock_queue_rcv_skb+0x45/0x1d0 [] ? ax25_kiss_rcv+0x0/0x800 [ax25] [] netif_receive_skb+0x255/0x2f0 [] ? netif_receive_skb+0x100/0x2f0 [] process_backlog+0x7c/0xf0 [] net_rx_action+0x16c/0x230 [] ? net_rx_action+0x96/0x230 [] __do_softirq+0x93/0x120 [] ? mkiss_receive_buf+0x33a/0x3f0 [mkiss] [] do_softirq+0x57/0x60 [] local_bh_enable_ip+0xa5/0xe0 [] _spin_unlock_bh+0x25/0x30 [] mkiss_receive_buf+0x33a/0x3f0 [mkiss] [] pty_write+0x47/0x60 [] write_chan+0x1b0/0x220 [] ? tty_write_lock+0x1c/0x50 [] ? default_wake_function+0x0/0x10 [] tty_write+0x12a/0x1c0 [] ? write_chan+0x0/0x220 [] vfs_write+0x96/0x130 [] ? tty_write+0x0/0x1c0 [] sys_write+0x3d/0x70 [] sysenter_past_esp+0x5f/0xa5 ======================= Since rose_route_frame() does not use rose_node_list we can safely remove rose_node_list_lock spin lock here and let it be free for rose_get_neigh(). Signed-off-by: Bernard Pidoux Signed-off-by: David S. Miller --- net/rose/rose_route.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'net') diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index fb9359fb235..5053a53ba24 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c @@ -857,7 +857,6 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) src_addr = (rose_address *)(skb->data + 9); dest_addr = (rose_address *)(skb->data + 4); - spin_lock_bh(&rose_node_list_lock); spin_lock_bh(&rose_neigh_list_lock); spin_lock_bh(&rose_route_list_lock); @@ -1060,7 +1059,6 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) out: spin_unlock_bh(&rose_route_list_lock); spin_unlock_bh(&rose_neigh_list_lock); - spin_unlock_bh(&rose_node_list_lock); return res; } -- cgit v1.2.3 From 9d29672c64505f2d7f707701b829715705308a69 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 20 Apr 2008 16:07:43 -0700 Subject: [NET]: Expose netdevice dev_id through sysfs Expose dev_id to userspace, because it helps to disambiguate between interfaces where the MAC address is unique. This should allow us to simplify the handling of persistent naming for S390 network devices in udev -- because it can depend on a simple attribute of the device like the other match criteria, rather than having a special case for SUBSYSTEMS=="ccwgroup". Signed-off-by: David Woodhouse Signed-off-by: David S. Miller --- net/core/net-sysfs.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'net') diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 7635d3f7272..4e7b847347f 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -87,6 +87,7 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr, return ret; } +NETDEVICE_SHOW(dev_id, fmt_hex); NETDEVICE_SHOW(addr_len, fmt_dec); NETDEVICE_SHOW(iflink, fmt_dec); NETDEVICE_SHOW(ifindex, fmt_dec); @@ -210,6 +211,7 @@ static ssize_t store_tx_queue_len(struct device *dev, static struct device_attribute net_class_attributes[] = { __ATTR(addr_len, S_IRUGO, show_addr_len, NULL), + __ATTR(dev_id, S_IRUGO, show_dev_id, NULL), __ATTR(iflink, S_IRUGO, show_iflink, NULL), __ATTR(ifindex, S_IRUGO, show_ifindex, NULL), __ATTR(features, S_IRUGO, show_features, NULL), -- cgit v1.2.3 From 1f29b0584dcb695589407a11bb7533fe21fa47c4 Mon Sep 17 00:00:00 2001 From: Satoru SATOH Date: Mon, 21 Apr 2008 02:27:58 -0700 Subject: tcp: Trivial fix to correct function name in a comment in net/ipv4/tcp.c This is a trivial fix to correct function name in a comment in net/ipv4/tcp.c. Signed-off-by: Satoru SATOH Signed-off-by: David S. Miller --- net/ipv4/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 58ac838bf46..f8865313862 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1722,7 +1722,7 @@ static int tcp_close_state(struct sock *sk) /* * Shutdown the sending side of a connection. Much like close except - * that we don't receive shut down or set_sock_flag(sk, SOCK_DEAD). + * that we don't receive shut down or sock_set_flag(sk, SOCK_DEAD). */ void tcp_shutdown(struct sock *sk, int how) -- cgit v1.2.3 From 280a34c87fe07cb15df19bd798b23740223350fb Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Mon, 21 Apr 2008 02:29:32 -0700 Subject: [IPV6]: Make struct ip6_prohibit_entry_template static. This patch makes the needlessly global struct ip6_prohibit_entry_template static. Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- net/ipv6/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 210a079cfc6..1f42bc960bd 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -150,7 +150,7 @@ static struct rt6_info ip6_null_entry_template = { static int ip6_pkt_prohibit(struct sk_buff *skb); static int ip6_pkt_prohibit_out(struct sk_buff *skb); -struct rt6_info ip6_prohibit_entry_template = { +static struct rt6_info ip6_prohibit_entry_template = { .u = { .dst = { .__refcnt = ATOMIC_INIT(1), -- cgit v1.2.3 From 263173af5b4635c07dd862255e5b767cd429c640 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Mon, 21 Apr 2008 02:31:23 -0700 Subject: [IPV4]: Make icmp_sk_init() static. This patch makes the needlessly global icmp_sk_init() static. Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- net/ipv4/icmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index f064031f203..fee171ec658 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -1144,7 +1144,7 @@ static void __net_exit icmp_sk_exit(struct net *net) net->ipv4.icmp_sk = NULL; } -int __net_init icmp_sk_init(struct net *net) +static int __net_init icmp_sk_init(struct net *net) { int i, err; -- cgit v1.2.3 From f25c3d613b12b4b6219d03e9930cac5f59541468 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Mon, 21 Apr 2008 02:34:08 -0700 Subject: [IPV4]: Convert do_gettimeofday() to getnstimeofday(). What do_gettimeofday() does is to call getnstimeofday() and to convert the result from timespec{} to timeval{}. After that, these callers convert the result again to msec. Use getnstimeofday() and convert the units at once. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- net/ipv4/icmp.c | 8 ++++---- net/ipv4/ip_options.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'net') diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index fee171ec658..c67d00e8c60 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -847,7 +847,7 @@ static void icmp_echo(struct sk_buff *skb) */ static void icmp_timestamp(struct sk_buff *skb) { - struct timeval tv; + struct timespec tv; struct icmp_bxm icmp_param; /* * Too short. @@ -858,9 +858,9 @@ static void icmp_timestamp(struct sk_buff *skb) /* * Fill in the current time as ms since midnight UT: */ - do_gettimeofday(&tv); - icmp_param.data.times[1] = htonl((tv.tv_sec % 86400) * 1000 + - tv.tv_usec / 1000); + getnstimeofday(&tv); + icmp_param.data.times[1] = htonl((tv.tv_sec % 86400) * MSEC_PER_SEC + + tv.tv_nsec / NSEC_PER_MSEC); icmp_param.data.times[2] = icmp_param.data.times[1]; if (skb_copy_bits(skb, 0, &icmp_param.data.times[0], 4)) BUG(); diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index d107543d3f8..33126ad2cfd 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c @@ -55,10 +55,10 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt, if (opt->ts_needaddr) ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, rt); if (opt->ts_needtime) { - struct timeval tv; + struct timespec tv; __be32 midtime; - do_gettimeofday(&tv); - midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); + getnstimeofday(&tv); + midtime = htonl((tv.tv_sec % 86400) * MSEC_PER_SEC + tv.tv_nsec / NSEC_PER_MSEC); memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4); } return; @@ -406,10 +406,10 @@ int ip_options_compile(struct net *net, break; } if (timeptr) { - struct timeval tv; + struct timespec tv; __be32 midtime; - do_gettimeofday(&tv); - midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); + getnstimeofday(&tv); + midtime = htonl((tv.tv_sec % 86400) * MSEC_PER_SEC + tv.tv_nsec / NSEC_PER_MSEC); memcpy(timeptr, &midtime, sizeof(__be32)); opt->is_changed = 1; } -- cgit v1.2.3 From 2aed2827dfc2e7d2e385fc1580529a8fc7f33d47 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 21 Apr 2008 14:23:03 -0700 Subject: [NETNS]: The ip6_fib_timer can work with garbage on net namespace stop. The del_timer() function doesn't guarantee, that the timer callback is not active by the time it exits. Thus, the fib6_net_exit() may kfree() all the data, that is required by the fib6_run_gc(). The race window is tiny, but slab poisoning can trigger this bug. Using del_timer_sync() will cure this. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- net/ipv6/ip6_fib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 50f3f8f8a59..1ee4fa17c12 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -1543,7 +1543,7 @@ out_timer: static void fib6_net_exit(struct net *net) { rt6_ifdown(net, NULL); - del_timer(net->ipv6.ip6_fib_timer); + del_timer_sync(net->ipv6.ip6_fib_timer); kfree(net->ipv6.ip6_fib_timer); #ifdef CONFIG_IPV6_MULTIPLE_TABLES kfree(net->ipv6.fib6_local_tbl); -- cgit v1.2.3 From 633d424bf33dab99e77b36210fbd1b996e7823df Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 21 Apr 2008 14:25:23 -0700 Subject: [NETNS]: Don't initialize err variable twice. The ip6_route_net_init() performs some unneeded actions. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- net/ipv6/route.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'net') diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 1f42bc960bd..a493ad9b891 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -2614,9 +2614,8 @@ struct ctl_table *ipv6_route_sysctl_init(struct net *net) static int ip6_route_net_init(struct net *net) { - int ret = 0; + int ret = -ENOMEM; - ret = -ENOMEM; net->ipv6.ip6_dst_ops = kmemdup(&ip6_dst_ops_template, sizeof(*net->ipv6.ip6_dst_ops), GFP_KERNEL); -- cgit v1.2.3 From cdd04d98f6922f5a7ba52714f077140d42bc67c9 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Mon, 21 Apr 2008 14:28:45 -0700 Subject: [DCCP]: Convert do_gettimeofday() to getnstimeofday(). What do_gettimeofday() does is to call getnstimeofday() and to convert the result from timespec{} to timeval{}. We do not always need timeval{} and we can convert timespec{} when we really need (to print). Signed-off-by: YOSHIFUJI Hideaki Acked-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- net/dccp/probe.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'net') diff --git a/net/dccp/probe.c b/net/dccp/probe.c index 7053bb827bc..6e1df62bd7c 100644 --- a/net/dccp/probe.c +++ b/net/dccp/probe.c @@ -46,29 +46,24 @@ struct { struct kfifo *fifo; spinlock_t lock; wait_queue_head_t wait; - struct timeval tstart; + struct timespec tstart; } dccpw; static void printl(const char *fmt, ...) { va_list args; int len; - struct timeval now; + struct timespec now; char tbuf[256]; va_start(args, fmt); - do_gettimeofday(&now); + getnstimeofday(&now); - now.tv_sec -= dccpw.tstart.tv_sec; - now.tv_usec -= dccpw.tstart.tv_usec; - if (now.tv_usec < 0) { - --now.tv_sec; - now.tv_usec += 1000000; - } + now = timespec_sub(now, dccpw.tstart); len = sprintf(tbuf, "%lu.%06lu ", (unsigned long) now.tv_sec, - (unsigned long) now.tv_usec); + (unsigned long) now.tv_nsec / NSEC_PER_USEC); len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args); va_end(args); @@ -119,7 +114,7 @@ static struct jprobe dccp_send_probe = { static int dccpprobe_open(struct inode *inode, struct file *file) { kfifo_reset(dccpw.fifo); - do_gettimeofday(&dccpw.tstart); + getnstimeofday(&dccpw.tstart); return 0; } -- cgit v1.2.3 From 92998dd4951a84cbde447eeac4af5770718864b8 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 21 Apr 2008 14:33:16 -0700 Subject: [NETNS]: Remove empty ->init callback. The netns start-stop engine can happily live with any of init or exit callbacks set to NULL. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- net/ipv6/addrconf.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'net') diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 8a0fd4007bd..e591e09e5e4 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -4338,12 +4338,6 @@ int unregister_inet6addr_notifier(struct notifier_block *nb) EXPORT_SYMBOL(unregister_inet6addr_notifier); - -static int addrconf_net_init(struct net *net) -{ - return 0; -} - static void addrconf_net_exit(struct net *net) { struct net_device *dev; @@ -4360,7 +4354,6 @@ static void addrconf_net_exit(struct net *net) } static struct pernet_operations addrconf_net_ops = { - .init = addrconf_net_init, .exit = addrconf_net_exit, }; -- cgit v1.2.3 From d7ee147d4f84219a44670eb0db3a91e58d14a81c Mon Sep 17 00:00:00 2001 From: Arnd Hannemann Date: Mon, 21 Apr 2008 14:46:22 -0700 Subject: tcp: Make use of before macro in tcp_input.c Make use of tcp before macro. Signed-off-by: Arnd Hannemann Signed-off-by: David S. Miller --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index cdc051bfdb4..ac9b8482f70 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2298,7 +2298,7 @@ static inline int tcp_packet_delayed(struct tcp_sock *tp) { return !tp->retrans_stamp || (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr && - (__s32)(tp->rx_opt.rcv_tsecr - tp->retrans_stamp) < 0); + before(tp->rx_opt.rcv_tsecr, tp->retrans_stamp)); } /* Undo procedures. */ -- cgit v1.2.3 From c5d18e984a313adf5a1a4ae69e0b1d93cf410229 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Tue, 22 Apr 2008 00:46:42 -0700 Subject: [IPSEC]: Fix catch-22 with algorithm IDs above 31 As it stands it's impossible to use any authentication algorithms with an ID above 31 portably. It just happens to work on x86 but fails miserably on ppc64. The reason is that we're using a bit mask to check the algorithm ID but the mask is only 32 bits wide. After looking at how this is used in the field, I have concluded that in the long term we should phase out state matching by IDs because this is made superfluous by the reqid feature. For current applications, the best solution IMHO is to allow all algorithms when the bit masks are all ~0. The following patch does exactly that. This bug was identified by IBM when testing on the ppc64 platform using the NULL authentication algorithm which has an ID of 251. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- net/key/af_key.c | 2 +- net/xfrm/xfrm_policy.c | 2 +- net/xfrm/xfrm_user.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'net') diff --git a/net/key/af_key.c b/net/key/af_key.c index 1fb0fe42a72..81a8e5297ad 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -1907,7 +1907,7 @@ parse_ipsecrequest(struct xfrm_policy *xp, struct sadb_x_ipsecrequest *rq) t->encap_family = xp->family; /* No way to set this via kame pfkey */ - t->aalgos = t->ealgos = t->calgos = ~0; + t->allalgs = 1; xp->xfrm_nr++; return 0; } diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index ab4d0e598a2..e0c0390613c 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -1819,7 +1819,7 @@ xfrm_state_ok(struct xfrm_tmpl *tmpl, struct xfrm_state *x, (x->id.spi == tmpl->id.spi || !tmpl->id.spi) && (x->props.reqid == tmpl->reqid || !tmpl->reqid) && x->props.mode == tmpl->mode && - ((tmpl->aalgos & (1<props.aalgo)) || + (tmpl->allalgs || (tmpl->aalgos & (1<props.aalgo)) || !(xfrm_id_proto_match(tmpl->id.proto, IPSEC_PROTO_ANY))) && !(x->props.mode != XFRM_MODE_TRANSPORT && xfrm_state_addr_cmp(tmpl, x, family)); diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 1810f5645bb..22a30ae582a 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -981,6 +981,8 @@ static void copy_templates(struct xfrm_policy *xp, struct xfrm_user_tmpl *ut, t->aalgos = ut->aalgos; t->ealgos = ut->ealgos; t->calgos = ut->calgos; + /* If all masks are ~0, then we allow all algorithms. */ + t->allalgs = !~(t->aalgos & t->ealgos & t->calgos); t->encap_family = ut->family; } } -- cgit v1.2.3 From cd58f2a96ba95fb5b69580784bc6f7179001869c Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Wed, 23 Apr 2008 03:37:49 -0700 Subject: net: Unexport move_addr_to_{kernel,user} After the removal of the Solaris binary emulation the exports of move_addr_to_{kernel,user} are no longer used. Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- net/socket.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'net') diff --git a/net/socket.c b/net/socket.c index 9b5c917f8a6..66c4a8cf6db 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2327,9 +2327,6 @@ int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) return sock->ops->shutdown(sock, how); } -/* ABI emulation layers need these two */ -EXPORT_SYMBOL(move_addr_to_kernel); -EXPORT_SYMBOL(move_addr_to_user); EXPORT_SYMBOL(sock_create); EXPORT_SYMBOL(sock_create_kern); EXPORT_SYMBOL(sock_create_lite); -- cgit v1.2.3