[PATCH] Re: unix_getname buglet - > 2.5.4(?)

Ray Lee (ray-lk@madrabbit.org)
07 Jan 2003 10:11:12 -0800


On Tue, 2003-01-07 at 04:06, Michael Meeks wrote:
> Evolution is non-functioning on recent 2.5.X kernels, due to
> mal-performance in getpeername => net/unix/af_unix.c (unix_getname),
> where it seems we switch 'sk' on 'peer', but not the (previously)
> typecast pointer to it; this fixes it.

<snip> Your patch was MailerMangled(tm). Below is what I'm running on
2.5.54, using Evolution. The patch is obviously correct (once you look
at the full code, anyway).

Linus, please apply.

Ray

diff -Nurx /home/ray/work/dontdiff linux-2.5.54/net/unix/af_unix.c linux-2.5.54-af_unix.c-fix/net/unix/af_unix.c
--- linux-2.5.54/net/unix/af_unix.c 2003-01-07 09:22:29.000000000 -0800
+++ linux-2.5.54-af_unix.c-fix/net/unix/af_unix.c 2003-01-07 09:55:19.000000000 -0800
@@ -1109,7 +1109,7 @@
static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer)
{
struct sock *sk = sock->sk;
- struct unix_sock *u = unix_sk(sk);
+ struct unix_sock *u;
struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
int err = 0;

@@ -1124,6 +1124,7 @@
sock_hold(sk);
}

+ u = unix_sk(sk);
unix_state_rlock(sk);
if (!u->addr) {
sunaddr->sun_family = AF_UNIX;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/