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-Url: https://git.stricted.de/?a=commitdiff_plain;h=b9d717a7b413f227ebb2d61d9c118335f7292137;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.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 f9264472377f..dbd1a6851edd 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;