Skip to content

Commit bcf4934

Browse files
Phil Sutterummakynes
authored andcommitted
netfilter: ebtables: Fix extension lookup with identical name
If a requested extension exists as module and is not loaded, ebt_check_match() might accidentally use an NFPROTO_UNSPEC one with same name and fail. Reproduced with limit match: Given xt_limit and ebt_limit both built as module, the following would fail: modprobe xt_limit ebtables -I INPUT --limit 1/s -j ACCEPT The fix is to make ebt_check_match() distrust a found NFPROTO_UNSPEC extension and retry after requesting an appropriate module. Cc: Florian Westphal <[email protected]> Signed-off-by: Phil Sutter <[email protected]> Acked-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 644c7e4 commit bcf4934

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/bridge/netfilter/ebtables.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,11 @@ ebt_check_match(struct ebt_entry_match *m, struct xt_mtchk_param *par,
370370
left - sizeof(struct ebt_entry_match) < m->match_size)
371371
return -EINVAL;
372372

373-
match = xt_request_find_match(NFPROTO_BRIDGE, m->u.name, 0);
373+
match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0);
374+
if (IS_ERR(match) || match->family != NFPROTO_BRIDGE) {
375+
request_module("ebt_%s", m->u.name);
376+
match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0);
377+
}
374378
if (IS_ERR(match))
375379
return PTR_ERR(match);
376380
m->u.match = match;

0 commit comments

Comments
 (0)