netfilter: nf_tables_offload: drop device refcount on error
Subsystems (2)
Florian Westphal
maintainerPATCH 1/1 netfilter: nf_tables_offload: drop device refcount on error
Reported by sashiko:
If nft_flow_action_entry_next() returns NULL, dev reference leaks.
Fixes c6f85577584b ("netfilter: nf_tables_offload: add nft_flow_action_entry_next() and use it")
Reported-by Juri Lelli <[email protected]>
Signed-off-by Florian Westphal <[email protected]>
--- net/netfilter/nf_dup_netdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/netfilter/nf_dup_netdev.c +4 -2
@@ -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 ;
Signature · 1 line
2.53.0
Quoted 6 lines · Florian Westphal
Reported by sashiko:
Ifnft_flow_action_entry_next()returns NULL, dev reference leaks.Fixes c6f85577584b ("netfilter: nf_tables_offload: add nft_flow_action_entry_next() and use it")Reported-by Juri Lelli <[email protected]>Signed-off-by Florian Westphal <[email protected]>
Reviewed-by Fernando Fernandez Mancera <[email protected]>
Thanks!