All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Qiujun Huang <hqjagain@gmail.com>
Cc: davem@davemloft.net, vyasevich@gmail.com, nhorman@tuxdriver.com,
	kuba@kernel.org, linux-sctp@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	anenbupt@gmail.com
Subject: Re: [PATCH v6] sctp: fix refcount bug in sctp_wfree
Date: Fri, 27 Mar 2020 01:05:34 -0300	[thread overview]
Message-ID: <20200327040534.GK3756@localhost.localdomain> (raw)
In-Reply-To: <20200327030751.19404-1-hqjagain@gmail.com>

On Fri, Mar 27, 2020 at 11:07:51AM +0800, Qiujun Huang wrote:
> We should iterate over the datamsgs to move
> all chunks(skbs) to newsk.
> 
> The following case cause the bug:
> for the trouble SKB, it was in outq->transmitted list
> 
> sctp_outq_sack
>         sctp_check_transmitted
>                 SKB was moved to outq->sacked list
>         then throw away the sack queue
>                 SKB was deleted from outq->sacked
> (but it was held by datamsg at sctp_datamsg_to_asoc
> So, sctp_wfree was not called here)
> 
> then migrate happened
> 
>         sctp_for_each_tx_datachunk(
>         sctp_clear_owner_w);
>         sctp_assoc_migrate();
>         sctp_for_each_tx_datachunk(
>         sctp_set_owner_w);
> SKB was not in the outq, and was not changed to newsk
> 
> finally
> 
> __sctp_outq_teardown
>         sctp_chunk_put (for another skb)
>                 sctp_datamsg_put
>                         __kfree_skb(msg->frag_list)
>                                 sctp_wfree (for SKB)
> 	SKB->sk was still oldsk (skb->sk != asoc->base.sk).
> 
> Reported-and-tested-by: syzbot+cea71eec5d6de256d54d@syzkaller.appspotmail.com
> Signed-off-by: Qiujun Huang <hqjagain@gmail.com>

Acked-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Thanks Qiujun.

WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Qiujun Huang <hqjagain@gmail.com>
Cc: davem@davemloft.net, vyasevich@gmail.com, nhorman@tuxdriver.com,
	kuba@kernel.org, linux-sctp@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	anenbupt@gmail.com
Subject: Re: [PATCH v6] sctp: fix refcount bug in sctp_wfree
Date: Fri, 27 Mar 2020 04:05:34 +0000	[thread overview]
Message-ID: <20200327040534.GK3756@localhost.localdomain> (raw)
In-Reply-To: <20200327030751.19404-1-hqjagain@gmail.com>

On Fri, Mar 27, 2020 at 11:07:51AM +0800, Qiujun Huang wrote:
> We should iterate over the datamsgs to move
> all chunks(skbs) to newsk.
> 
> The following case cause the bug:
> for the trouble SKB, it was in outq->transmitted list
> 
> sctp_outq_sack
>         sctp_check_transmitted
>                 SKB was moved to outq->sacked list
>         then throw away the sack queue
>                 SKB was deleted from outq->sacked
> (but it was held by datamsg at sctp_datamsg_to_asoc
> So, sctp_wfree was not called here)
> 
> then migrate happened
> 
>         sctp_for_each_tx_datachunk(
>         sctp_clear_owner_w);
>         sctp_assoc_migrate();
>         sctp_for_each_tx_datachunk(
>         sctp_set_owner_w);
> SKB was not in the outq, and was not changed to newsk
> 
> finally
> 
> __sctp_outq_teardown
>         sctp_chunk_put (for another skb)
>                 sctp_datamsg_put
>                         __kfree_skb(msg->frag_list)
>                                 sctp_wfree (for SKB)
> 	SKB->sk was still oldsk (skb->sk != asoc->base.sk).
> 
> Reported-and-tested-by: syzbot+cea71eec5d6de256d54d@syzkaller.appspotmail.com
> Signed-off-by: Qiujun Huang <hqjagain@gmail.com>

Acked-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Thanks Qiujun.

  reply	other threads:[~2020-03-27  4:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27  3:07 [PATCH v6] sctp: fix refcount bug in sctp_wfree Qiujun Huang
2020-03-27  3:07 ` Qiujun Huang
2020-03-27  4:05 ` Marcelo Ricardo Leitner [this message]
2020-03-27  4:05   ` Marcelo Ricardo Leitner
2020-03-30  4:58 ` David Miller
2020-03-30  4:58   ` David Miller

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=20200327040534.GK3756@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=anenbupt@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hqjagain@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=vyasevich@gmail.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 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.