From: Alex Williamson Date: Mon, 26 Sep 2005 21:28:02 +0000 (-0700) Subject: [NET]: Make sure ctl buffer is aligned properly in sys_sendmsg(). X-Git-Tag: v2.6.14-rc3~103^2~5 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=b9d717a7b413f227ebb2d61d9c118335f7292137;p=linux-2.6-omap-h63xx.git [NET]: Make sure ctl buffer is aligned properly in sys_sendmsg(). It's on the stack and declared as "unsigned char[]", but pointers and similar can be in here thus we need to give it an explicit alignment attribute. Signed-off-by: Alex Williamson Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- diff --git a/net/socket.c b/net/socket.c index f9264472377..dbd1a6851ed 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1700,7 +1700,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;