summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-11-10 11:15:35 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-11-10 11:16:14 +0100
commit057656b706d159bd4b8f09a229191c1338f9a2a9 (patch)
treee0f666e974520414ba003d788a98a265a264188f
parent72d5fa11a8e3a0e4640da289d76ae672eb070565 (diff)
Disable HHOOK(9) support for sockets
Support was only partly disabled leading to NULL pointer accesses. Disable it completely.
-rw-r--r--freebsd/sys/kern/uipc_socket.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/freebsd/sys/kern/uipc_socket.c b/freebsd/sys/kern/uipc_socket.c
index 5c2ff575..d64f9ed2 100644
--- a/freebsd/sys/kern/uipc_socket.c
+++ b/freebsd/sys/kern/uipc_socket.c
@@ -197,8 +197,10 @@ MALLOC_DEFINE(M_PCB, "pcb", "protocol control block");
VNET_ASSERT(curvnet != NULL, \
("%s:%d curvnet is NULL, so=%p", __func__, __LINE__, (so)));
+#ifndef __rtems__
VNET_DEFINE(struct hhook_head *, socket_hhh[HHOOK_SOCKET_LAST + 1]);
#define V_socket_hhh VNET(socket_hhh)
+#endif /* __rtems__ */
/*
* Limit on the number of connections in the listen queue waiting
@@ -2455,6 +2457,7 @@ sorflush(struct socket *so)
static int inline
hhook_run_socket(struct socket *so, void *hctx, int32_t h_id)
{
+#ifndef __rtems__
struct socket_hhook_data hhook_data = {
.so = so,
.hctx = hctx,
@@ -2468,6 +2471,9 @@ hhook_run_socket(struct socket *so, void *hctx, int32_t h_id)
/* Ugly but needed, since hhooks return void for now */
return (hhook_data.status);
+#else /* __rtems__ */
+ return (0);
+#endif /* __rtems__ */
}
/*
@@ -2735,10 +2741,12 @@ sosetopt(struct socket *so, struct sockopt *sopt)
break;
default:
+#ifndef __rtems__
if (V_socket_hhh[HHOOK_SOCKET_OPT]->hhh_nhooks > 0)
error = hhook_run_socket(so, sopt,
HHOOK_SOCKET_OPT);
else
+#endif /* __rtems__ */
error = ENOPROTOOPT;
break;
}
@@ -2930,10 +2938,12 @@ integer:
goto integer;
default:
+#ifndef __rtems__
if (V_socket_hhh[HHOOK_SOCKET_OPT]->hhh_nhooks > 0)
error = hhook_run_socket(so, sopt,
HHOOK_SOCKET_OPT);
else
+#endif /* __rtems__ */
error = ENOPROTOOPT;
break;
}