netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [bug report] netfilter: nft_compat: use .release_ops and remove list of extension
Date: Tue, 5 Mar 2019 13:55:28 +0300	[thread overview]
Message-ID: <20190305105527.GA9714@kadam> (raw)

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

                 reply	other threads:[~2019-03-05 10:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190305105527.GA9714@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).