freebsd-dev/sys
Kristof Provost 151abc80cd if_vlan: avoid hash table thrashing when adding and removing entries
vlan_remhash() uses incorrect value for b.

When using the default value for VLAN_DEF_HWIDTH (4), the VLAN hash-list table
expands from 16 chains to 32 chains as the 129th entry is added. trunk->hwidth
becomes 5. Say a few more entries are added and there are now 135 entries.
trunk-hwidth will still be 5. If an entry is removed, vlan_remhash() will
calculate a value of 32 for b. refcnt will be decremented to 134. The if
comparison at line 473 will return true and vlan_growhash() will be called. The
VLAN hash-list table will be compressed from 32 chains wide to 16 chains wide.
hwidth will become 4. This is an error, and it can be seen when a new VLAN is
added. The table will again be expanded. If an entry is then removed, again
the table is contracted.

If the number of VLANS stays in the range of 128-512, each time an insert
follows a remove, the table will expand. Each time a remove follows an
insert, the table will be contracted.

The fix is simple. The line 473 should test that the number of entries has
decreased such that the table should be contracted using what would be the new
value of hwidth. line 467 should be:

	b = 1 << (trunk->hwidth - 1);

PR:		265382
Reviewed by:	kp
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
2022-07-22 19:18:41 +02:00
..
amd64 ddb: annotate some commands with DB_CMD_MEMSAFE 2022-07-18 22:06:09 +00:00
arm Rework how shared page related data is stored 2022-07-18 16:27:32 +02:00
arm64 Add experimental 16k page support on arm64 2022-07-19 10:57:03 +01:00
bsm
cam Delay GEOM disk_create() until CAM periph probe completes. 2022-07-14 16:17:36 -04:00
cddl Adjust fbt_unload() definition to avoid clang 15 warning 2022-07-21 19:42:43 +02:00
compat Implement shared page address randomization 2022-07-18 16:27:37 +02:00
conf Fix unused variable warning in acpica's nsaccess.c 2022-07-20 21:10:43 +02:00
contrib zfs: fixup build on powerpc64le 2022-07-08 18:52:14 -03:00
crypto OpenSSL: Regen assembly file for OpenSSSL 1.1.1q 2022-07-05 12:06:50 -04:00
ddb Adjust db_flush_line() definition to avoid clang 15 warning 2022-07-19 20:37:15 +02:00
dev ig4(4): Add device HID to match I2C controller on ASUS X540 laptops 2022-07-22 02:49:13 +03:00
dts sys/dts: Remove MIPS files 2022-05-20 17:11:27 +01:00
fs cuse(3): Allow shared memory allocations up to, but excluding 2 GBytes. 2022-07-20 10:41:11 +02:00
gdb ddb: use _FLAGS command macros where appropriate 2022-07-05 11:56:55 -03:00
geom Clarify when GEOM utilities exit with success or failure. 2022-07-16 10:26:51 -07:00
gnu bwn: eliminate dead writes in BWN_GPL_PHY 2022-05-04 09:32:59 -04:00
i386 ddb: annotate some commands with DB_CMD_MEMSAFE 2022-07-18 22:06:09 +00:00
isa isa: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:59 -07:00
kern Add kern.reboot_wait_time sysctl 2022-07-18 17:23:25 -07:00
kgssapi
libkern libkern: Fix a typo in a source code comment 2022-06-05 08:57:26 +02:00
modules mac: add new mac_ddb(4) policy 2022-07-18 22:06:15 +00:00
net if_vlan: avoid hash table thrashing when adding and removing entries 2022-07-22 19:18:41 +02:00
net80211 net80211 / LinuxKPI: 802.11: add Control Trigger Subframe information 2022-06-17 22:55:13 +00:00
netgraph ng_ubt(4): Probe USB Bluetooth per USB interface and not per USB device. 2022-06-03 10:49:17 +02:00
netinet IPv4: correct limit on loopback_prefix 2022-07-21 09:38:17 -05:00
netinet6 netinet6: fix interface handling for loopback traffic 2022-07-10 12:47:47 +00:00
netipsec Fix unused variable warning in ipsec_mbuf.c 2022-07-21 22:12:01 +02:00
netpfil Adjust ipfw_iface_{init,destroy}() definitions to avoid clang 15 warning 2022-07-21 21:38:17 +02:00
netsmb
nfs nfs: skip bootpc when vfs.root.mountfrom is other than nfs 2022-05-31 16:07:27 -03:00
nfsclient
nfsserver
nlm
ofed ofed/infiniband: fix ifdefs for new INET changes, fixing LINT-NOIP 2022-07-18 08:02:01 -05:00
opencrypto ddb: annotate some commands with DB_CMD_MEMSAFE 2022-07-18 22:06:09 +00:00
powerpc Rework how shared page related data is stored 2022-07-18 16:27:32 +02:00
riscv Rework how shared page related data is stored 2022-07-18 16:27:32 +02:00
rpc krpc: Fix NFS-over-TLS for KTLS1.3 2022-05-15 11:51:56 -07:00
security Revert "mac_ddb: Make db_show_vnet_valid() handle !VIMAGE" 2022-07-21 14:26:54 +00:00
sys libnv: bump library version 2022-07-22 00:23:08 +02:00
teken
tests
tools firmware: Map '@' in filenames to '_' in symbols. 2022-06-14 10:50:51 -07:00
ufs Bug fix to UFS/FFS superblock integrity checks when reading a superblock. 2022-07-20 22:52:11 -07:00
vm swap_pager: Reduce the scope of the object lock in putpages 2022-07-18 22:35:49 -05:00
x86 x86/iommu: Shrink the critical section in dmar_qi_task() 2022-07-18 22:23:13 -05:00
xdr
xen xenbus: improve device tracking 2022-06-07 12:29:53 +02:00
Makefile