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.
This commit is contained in:
njoly 2008-06-09 21:17:58 +00:00
parent 28599b0f97
commit f7cecd2466
1 changed files with 5 additions and 3 deletions

View File

@ -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))) {