summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common/linux_socket.c
diff options
context:
space:
mode:
authornjoly <njoly@NetBSD.org>2008-06-09 21:17:58 +0000
committernjoly <njoly@NetBSD.org>2008-06-09 21:17:58 +0000
commitf7cecd2466900b0a82e4dc39589672788f5673a7 (patch)
treeec0e0c69dcb6495761e52ab9c62757c6b512fa0e /sys/compat/linux/common/linux_socket.c
parent28599b0f976b864e6ccf9e05004d9a10bfba6966 (diff)
Do set mbuf in all cases, even for salen value of 0; otherwise this
will make a panic later when trying to free memory from a random adress. XXX Need to revisit it later to avoid mbuf allocation in this case.
Diffstat (limited to 'sys/compat/linux/common/linux_socket.c')
-rw-r--r--sys/compat/linux/common/linux_socket.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/compat/linux/common/linux_socket.c b/sys/compat/linux/common/linux_socket.c
index 221d4010a83..827f7b19efe 100644
--- a/sys/compat/linux/common/linux_socket.c
+++ b/sys/compat/linux/common/linux_socket.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socket.c,v 1.93 2008/04/29 09:56:38 njoly Exp $ */
+/* $NetBSD: linux_socket.c,v 1.94 2008/06/09 21:17:58 njoly Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.93 2008/04/29 09:56:38 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.94 2008/06/09 21:17:58 njoly Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1312,8 +1312,10 @@ linux_get_sa(struct lwp *l, int s, struct mbuf **mp,
m->m_len = salen;
- if (salen == 0)
+ if (salen == 0) {
+ *mp = m;
return 0;
+ }
kosa = mtod(m, void *);
if ((error = copyin(osa, kosa, salen))) {