linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, Neil Horman <nhorman@tuxdriver.com>,
	davem@davemloft.net, Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net-next] sctp: bring inet(6)_skb_parm back to sctp_input_cb
Date: Thu, 5 Nov 2020 00:49:09 -0300	[thread overview]
Message-ID: <20201105034909.GJ11030@localhost.localdomain> (raw)
In-Reply-To: <136c1a7a419341487c504be6d1996928d9d16e02.1604472932.git.lucien.xin@gmail.com>

On Wed, Nov 04, 2020 at 02:55:32PM +0800, Xin Long wrote:
> inet(6)_skb_parm was removed from sctp_input_cb by Commit a1dd2cf2f1ae
> ("sctp: allow changing transport encap_port by peer packets"), as it
> thought sctp_input_cb->header is not used any more in SCTP.
> 
> syzbot reported a crash:
> 
>   [ ] BUG: KASAN: use-after-free in decode_session6+0xe7c/0x1580
>   [ ]
>   [ ] Call Trace:
>   [ ]  <IRQ>
>   [ ]  dump_stack+0x107/0x163
>   [ ]  kasan_report.cold+0x1f/0x37
>   [ ]  decode_session6+0xe7c/0x1580
>   [ ]  __xfrm_policy_check+0x2fa/0x2850
>   [ ]  sctp_rcv+0x12b0/0x2e30
>   [ ]  sctp6_rcv+0x22/0x40
>   [ ]  ip6_protocol_deliver_rcu+0x2e8/0x1680
>   [ ]  ip6_input_finish+0x7f/0x160
>   [ ]  ip6_input+0x9c/0xd0
>   [ ]  ipv6_rcv+0x28e/0x3c0
> 
> It was caused by sctp_input_cb->header/IP6CB(skb) still used in sctp rx
> path decode_session6() but some members overwritten by sctp6_rcv().
> 
> This patch is to fix it by bring inet(6)_skb_parm back to sctp_input_cb
> and not overwriting it in sctp4/6_rcv() and sctp_udp_rcv().
> 
> Reported-by: syzbot+5be8aebb1b7dfa90ef31@syzkaller.appspotmail.com
> Fixes: a1dd2cf2f1ae ("sctp: allow changing transport encap_port by peer packets")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

Thanks Xin.

  reply	other threads:[~2020-11-05  3:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04  6:55 [PATCH net-next] sctp: bring inet(6)_skb_parm back to sctp_input_cb Xin Long
2020-11-05  3:49 ` Marcelo Ricardo Leitner [this message]
2020-11-05 22:29   ` Jakub Kicinski

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=20201105034909.GJ11030@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@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;
as well as URLs for NNTP newsgroup(s).