From: Hyunwoo Kim <v4bel@theori.io>
To: Martyn Welch <martyn.welch@collabora.com>
Cc: marcel@holtmann.org, luiz.dentz@gmail.com, imv4bel@gmail.com,
johan.hedberg@gmail.com, linux-bluetooth@vger.kernel.org,
v4bel@theori.io
Subject: Re: [PATCH v2] Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg
Date: Mon, 22 Apr 2024 19:49:49 -0400 [thread overview]
Message-ID: <Zib3nSvQZHcVS8l5@v4bel-B760M-AORUS-ELITE-AX> (raw)
In-Reply-To: <8dad5b42-a843-4935-a31e-91a2eadf0c72@collabora.com>
Dear Martyn Welch,
I apologize for the long delay in responding.
On Thu, Feb 22, 2024 at 11:23:05AM +0000, Martyn Welch wrote:
> Hi Hyunwoo,
>
> I've been looking into a few CVEs, the one of interest in this case is
> CVE-2024-21803.
>
> There seems to be little publicly available information about this CVE,
> however the title of this patch and the affected kernel range suggest this
> may be a fix for this CVE.
This patch is for CVE-2023-51779.
>
> Would you be able to clarify whether this is a fix for CVE-2024-21803?
IMO, CVE-2024-21803 appears to be the same vulnerability as CVE-2023-51779.
It appears to be a duplicate CVE that was registered due to an unknown reporter's mistake.
Best Regards,
Hyunwoo Kim
>
> Thanks,
>
> Martyn
>
> On 09/12/2023 10:55, Hyunwoo Kim wrote:
> > This can cause a race with bt_sock_ioctl() because
> > bt_sock_recvmsg() gets the skb from sk->sk_receive_queue
> > and then frees it without holding lock_sock.
> > A use-after-free for a skb occurs with the following flow.
> > ```
> > bt_sock_recvmsg() -> skb_recv_datagram() -> skb_free_datagram()
> > bt_sock_ioctl() -> skb_peek()
> > ```
> > Add lock_sock to bt_sock_recvmsg() to fix this issue.
> >
> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > Signed-off-by: Hyunwoo Kim <v4bel@theori.io>
> > ---
> > v1 -> v2: Remove duplicate release_sock()s
> > ---
> > net/bluetooth/af_bluetooth.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
> > index 336a76165454..b93464ac3517 100644
> > --- a/net/bluetooth/af_bluetooth.c
> > +++ b/net/bluetooth/af_bluetooth.c
> > @@ -309,11 +309,14 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> > if (flags & MSG_OOB)
> > return -EOPNOTSUPP;
> > + lock_sock(sk);
> > +
> > skb = skb_recv_datagram(sk, flags, &err);
> > if (!skb) {
> > if (sk->sk_shutdown & RCV_SHUTDOWN)
> > - return 0;
> > + err = 0;
> > + release_sock(sk);
> > return err;
> > }
> > @@ -343,6 +346,8 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
> > skb_free_datagram(sk, skb);
> > + release_sock(sk);
> > +
> > if (flags & MSG_TRUNC)
> > copied = skblen;
prev parent reply other threads:[~2024-04-22 23:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-09 10:55 [PATCH v2] Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg Hyunwoo Kim
2023-12-09 11:30 ` [v2] " bluez.test.bot
2023-12-15 16:00 ` [PATCH v2] " patchwork-bot+bluetooth
2024-02-22 11:23 ` Martyn Welch
2024-04-22 23:49 ` Hyunwoo Kim [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=Zib3nSvQZHcVS8l5@v4bel-B760M-AORUS-ELITE-AX \
--to=v4bel@theori.io \
--cc=imv4bel@gmail.com \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=martyn.welch@collabora.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 read-only IMAP folder(s) and NNTP newsgroup(s).