Commit e8a573c4 authored by Petr Vandrovec's avatar Petr Vandrovec Committed by Linus Torvalds

[PATCH] 2.5.5-pre1: uninitialized SO_PASSCRED on sockets

* move socket clearing code from sock_alloc to sock_alloc_inode, so
  root of socketfs does not contain garbage, and we have all initialization
  in one place
* add initialization of passcred to zero - otherwise it is left on some
  random value, causing at least autobind() to randomly fail on
  unix sockets

			Petr Vandrovec
parent eebd38a6
...@@ -280,6 +280,15 @@ static struct inode *sock_alloc_inode(struct super_block *sb) ...@@ -280,6 +280,15 @@ static struct inode *sock_alloc_inode(struct super_block *sb)
if (!ei) if (!ei)
return NULL; return NULL;
init_waitqueue_head(&ei->socket.wait); init_waitqueue_head(&ei->socket.wait);
ei->socket.fasync_list = NULL;
ei->socket.state = SS_UNCONNECTED;
ei->socket.flags = 0;
ei->socket.ops = NULL;
ei->socket.sk = NULL;
ei->socket.file = NULL;
ei->socket.passcred = 0;
return &ei->vfs_inode; return &ei->vfs_inode;
} }
...@@ -495,13 +504,6 @@ struct socket *sock_alloc(void) ...@@ -495,13 +504,6 @@ struct socket *sock_alloc(void)
inode->i_uid = current->fsuid; inode->i_uid = current->fsuid;
inode->i_gid = current->fsgid; inode->i_gid = current->fsgid;
sock->fasync_list = NULL;
sock->state = SS_UNCONNECTED;
sock->flags = 0;
sock->ops = NULL;
sock->sk = NULL;
sock->file = NULL;
sockets_in_use[smp_processor_id()].counter++; sockets_in_use[smp_processor_id()].counter++;
return sock; return sock;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment