public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Timo Teräs" <timo.teras@iki•fi>
To: Mark Brown <broonie@opensource•wolfsonmicro.com>
Cc: "David S. Miller" <davem@davemloft•net>, netdev@vger•kernel.org
Subject: Re: [PATCH] xfrm: Fix double dst_release() in xfrm_lookup() -EREMOTE case
Date: Thu, 08 Apr 2010 15:39:38 +0300	[thread overview]
Message-ID: <4BBDCE8A.7040106@iki.fi> (raw)
In-Reply-To: <1270729773-1758-1-git-send-email-broonie@opensource.wolfsonmicro.com>

Mark Brown wrote:
> Commit 80c802 ("xfrm: cache bundles instead of policies for outgoing
> flows") changed __xfrm_policy() to call dst_release() when returning
> -EREMOTE. In the case where this is called from xfrm_lookup() a double
> call to dst_release() would result due to the existing dst_release()
> there. Remove the dst_release() in xfrm_lookup().
> 
> Signed-off-by: Mark Brown <broonie@opensource•wolfsonmicro.com>
> ---
> 
> I'm not sure if this is correct or not - there may a reference been
> taken earlier in __xfrm_lookup() that's being dropped but I didn't spot
> it.

This is not correct.

The only case we return -EREMOTE from __xfrm_policy() is at:
                if (net->xfrm.sysctl_larval_drop) {
                        /* EREMOTE tells the caller to generate
                         * a one-shot blackhole route. */
                        dst_release(dst);
                        xfrm_pols_put(pols, num_pols);
                        XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES);
                        return -EREMOTE;
                }

It drops the inner xfrm_dst returned from flow cache lookup / resolver.
xfrm_lookup() will drop the original dst (which is not xfrm_dst).

This semantics is important because __xfrm_lookup() is also called
from other places, that do other things when they get -EREMOTE.

- TImo

  reply	other threads:[~2010-04-08 12:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08 12:29 [PATCH] xfrm: Fix double dst_release() in xfrm_lookup() -EREMOTE case Mark Brown
2010-04-08 12:39 ` Timo Teräs [this message]
2010-04-08 13:43   ` Mark Brown

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=4BBDCE8A.7040106@iki.fi \
    --to=timo.teras@iki$(echo .)fi \
    --cc=broonie@opensource$(echo .)wolfsonmicro.com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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