Skip to content

nft_bandwidth: add missing NULL guards to bandwidth_deps/tree_map.h#46

Open
ispyisail wants to merge 1 commit into
openwrt-2512from
nft-bandwidth-null-guards
Open

nft_bandwidth: add missing NULL guards to bandwidth_deps/tree_map.h#46
ispyisail wants to merge 1 commit into
openwrt-2512from
nft-bandwidth-null-guards

Conversation

@ispyisail

Copy link
Copy Markdown
Owner

Stacked on #43 — base branch is openwrt-2512 (the 25.12 bump), not master. Merge #43 first; this rebases cleanly onto master afterward.

nft_bandwidth carries its own private copy of the tree_map code family that package/libericstools/src/tree_map.c also uses. That copy already has NULL-pointer guards for a real segfault class fixed elsewhere in the tree; this private copy in bandwidth_deps/tree_map.h was missing the equivalent guards. Adds NULL checks to get_string_map_element_with_hashed_key, get_string_map_keys, and sdbm_string_hash to match.

Not a fix for the kernel-6.12 rootfs corruption bug (already fixed in #43 by correcting the module's netlink attribute count and adding a sockopt-rollback path on registration failure) — tested in isolation and confirmed this change alone does not resolve that issue. This is a separate, real defensive gap worth closing on its own merits: a NULL map or key reaching these functions elsewhere in the module would otherwise dereference unconditionally.

Bandwidth carries its own private copy of the tree_map code family
that package/libericstools/src/tree_map.c also uses. That copy already
had NULL-pointer guards added earlier for the same segfault class;
this copy was missing them. Adds get_string_map_element_with_hashed_key,
get_string_map_keys, and sdbm_string_hash NULL checks to match.

Found while investigating a separate kernel 6.12 boot corruption bug
in this module; tested in isolation and confirmed NOT the cause of
that corruption, but a real defensive gap worth fixing on its own
merits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant