mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
netfilter: nf_tables_offload: drop device refcount on error
Reported by sashiko:
If nft_flow_action_entry_next() returns NULL, dev reference leaks.
Fixes: c6f8557758 ("netfilter: nf_tables_offload: add nft_flow_action_entry_next() and use it")
Reported-by: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
ccb9fd4b87
commit
efc5425617
|
|
@ -74,16 +74,18 @@ int nft_fwd_dup_netdev_offload(struct nft_offload_ctx *ctx,
|
|||
struct flow_action_entry *entry;
|
||||
struct net_device *dev;
|
||||
|
||||
/* nft_flow_rule_destroy() releases the reference on this device. */
|
||||
dev = dev_get_by_index(ctx->net, oif);
|
||||
if (!dev)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
entry = nft_flow_action_entry_next(ctx, flow);
|
||||
if (!entry)
|
||||
if (!entry) {
|
||||
dev_put(dev);
|
||||
return -E2BIG;
|
||||
}
|
||||
|
||||
entry->id = id;
|
||||
/* nft_flow_rule_destroy() releases the reference on this device. */
|
||||
entry->dev = dev;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user