From: Stephen Hemminger <shemminger@vyatta.com>
To: Patrick McHardy <kaber@trash.net>
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, 9 Mar 2011 07:48:20 -0800 [thread overview]
Message-ID: <20110309074820.3094fa5d@s6510> (raw)
In-Reply-To: <4D777F6A.2020108@trash.net>
On Wed, 09 Mar 2011 14:23:54 +0100
Patrick McHardy <kaber@trash.net> wrote:
> 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.
Ok, then change "err = 0" to "err = -ENOENT" at start of xt_find_match
next prev parent reply other threads:[~2011-03-09 15:48 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
2011-03-09 15:48 ` Stephen Hemminger [this message]
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=20110309074820.3094fa5d@s6510 \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.