Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: lucien.xin@gmail.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-sctp@vger.kernel.org, marcelo.leitner@gmail.com,
	nhorman@tuxdriver.com
Subject: Re: [PATCH net] sctp: set flow sport from saddr only when it's 0
Date: Thu, 24 Jan 2019 18:25:41 -0800 (PST)	[thread overview]
Message-ID: <20190124.182541.341610576126108739.davem@davemloft.net> (raw)
In-Reply-To: <91961be2ab833139b1a4b0188ba47c2581b991d4.1548096161.git.lucien.xin@gmail.com>

From: Xin Long <lucien.xin@gmail.com>
Date: Tue, 22 Jan 2019 02:42:41 +0800

> Now sctp_transport_pmtu() passes transport->saddr into .get_dst() to set
> flow sport from 'saddr'. However, transport->saddr is set only when
> transport->dst exists in sctp_transport_route().
> 
> If sctp_transport_pmtu() is called without transport->saddr set, like
> when transport->dst doesn't exists, the flow sport will be set to 0
> from transport->saddr, which will cause a wrong route to be got.
> 
> Commit 6e91b578bf3f ("sctp: re-use sctp_transport_pmtu in
> sctp_transport_route") made the issue be triggered more easily
> since sctp_transport_pmtu() would be called in sctp_transport_route()
> after that.
> 
> In gerneral, fl4->fl4_sport should always be set to
> htons(asoc->base.bind_addr.port), unless transport->asoc doesn't exist
> in sctp_v4/6_get_dst(), which is the case:
> 
>   sctp_ootb_pkt_new() ->
>     sctp_transport_route()
> 
> For that, we can simply handle it by setting flow sport from saddr only
> when it's 0 in sctp_v4/6_get_dst().
> 
> Fixes: 6e91b578bf3f ("sctp: re-use sctp_transport_pmtu in sctp_transport_route")
> Reported-by: Ying Xu <yinxu@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable.

      reply	other threads:[~2019-01-25  2:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21 18:42 [PATCH net] sctp: set flow sport from saddr only when it's 0 Xin Long
2019-01-25  2:25 ` 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=20190124.182541.341610576126108739.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.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