netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	David Miller <davem@davemloft.net>,
	netfilter-devel@vger.kernel.org
Subject: Re: [RFC] x_tables: misuse of try_then_request_module
Date: Wed, 09 Mar 2011 14:23:54 +0100	[thread overview]
Message-ID: <4D777F6A.2020108@trash.net> (raw)
In-Reply-To: <20110308172318.4992a3a6@nehalam>

Am 09.03.2011 02:23, schrieb Stephen Hemminger:
> Since xt_find_match() returns ERR_PTR(xx) on error not NULL,
> the macro try_then_request_module won't work correctly here.
> The macro expects its first argument will be zero if condition
> fails. But ERR_PTR(-ENOENT) is not zero.
> 
> The correct solution is to propagate the error value
> back.
> 
> Found by inspection, and compile tested only.

Thanks Stephen. It actually works fine since we don't return
-ENOENT but 0 if nothing was found. If a non-matching revision
was found we return -EPROTOTYPE, but that case can only happen
if the module was already loaded.

Anyways, this seems quite fragile, so I've applied your patch.

  reply	other threads:[~2011-03-09 13:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-09  1:23 [RFC] x_tables: misuse of try_then_request_module Stephen Hemminger
2011-03-09 13:23 ` Patrick McHardy [this message]
2011-03-09 15:48   ` Stephen Hemminger
2011-03-14 18:21     ` Patrick McHardy

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=4D777F6A.2020108@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=shemminger@vyatta.com \
    /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).