From f083c59905818a84eb367556abb2627e4aaaef57 Mon Sep 17 00:00:00 2001 From: Daiyuu Nobori Date: Wed, 1 Jan 2020 10:57:51 +0900 Subject: [PATCH 1/2] Bugfix: Imperfect Virtual Hub FDB lock may cause process crush. --- src/Cedar/Hub.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Cedar/Hub.c b/src/Cedar/Hub.c index 0a37f8e0..32a5d04c 100644 --- a/src/Cedar/Hub.c +++ b/src/Cedar/Hub.c @@ -1563,13 +1563,15 @@ void HubWatchDogThread(THREAD *t, void *param) o2 = NewListFast(NULL); // Send an ARP packet - LockList(hub->IpTable); + LockHashList(hub->IpTable); { num = LIST_NUM(hub->IpTable); for (i = 0;i < LIST_NUM(hub->IpTable);i++) { IP_TABLE_ENTRY *e = LIST_DATA(hub->IpTable, i); + if (e == NULL) continue; + if ((e->UpdatedTime + (UINT64)(IP_TABLE_EXPIRE_TIME)) > Tick64()) { if (e->MacAddress[0] != 0xff || e->MacAddress[1] != 0xff || e->MacAddress[2] != 0xff || @@ -1645,7 +1647,7 @@ void HubWatchDogThread(THREAD *t, void *param) } } } - UnlockList(hub->IpTable); + UnlockHashList(hub->MacHashTable); if ((LIST_NUM(o) + LIST_NUM(o2)) != 0) { From 70564a8f52b34ffccde4ac818277deb0e5b26aa2 Mon Sep 17 00:00:00 2001 From: Daiyuu Nobori Date: Wed, 1 Jan 2020 15:52:47 +0900 Subject: [PATCH 2/2] Bugfix: Imperfect Virtual Hub FDB lock may cause process crush. --- src/Cedar/Hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cedar/Hub.c b/src/Cedar/Hub.c index 32a5d04c..184f3312 100644 --- a/src/Cedar/Hub.c +++ b/src/Cedar/Hub.c @@ -1563,7 +1563,7 @@ void HubWatchDogThread(THREAD *t, void *param) o2 = NewListFast(NULL); // Send an ARP packet - LockHashList(hub->IpTable); + LockHashList(hub->MacHashTable); { num = LIST_NUM(hub->IpTable); for (i = 0;i < LIST_NUM(hub->IpTable);i++)