linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: vegard.nossum@oracle.com
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org,
	lucien.xin@gmail.com, herbert@gondor.apana.org.au,
	ebiederm@xmission.com, marcelo.leitner@gmail.com,
	stable@vger.kernel.org
Subject: Re: [PATCH RESEND] net/sctp: always initialise sctp_ht_iter::start_fail
Date: Sat, 13 Aug 2016 22:10:50 +0000	[thread overview]
Message-ID: <20160813.151050.1364196940604628961.davem@davemloft.net> (raw)
In-Reply-To: <1470988251-18792-1-git-send-email-vegard.nossum@oracle.com>

From: Vegard Nossum <vegard.nossum@oracle.com>
Date: Fri, 12 Aug 2016 09:50:51 +0200

> sctp_transport_seq_start() does not currently clear iter->start_fail on
> success, but relies on it being zero when it is allocated (by
> seq_open_net()).
> 
> This can be a problem in the following sequence:
> 
>     open() // allocates iter (and implicitly sets iter->start_fail = 0)
>     read()
>      - iter->start() // fails and sets iter->start_fail = 1
>      - iter->stop() // doesn't call sctp_transport_walk_stop() (correct)
>     read() again
>      - iter->start() // succeeds, but doesn't change iter->start_fail
>      - iter->stop() // doesn't call sctp_transport_walk_stop() (wrong)
> 
> We should initialize sctp_ht_iter::start_fail to zero if ->start()
> succeeds, otherwise it's possible that we leave an old value of 1 there,
> which will cause ->stop() to not call sctp_transport_walk_stop(), which
> causes all sorts of problems like not calling rcu_read_unlock() (and
> preempt_enable()), eventually leading to more warnings like this:
 ...
> Notice that this is a subtly different stacktrace from the one in commit
> 5fc382d875 ("net/sctp: terminate rhashtable walk correctly").
> 
> Cc: Xin Long <lucien.xin@gmail.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>

Applied and queued up for -stable, thanks.

      parent reply	other threads:[~2016-08-13 22:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12  7:50 [PATCH RESEND] net/sctp: always initialise sctp_ht_iter::start_fail Vegard Nossum
2016-08-12 13:38 ` Neil Horman
2016-08-12 14:41 ` Marcelo Ricardo Leitner
2016-08-13 22:10 ` David Miller [this message]

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=20160813.151050.1364196940604628961.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vegard.nossum@oracle.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).