summaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-04 10:16:31 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-04 10:16:31 -0400
commit2ee73cc2d507df7b28050fba5d08bd33dd34848c (patch)
treeaf5f33b265318e0f4b61f788691fe4f780ec402c /net/socket.c
parentc1d9728ecc5b560465df3c0c0d3b3825c2710b40 (diff)
parented39f731ab2e77e58122232f6e27333331d7793d (diff)
downloadop-kernel-dev-2ee73cc2d507df7b28050fba5d08bd33dd34848c.zip
op-kernel-dev-2ee73cc2d507df7b28050fba5d08bd33dd34848c.tar.gz
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/net/socket.c b/net/socket.c
index f926447..3145103 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1145,8 +1145,11 @@ static int __sock_create(int family, int type, int protocol, struct socket **res
if (!try_module_get(net_families[family]->owner))
goto out_release;
- if ((err = net_families[family]->create(sock, protocol)) < 0)
+ if ((err = net_families[family]->create(sock, protocol)) < 0) {
+ sock->ops = NULL;
goto out_module_put;
+ }
+
/*
* Now to bump the refcnt of the [loadable] module that owns this
* socket at sock_release time we decrement its refcnt.
@@ -1360,16 +1363,16 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int _
newsock->type = sock->type;
newsock->ops = sock->ops;
- err = security_socket_accept(sock, newsock);
- if (err)
- goto out_release;
-
/*
* We don't need try_module_get here, as the listening socket (sock)
* has the protocol module (sock->ops->owner) held.
*/
__module_get(newsock->ops->owner);
+ err = security_socket_accept(sock, newsock);
+ if (err)
+ goto out_release;
+
err = sock->ops->accept(sock, newsock, sock->file->f_flags);
if (err < 0)
goto out_release;
@@ -1700,7 +1703,9 @@ asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags)
struct socket *sock;
char address[MAX_SOCK_ADDR];
struct iovec iovstack[UIO_FASTIOV], *iov = iovstack;
- unsigned char ctl[sizeof(struct cmsghdr) + 20]; /* 20 is size of ipv6_pktinfo */
+ unsigned char ctl[sizeof(struct cmsghdr) + 20]
+ __attribute__ ((aligned (sizeof(__kernel_size_t))));
+ /* 20 is size of ipv6_pktinfo */
unsigned char *ctl_buf = ctl;
struct msghdr msg_sys;
int err, ctl_len, iov_size, total_len;
OpenPOWER on IntegriCloud