From f7cecd2466900b0a82e4dc39589672788f5673a7 Mon Sep 17 00:00:00 2001 From: njoly Date: Mon, 9 Jun 2008 21:17:58 +0000 Subject: [PATCH] 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. --- sys/compat/linux/common/linux_socket.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/compat/linux/common/linux_socket.c b/sys/compat/linux/common/linux_socket.c index 221d4010a830..827f7b19efef 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 -__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))) {