diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2023-01-28 10:17:17 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2023-01-28 10:17:17 +0000 |
commit | 2c3cd4aa98d9105a2520475dae513ca577c13137 (patch) | |
tree | cff082796a20bbad953453859329e93f5e992dee /sys/net | |
parent | ff1b0f8956e8c6c0bec6a64f0b36d898b42e109a (diff) |
Revert the `rt_lock' rwlock(9) diff to fix the recursive
rwlock(9) acquisition.
Reported-by: syzbot+fbe3acb4886adeef31e0@syzkaller.appspotmail.com
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/route.c | 9 | ||||
-rw-r--r-- | sys/net/route.h | 9 |
2 files changed, 4 insertions, 14 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index d6dcc3110d2..4e9414dbc8c 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.415 2023/01/21 17:35:01 mvs Exp $ */ +/* $OpenBSD: route.c,v 1.416 2023/01/28 10:17:16 mvs Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -113,7 +113,6 @@ #include <sys/queue.h> #include <sys/pool.h> #include <sys/atomic.h> -#include <sys/rwlock.h> #include <net/if.h> #include <net/if_var.h> @@ -140,8 +139,6 @@ #define ROUNDUP(a) (a>0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) -struct rwlock rt_lock = RWLOCK_INITIALIZER("rtlck"); - /* Give some jitter to hash, to avoid synchronization between routers. */ static uint32_t rt_hashjitter; @@ -256,10 +253,10 @@ rt_clone(struct rtentry **rtp, struct sockaddr *dst, unsigned int rtableid) * It should also be higher to let the ARP layer find * cloned routes instead of the cloning one. */ - RT_LOCK(); + KERNEL_LOCK(); error = rtrequest(RTM_RESOLVE, &info, rt->rt_priority - 1, &rt, rtableid); - RT_UNLOCK(); + KERNEL_UNLOCK(); if (error) { rtm_miss(RTM_MISS, &info, 0, RTP_NONE, 0, error, rtableid); } else { diff --git a/sys/net/route.h b/sys/net/route.h index 4c0c38577dc..1476ac35956 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.197 2023/01/21 17:35:01 mvs Exp $ */ +/* $OpenBSD: route.h,v 1.198 2023/01/28 10:17:16 mvs Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -383,13 +383,6 @@ struct rt_addrinfo { #ifdef _KERNEL #include <sys/percpu.h> -#include <sys/rwlock.h> - -extern struct rwlock rt_lock; - -#define RT_LOCK() rw_enter_write(&rt_lock) -#define RT_UNLOCK() rw_exit_write(&rt_lock) -#define RT_ASSERT_LOCKED() rw_assert_wrlock(&rt_lock) enum rtstat_counters { rts_badredirect, /* bogus redirect calls */ |