summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordchagin <dchagin@FreeBSD.org>2016-03-08 15:55:43 +0000
committerdchagin <dchagin@FreeBSD.org>2016-03-08 15:55:43 +0000
commit82003e4255c1c5364d130098d840d1c97cf76aaa (patch)
tree11e681120324d99ecf4e931067ac940208df9b72
parent51e9cd7c4195705eeeb570effd498dd4a9d7539c (diff)
downloadFreeBSD-src-82003e4255c1c5364d130098d840d1c97cf76aaa.zip
FreeBSD-src-82003e4255c1c5364d130098d840d1c97cf76aaa.tar.gz
Does not leak fp. While here remove bogus cast of fp->f_data.
MFC after: 1 week
-rw-r--r--sys/compat/linux/linux_socket.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 80dab32..ff99bbd 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -803,9 +803,12 @@ linux_accept_common(struct thread *td, int s, l_uintptr_t addr,
error1 = getsock_cap(td, s, &rights, &fp, NULL);
if (error1 != 0)
return (error1);
- so = (struct socket *)fp->f_data;
- if (so->so_type == SOCK_DGRAM)
+ so = fp->f_data;
+ if (so->so_type == SOCK_DGRAM) {
+ fdrop(fp, td);
return (EOPNOTSUPP);
+ }
+ fdrop(fp, td);
}
return (error);
}
OpenPOWER on IntegriCloud