netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] netfilter: nft_compat: use .release_ops and remove list of extension
@ 2019-03-05 10:55 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2019-03-05 10:55 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

Hello Pablo Neira Ayuso,

The patch b8e204006340: "netfilter: nft_compat: use .release_ops and
remove list of extension" from Feb 13, 2019, leads to the following
static checker warning:

	net/netfilter/nf_tables_api.c:2167 nf_tables_expr_destroy()
	error: dereferencing freed memory 'expr->ops'

net/netfilter/nf_tables_api.c
    2162 static void nf_tables_expr_destroy(const struct nft_ctx *ctx,
    2163 				   struct nft_expr *expr)
    2164 {
    2165 	if (expr->ops->destroy)
    2166 		expr->ops->destroy(ctx, expr);
                                                ^^^^
--> 2167 	module_put(expr->ops->type->owner);
                           ^^^^^^^^^
    2168 }

Smatch says there are three functions which free expr->ops.

net/netfilter/nft_compat.c | nft_match_destroy 	     | 121 | PARAM_FREED | 1 | $->ops |
net/netfilter/nft_compat.c | nft_match_large_destroy | 124 | PARAM_FREED | 1 | $->ops |
net/netfilter/nft_compat.c | nft_target_destroy      | 56  | PARAM_FREED | 1 | $->ops |

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-05 10:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-05 10:55 [bug report] netfilter: nft_compat: use .release_ops and remove list of extension Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).