diff options
| author | Ingo Molnar <mingo@kernel.org> | 2017-06-22 11:19:14 +0300 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-06-22 11:19:14 +0300 |
| commit | f9e169883164390a15b56d00cb7e22c2e72f4dba (patch) | |
| tree | 2a946cfff76d6dd41005d0dd534e0bd97641019d /net/unix/af_unix.c | |
| parent | cde50a67397c0da7d11795d4b4418384022ab8e6 (diff) | |
| parent | 8d829b9bb878904f3419af8003176a12910b94e8 (diff) | |
| download | linux-f9e169883164390a15b56d00cb7e22c2e72f4dba.tar.xz | |
Merge branch 'linus' into locking/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 6a7fe7660551..1a0c961f4ffe 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -999,7 +999,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) struct path path = { }; err = -EINVAL; - if (sunaddr->sun_family != AF_UNIX) + if (addr_len < offsetofend(struct sockaddr_un, sun_family) || + sunaddr->sun_family != AF_UNIX) goto out; if (addr_len == sizeof(short)) { @@ -1110,6 +1111,10 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, unsigned int hash; int err; + err = -EINVAL; + if (alen < offsetofend(struct sockaddr, sa_family)) + goto out; + if (addr->sa_family != AF_UNSPEC) { err = unix_mkname(sunaddr, alen, &hash); if (err < 0) |
