From: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
To: Hillf Danton <hdanton@sina.com>
Cc: syzbot <syzbot+2bef95d3ab4daa10155b@syzkaller.appspotmail.com>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
luiz.von.dentz@intel.com, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] KASAN: use-after-free Write in sco_sock_timeout
Date: Mon, 30 Aug 2021 12:41:48 +0800 [thread overview]
Message-ID: <33d6d22f-7666-bc08-f626-3821cac9f174@gmail.com> (raw)
In-Reply-To: <20210830001538.1980-1-hdanton@sina.com>
On 30/8/21 8:15 am, Hillf Danton wrote:
> On Mon, 30 Aug 2021 02:34:11 +0800 Desmond Cheong Zhi Xi wrote:
>>
>> Ok I went back to make a more thorough audit. Even without calling
>> cancel_delayed_work_sync, sco_sock_timeout should not cause a UAF.
>>
>> I believe the real issue is that we can allocate a connection twice in
>> sco_connect. This means that the first connection gets lost and we're
>> unable to clean it up properly.
>>
>> Thoughts on this?
>
> LGTM regardless of the uaf reported.
>
> Hillf
Thanks for taking a look. It passed the Syzbot reproducer too, so I
think the root cause should have been addressed.
I'll write up a patch to summarize what we found out. May I include you
as a Co-developed-by: author?
>>
>> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git e3f30ab28ac8
>>
>> --- a/net/bluetooth/sco.c
>> +++ b/net/bluetooth/sco.c
>> @@ -578,9 +578,6 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen
>> addr->sa_family != AF_BLUETOOTH)
>> return -EINVAL;
>>
>> - if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND)
>> - return -EBADFD;
>> -
>> if (sk->sk_type != SOCK_SEQPACKET)
>> return -EINVAL;
>>
>> @@ -591,6 +588,13 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen
>>
>> lock_sock(sk);
>>
>> + if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND) {
>> + hci_dev_unlock(hdev);
>> + hci_dev_put(hdev);
>> + err = -EBADFD;
>> + goto done;
>> + }
>> +
>> /* Set destination address and psm */
>> bacpy(&sco_pi(sk)->dst, &sa->sco_bdaddr);
>>
>>
next prev parent reply other threads:[~2021-08-30 4:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 16:29 syzbot
[not found] ` <20210827011931.2323-1-hdanton@sina.com>
2021-08-27 7:58 ` Desmond Cheong Zhi Xi
[not found] ` <20210829082929.2897-1-hdanton@sina.com>
2021-08-29 8:51 ` syzbot
2021-08-29 14:53 ` Desmond Cheong Zhi Xi
2021-08-29 18:34 ` Desmond Cheong Zhi Xi
2021-08-30 3:50 ` syzbot
[not found] ` <20210830001538.1980-1-hdanton@sina.com>
2021-08-30 4:41 ` Desmond Cheong Zhi Xi [this message]
2022-02-23 16:15 ` syzbot
[not found] <20220227025605.2681-1-hdanton@sina.com>
2022-02-27 3:07 ` syzbot
[not found] <20220227032747.2752-1-hdanton@sina.com>
2022-02-27 3:39 ` syzbot
[not found] <20220227060827.2844-1-hdanton@sina.com>
2022-02-27 6:20 ` syzbot
[not found] <20220227074046.2963-1-hdanton@sina.com>
2022-02-27 7:53 ` syzbot
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=33d6d22f-7666-bc08-f626-3821cac9f174@gmail.com \
--to=desmondcheongzx@gmail.com \
--cc=hdanton@sina.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.von.dentz@intel.com \
--cc=syzbot+2bef95d3ab4daa10155b@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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
all inboxes | Powered by JetHome®