From: Vlad Yasevich <vyasevich@gmail.com>
To: linux-sctp@vger.kernel.org
Subject: Re: SCTP BH locking during sctp_inq_push()
Date: Thu, 10 Sep 2015 19:31:41 +0000 [thread overview]
Message-ID: <55F1DA9D.6080700@gmail.com> (raw)
In-Reply-To: <CAGugRbUFuhFYeEy=7e5ibgpthPsYw_4Rpa4htRf3Lmdbw3N_eA@mail.gmail.com>
On 09/10/2015 11:13 AM, Karl Heiss wrote:
> Hi,
>
> While looking through the code in sctp_backlog_rcv(), I noticed a case
> whereby sctp_inq_push() can be called outside of a bh_lock_sock()
> region if the likely case succeeds and the association has not moved.
>
> The exact line in question:
> https://github.com/torvalds/linux/blob/v4.2-rc8/net/sctp/input.c#L350
>
> Intuitively this looks incorrect, as all other calls to
> sctp_inq_push() are within a BH socket lock. Am I missing something
> obvious that allows this particular case?
The bh socket lock is needed to protect the state machine from concurrent
bh and user access.
If the socket hasn't moved, the caller of the of backlog processing
holds the user side of the lock (i.e socket is owned by user).
As a result, any further incoming packets will be queued to backlog.
So the inqueue and the state machine are already protected. No need
to hold the bh_lock.
-vlad
>
> Regards,
> Karl
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2015-09-10 19:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-10 15:13 SCTP BH locking during sctp_inq_push() Karl Heiss
2015-09-10 19:31 ` Vlad Yasevich [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=55F1DA9D.6080700@gmail.com \
--to=vyasevich@gmail.com \
--cc=linux-sctp@vger.kernel.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.