Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Fix error branches of if_sdl_sysctl.
details: https://anonhg.NetBSD.org/src/rev/c0f74c2d4711
branches: trunk
changeset: 345949:c0f74c2d4711
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Jun 16 15:18:33 2016 +0000
description:
Fix error branches of if_sdl_sysctl.
Can't release the psref if we didn't even find the interface!
diffstat:
sys/net/if.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diffs (49 lines):
diff -r 40082d28d1fd -r c0f74c2d4711 sys/net/if.c
--- a/sys/net/if.c Thu Jun 16 15:17:56 2016 +0000
+++ b/sys/net/if.c Thu Jun 16 15:18:33 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.340 2016/06/16 03:03:33 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.341 2016/06/16 15:18:33 riastradh Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.340 2016/06/16 03:03:33 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.341 2016/06/16 15:18:33 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -3108,25 +3108,26 @@
ifp = if_get_byindex(name[0], &psref);
if (ifp == NULL) {
error = ENODEV;
- goto out;
+ goto out0;
}
sdl = ifp->if_sadl;
if (sdl == NULL) {
*oldlenp = 0;
- goto out;
+ goto out1;
}
if (oldp == NULL) {
*oldlenp = sdl->sdl_alen;
- goto out;
+ goto out1;
}
if (*oldlenp >= sdl->sdl_alen)
*oldlenp = sdl->sdl_alen;
error = sysctl_copyout(l, &sdl->sdl_data[sdl->sdl_nlen], oldp, *oldlenp);
-out:
+out1:
if_put(ifp, &psref);
+out0:
curlwp_bindx(bound);
return error;
}
Home |
Main Index |
Thread Index |
Old Index