--- /dev/null
+From 4120bf257ec59ca4381af5be565e6e1e68b542c1 Mon Sep 17 00:00:00 2001
+From: Jianjun Kong <jianjun@zeuux.org>
+Date: Sat, 1 Nov 2008 21:37:27 -0700
+Subject: af_unix: netns: fix problem of return value
+
+From: Jianjun Kong <jianjun@zeuux.org>
+
+[ Upstream commit 48dcc33e5e11de0f76b65b113988dbc930d17395 ]
+
+fix problem of return value
+
+net/unix/af_unix.c: unix_net_init()
+when error appears, it should return 'error', not always return 0.
+
+Signed-off-by: Jianjun Kong <jianjun@zeuux.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+
+---
+ net/unix/af_unix.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/unix/af_unix.c
++++ b/net/unix/af_unix.c
+@@ -2230,7 +2230,7 @@ static int unix_net_init(struct net *net
+ #endif
+ error = 0;
+ out:
+- return 0;
++ return error;
+ }
+
+ static void unix_net_exit(struct net *net)
--- /dev/null
+From 8b7ea8ea0e3d532c843d8834422a7aa0da91e534 Mon Sep 17 00:00:00 2001
+From: David S. Miller <davem@davemloft.net>
+Date: Mon, 1 Dec 2008 02:48:26 -0800
+Subject: sparc64: Fix offset calculation in compute_size()
+
+From: David S. Miller <davem@davemloft.net>
+
+[ Upstream commit b270ee8a9fc9547eb781ce9ccd379450bcf9a204 ]
+
+The fault address is somewhere inside of the buffer, not
+before it.
+
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/sparc64/lib/user_fixup.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/sparc64/lib/user_fixup.c
++++ b/arch/sparc64/lib/user_fixup.c
+@@ -24,7 +24,7 @@ static unsigned long compute_size(unsign
+ if (fault_addr < start || fault_addr >= end) {
+ *offset = 0;
+ } else {
+- *offset = start - fault_addr;
++ *offset = fault_addr - start;
+ size = end - fault_addr;
+ }
+ return size;
--- /dev/null
+From dee051a8472e61704f32f9efd980a88c816b12d0 Mon Sep 17 00:00:00 2001
+From: Roland Dreier <rdreier@cisco.com>
+Date: Fri, 17 Oct 2008 14:18:26 -0700
+Subject: cxgb3: Fix kernel crash caused by uninitialized l2t_entry.arpq
+
+From: Roland Dreier <rdreier@cisco.com>
+
+[ Upstream commit 6d329af9967e7ab3f4a3d7f1e8ef87539c3a069f ]
+
+Commit 147e70e6 ("cxgb3: Use SKB list interfaces instead of home-grown
+implementation.") causes a crash in t3_l2t_send_slow() when an iWARP
+connection request is received. This is because the new l2t_entry.arpq
+skb queue is never initialized, and therefore trying to add an skb to
+it causes a NULL dereference. With the old code there was no need to
+initialize the queues because the l2t_entry structures were zeroed,
+and the code used NULL to mean empty.
+
+Fix this by adding __skb_queue_head_init() when all the l2t_entry
+structures get allocated.
+
+Signed-off-by: Roland Dreier <rolandd@cisco.com>
+Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/cxgb3/l2t.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/cxgb3/l2t.c
++++ b/drivers/net/cxgb3/l2t.c
+@@ -436,6 +436,7 @@ struct l2t_data *t3_init_l2t(unsigned in
+ for (i = 0; i < l2t_capacity; ++i) {
+ d->l2tab[i].idx = i;
+ d->l2tab[i].state = L2T_STATE_UNUSED;
++ __skb_queue_head_init(&d->l2tab[i].arpq);
+ spin_lock_init(&d->l2tab[i].lock);
+ atomic_set(&d->l2tab[i].refcnt, 0);
+ }
--- /dev/null
+From 202d87525a12fcbfea508ff35eac138d83b3b904 Mon Sep 17 00:00:00 2001
+From: Hugh Dickins <hugh@veritas.com>
+Date: Sat, 1 Nov 2008 21:41:40 -0700
+Subject: sparc64: Fix __copy_{to,from}_user_inatomic defines.
+
+From: Hugh Dickins <hugh@veritas.com>
+
+[ Upstream commit b270ee8a9fc9547eb781ce9ccd379450bcf9a204 ]
+
+Alexander Beregalov reports oops in __bzero() called from
+copy_from_user_fixup() called from iov_iter_copy_from_user_atomic(),
+when running dbench on tmpfs on sparc64: its __copy_from_user_inatomic
+and __copy_to_user_inatomic should be avoiding, not calling, the fixups.
+
+Signed-off-by: Hugh Dickins <hugh@veritas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/sparc/include/asm/uaccess_64.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/sparc/include/asm/uaccess_64.h
++++ b/arch/sparc/include/asm/uaccess_64.h
+@@ -265,8 +265,8 @@ extern long __strnlen_user(const char __
+
+ #define strlen_user __strlen_user
+ #define strnlen_user __strnlen_user
+-#define __copy_to_user_inatomic __copy_to_user
+-#define __copy_from_user_inatomic __copy_from_user
++#define __copy_to_user_inatomic ___copy_to_user
++#define __copy_from_user_inatomic ___copy_from_user
+
+ #endif /* __ASSEMBLY__ */
+
--- /dev/null
+From fcb9d538380180c62507bb3d18c5c7101e98f48b Mon Sep 17 00:00:00 2001
+From: David S. Miller <davem@davemloft.net>
+Date: Wed, 12 Nov 2008 14:32:54 -0800
+Subject: niu: Fix readq implementation when architecture does not provide one.
+
+From: David S. Miller <davem@davemloft.net>
+
+[ Upstream commit e23a59e1ca6d177a57a7791b3629db93ff1d9813 ]
+
+This fixes a TX hang reported by Jesper Dangaard Brouer.
+
+When an architecutre cannot provide a fully functional
+64-bit atomic readq/writeq, the driver must implement
+it's own. This is because only the driver can say whether
+doing something like using two 32-bit reads to implement
+the full 64-bit read will actually work properly.
+
+In particular one of the issues is whether the top 32-bits
+or the bottom 32-bits of the 64-bit register should be read
+first. There could be side effects, and in fact that is
+exactly the problem here.
+
+The TX_CS register has counters in the upper 32-bits and
+state bits in the lower 32-bits. A read clears the state
+bits.
+
+We would read the counter half before the state bit half.
+That first read would clear the state bits, and then the
+driver thinks that no interrupts are pending because the
+interrupt indication state bits are seen clear every time.
+
+Fix this by reading the bottom half before the upper half.
+
+Tested-by: Jesper Dangaard Brouer <jdb@comx.dk>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/niu.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/net/niu.c
++++ b/drivers/net/niu.c
+@@ -51,8 +51,7 @@ MODULE_VERSION(DRV_MODULE_VERSION);
+ #ifndef readq
+ static u64 readq(void __iomem *reg)
+ {
+- return (((u64)readl(reg + 0x4UL) << 32) |
+- (u64)readl(reg));
++ return ((u64) readl(reg)) | (((u64) readl(reg + 4UL)) << 32);
+ }
+
+ static void writeq(u64 val, void __iomem *reg)
--- /dev/null
+From c4742fc0c72726d17987b7f33bb19b34de01816e Mon Sep 17 00:00:00 2001
+From: Max Dmitrichenko <dmitrmax@gmail.com>
+Date: Sun, 2 Nov 2008 00:34:10 -0700
+Subject: [PATCH] sparc64: Fix PCI resource mapping on sparc64
+
+From: Max Dmitrichenko <dmitrmax@gmail.com>
+
+[ Upstream commit 145e1c0023585e0e8f6df22316308ec61c5066b2 ]
+
+There is a problem discovered in recent versions of ATI Mach64 driver
+in X.org on sparc64 architecture. In short, the driver fails to mmap
+MMIO aperture (PCI resource #2).
+
+I've found that kernel's __pci_mmap_make_offset() returns EINVAL. It
+checks whether user attempts to mmap more than the resource length,
+which is 0x1000 bytes in our case. But PAGE_SIZE on SPARC64 is 0x2000
+and this is what actually is being mmaped. So __pci_mmap_make_offset()
+failed for this PCI resource.
+
+Signed-off-by: Max Dmitrichenko <dmitrmax@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/sparc64/kernel/pci.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+--- a/arch/sparc64/kernel/pci.c
++++ b/arch/sparc64/kernel/pci.c
+@@ -1017,6 +1017,7 @@ static int __pci_mmap_make_offset(struct
+
+ for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
+ struct resource *rp = &pdev->resource[i];
++ resource_size_t aligned_end;
+
+ /* Active? */
+ if (!rp->flags)
+@@ -1034,8 +1035,15 @@ static int __pci_mmap_make_offset(struct
+ continue;
+ }
+
++ /* Align the resource end to the next page address.
++ * PAGE_SIZE intentionally added instead of (PAGE_SIZE - 1),
++ * because actually we need the address of the next byte
++ * after rp->end.
++ */
++ aligned_end = (rp->end + PAGE_SIZE) & PAGE_MASK;
++
+ if ((rp->start <= user_paddr) &&
+- (user_paddr + user_size) <= (rp->end + 1UL))
++ (user_paddr + user_size) <= aligned_end)
+ break;
+ }
+
--- /dev/null
+From 8074c987b46434282a52706e97848dda0397b22a Mon Sep 17 00:00:00 2001
+From: Frédéric Moulins <frederic.moulins@alsatis.com>
+Date: Fri, 28 Nov 2008 22:12:02 -0800
+Subject: pppol2tp: Add missing sock_put() in pppol2tp_release()
+
+From: Frédéric Moulins <frederic.moulins@alsatis.com>
+
+[ Upstream commit e6358135147807351db3b7782d3e198a1bba8b62 ]
+
+pppol2tp_sock_to_session() do sock_hold() if the session to release is
+not NULL.
+
+Signed-off-by: Frédéric Moulins <frederic.moulins@alsatis.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+
+---
+ drivers/net/pppol2tp.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/pppol2tp.c
++++ b/drivers/net/pppol2tp.c
+@@ -1353,6 +1353,7 @@ static int pppol2tp_release(struct socke
+ kfree_skb(skb);
+ sock_put(sk);
+ }
++ sock_put(sk);
+ }
+
+ release_sock(sk);
--- /dev/null
+From 7b7d7a7fe9cd0b23fba1b31adcae73135f8990bd Mon Sep 17 00:00:00 2001
+From: Chris Torek <chris.torek@windriver.com>
+Date: Wed, 3 Dec 2008 00:47:28 -0800
+Subject: [PATCH] sparc64: Fix bug in PTRACE_SETFPREGS64 handling.
+
+From: Chris Torek <chris.torek@windriver.com>
+
+[ Upstream commit 5769907ade8dda7002b304c03ef9e4ee5c1e0821 ]
+
+From: Chris Torek <chris.torek@windriver.com>
+
+>The SPARC64 kernel code for PTRACE_SETFPREGS64 appears to be an exact copy
+>of that for PTRACE_GETFPREGS64. This means that gdbserver and native
+>64-bit GDB cannot set floating-point registers.
+
+It looks like a simple typo.
+
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/sparc64/kernel/ptrace.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/sparc64/kernel/ptrace.c
++++ b/arch/sparc64/kernel/ptrace.c
+@@ -1014,7 +1014,7 @@ long arch_ptrace(struct task_struct *chi
+ break;
+
+ case PTRACE_SETFPREGS64:
+- ret = copy_regset_to_user(child, view, REGSET_FP,
++ ret = copy_regset_from_user(child, view, REGSET_FP,
+ 0 * sizeof(u64),
+ 33 * sizeof(u64),
+ fps);
--- /dev/null
+From 5f2648dc7a9e125fcb0bbc6321f6488682e8cdda Mon Sep 17 00:00:00 2001
+From: Joseph Myers <joseph@codesourcery.com>
+Date: Wed, 3 Dec 2008 19:36:05 -0800
+Subject: [PATCH] sparc64: Fix VIS emulation bugs
+
+From: Joseph Myers <joseph@codesourcery.com>
+
+[ Upstream commit 726c12f57d7e3ff43693d88e13b1ff02464c75d3 ]
+
+This patch fixes some bugs in VIS emulation that cause the GCC test
+failure
+
+FAIL: gcc.target/sparc/pdist-3.c execution test
+
+for both 32-bit and 64-bit testing on hardware lacking these
+instructions. The emulation code for the pdist instruction uses
+RS1(insn) for both source registers rs1 and rs2, which is obviously
+wrong and leads to the instruction doing nothing (the observed
+problem), and further inspection of the code shows that RS1 uses a
+shift of 24 and RD a shift of 25, which clearly cannot both be right;
+examining SPARC documentation indicates the correct shift for RS1 is
+14.
+
+This patch fixes the bug if single-stepping over the affected
+instruction in the debugger, but not if the testcase is run
+standalone. For that, Wind River has another patch I hope they will
+send as a followup to this patch submission.
+
+Signed-off-by: Joseph Myers <joseph@codesourcery.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/sparc64/kernel/visemul.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/sparc64/kernel/visemul.c
++++ b/arch/sparc64/kernel/visemul.c
+@@ -131,7 +131,7 @@
+ #define VIS_OPF_SHIFT 5
+ #define VIS_OPF_MASK (0x1ff << VIS_OPF_SHIFT)
+
+-#define RS1(INSN) (((INSN) >> 24) & 0x1f)
++#define RS1(INSN) (((INSN) >> 14) & 0x1f)
+ #define RS2(INSN) (((INSN) >> 0) & 0x1f)
+ #define RD(INSN) (((INSN) >> 25) & 0x1f)
+
+@@ -445,7 +445,7 @@ static void pdist(struct pt_regs *regs,
+ unsigned long i;
+
+ rs1 = fpd_regval(f, RS1(insn));
+- rs2 = fpd_regval(f, RS1(insn));
++ rs2 = fpd_regval(f, RS2(insn));
+ rd = fpd_regaddr(f, RD(insn));
+
+ rd_val = *rd;
--- /dev/null
+From 3c4f56cc7fb45c3c97fa1fa7f54373f074417291 Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <dada1@cosmosbay.com>
+Date: Mon, 8 Dec 2008 02:12:16 -0800
+Subject: udp: multicast packets need to check namespace
+
+From: Eric Dumazet <dada1@cosmosbay.com>
+
+[ Upstream commit 920a46115ca3fa88990276d98520abab85495b2d ]
+
+Current UDP multicast delivery is not namespace aware.
+
+Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
+Acked-by: Pavel Emelyanov <xemul@openvz.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ net/ipv4/udp.c | 12 +++++++-----
+ net/ipv6/udp.c | 8 ++++----
+ 2 files changed, 11 insertions(+), 9 deletions(-)
+
+--- a/net/ipv4/udp.c
++++ b/net/ipv4/udp.c
+@@ -302,7 +302,7 @@ static struct sock *__udp4_lib_lookup(st
+ return result;
+ }
+
+-static inline struct sock *udp_v4_mcast_next(struct sock *sk,
++static inline struct sock *udp_v4_mcast_next(struct net *net, struct sock *sk,
+ __be16 loc_port, __be32 loc_addr,
+ __be16 rmt_port, __be32 rmt_addr,
+ int dif)
+@@ -314,7 +314,8 @@ static inline struct sock *udp_v4_mcast_
+ sk_for_each_from(s, node) {
+ struct inet_sock *inet = inet_sk(s);
+
+- if (s->sk_hash != hnum ||
++ if (!net_eq(sock_net(s), net) ||
++ s->sk_hash != hnum ||
+ (inet->daddr && inet->daddr != rmt_addr) ||
+ (inet->dport != rmt_port && inet->dport) ||
+ (inet->rcv_saddr && inet->rcv_saddr != loc_addr) ||
+@@ -1097,15 +1098,16 @@ static int __udp4_lib_mcast_deliver(stru
+ read_lock(&udp_hash_lock);
+ sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]);
+ dif = skb->dev->ifindex;
+- sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
++ sk = udp_v4_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif);
+ if (sk) {
+ struct sock *sknext = NULL;
+
+ do {
+ struct sk_buff *skb1 = skb;
+
+- sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr,
+- uh->source, saddr, dif);
++ sknext = udp_v4_mcast_next(net, sk_next(sk), uh->dest,
++ daddr, uh->source, saddr,
++ dif);
+ if (sknext)
+ skb1 = skb_clone(skb, GFP_ATOMIC);
+
+--- a/net/ipv6/udp.c
++++ b/net/ipv6/udp.c
+@@ -313,7 +313,7 @@ drop:
+ return -1;
+ }
+
+-static struct sock *udp_v6_mcast_next(struct sock *sk,
++static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk,
+ __be16 loc_port, struct in6_addr *loc_addr,
+ __be16 rmt_port, struct in6_addr *rmt_addr,
+ int dif)
+@@ -325,7 +325,7 @@ static struct sock *udp_v6_mcast_next(st
+ sk_for_each_from(s, node) {
+ struct inet_sock *inet = inet_sk(s);
+
+- if (sock_net(s) != sock_net(sk))
++ if (!net_eq(sock_net(s), net))
+ continue;
+
+ if (s->sk_hash == num && s->sk_family == PF_INET6) {
+@@ -368,14 +368,14 @@ static int __udp6_lib_mcast_deliver(stru
+ read_lock(&udp_hash_lock);
+ sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]);
+ dif = inet6_iif(skb);
+- sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
++ sk = udp_v6_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif);
+ if (!sk) {
+ kfree_skb(skb);
+ goto out;
+ }
+
+ sk2 = sk;
+- while ((sk2 = udp_v6_mcast_next(sk_next(sk2), uh->dest, daddr,
++ while ((sk2 = udp_v6_mcast_next(net, sk_next(sk2), uh->dest, daddr,
+ uh->source, saddr, dif))) {
+ struct sk_buff *buff = skb_clone(skb, GFP_ATOMIC);
+ if (buff) {
--- /dev/null
+From ecff6abb5dd92a2dbee4bcfd10a073b42318c44d Mon Sep 17 00:00:00 2001
+From: Hong H. Pham <hong.pham@windriver.com>
+Date: Thu, 4 Dec 2008 09:12:57 -0800
+Subject: sparc64: Sync FPU state in VIS emulation handler.
+
+From: Hong H. Pham <hong.pham@windriver.com>
+
+[ Upstream commit 410d2c8187ed969238ba98008c1d57307a56cfd8 ]
+
+Copy the FPU state to the task's thread_info->fpregs for the VIS emulation
+functions to access.
+
+Signed-off-by: Hong H. Pham <hong.pham@windriver.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/sparc64/kernel/visemul.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/arch/sparc64/kernel/visemul.c
++++ b/arch/sparc64/kernel/visemul.c
+@@ -807,6 +807,8 @@ int vis_emul(struct pt_regs *regs, unsig
+ if (get_user(insn, (u32 __user *) pc))
+ return -EFAULT;
+
++ save_and_clear_fpu();
++
+ opf = (insn & VIS_OPF_MASK) >> VIS_OPF_SHIFT;
+ switch (opf) {
+ default:
libata-improve-phantom-device-detection.patch
+0001-af_unix-netns-fix-problem-of-return-value.patch
+0002-cxgb3-Fix-kernel-crash-caused-by-uninitialized-l2t_.patch
+0003-niu-Fix-readq-implementation-when-architecture-does.patch
+0004-pppol2tp-Add-missing-sock_put-in-pppol2tp_release.patch
+0005-udp-multicast-packets-need-to-check-namespace.patch
+0001-sparc64-Fix-offset-calculation-in-compute_size.patch
+0002-sparc64-Fix-__copy_-to-from-_user_inatomic-defines.patch
+0003-sparc64-Fix-PCI-resource-mapping-on-sparc64.patch
+0004-sparc64-Fix-bug-in-PTRACE_SETFPREGS64-handling.patch
+0005-sparc64-Fix-VIS-emulation-bugs.patch
+0006-sparc64-Sync-FPU-state-in-VIS-emulation-handler.patch