Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Fix usage of curlwp_bind in ip_output
details: https://anonhg.NetBSD.org/src/rev/3d974b5c54f3
branches: trunk
changeset: 358332:3d974b5c54f3
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Dec 22 11:22:37 2017 +0000
description:
Fix usage of curlwp_bind in ip_output
curlwp_bindx must be called in LIFO order, i.e., we can't call curlwp_bind
and curlwp_bindx like this:
bound1 = curlwp_bind();
bound2 = curlwp_bind();
curlwp_bindx(bound1);
curlwp_bindx(bound2);
ip_outout did so if NET_MPSAFE. Fix it.
diffstat:
sys/netinet/ip_output.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (38 lines):
diff -r 413664ee46fa -r 3d974b5c54f3 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c Fri Dec 22 10:24:49 2017 +0000
+++ b/sys/netinet/ip_output.c Fri Dec 22 11:22:37 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_output.c,v 1.287 2017/12/15 04:03:46 ozaki-r Exp $ */
+/* $NetBSD: ip_output.c,v 1.288 2017/12/22 11:22:37 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.287 2017/12/15 04:03:46 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.288 2017/12/22 11:22:37 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -303,6 +303,10 @@
!in_hosteq(dst->sin_addr, ip->ip_dst)))
rtcache_free(ro);
+ /* XXX must be before rtcache operations */
+ bound = curlwp_bind();
+ bind_need_restore = true;
+
if ((rt = rtcache_validate(ro)) == NULL &&
(rt = rtcache_update(ro, 1)) == NULL) {
dst = &udst.sin;
@@ -311,8 +315,6 @@
goto bad;
}
- bound = curlwp_bind();
- bind_need_restore = true;
/*
* If routing to interface only, short circuit routing lookup.
*/
Home |
Main Index |
Thread Index |
Old Index