mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+d4ecae01a53fd9b42e7d@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bluetooth?] KASAN: slab-out-of-bounds Read in rfcomm_sock_setsockopt
Date: Fri,  5 Apr 2024 17:30:46 +0800	[thread overview]
Message-ID: <tencent_53918DA792625DBADD92991DCFD98DDF2507@qq.com> (raw)
In-Reply-To: <000000000000b9b20e061553f06e@google.com>

please test oob in rfcomm_sock_setsockopt

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fe46a7dd189e

diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index b54e8a530f55..42c55c756b51 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -629,7 +629,7 @@ static int rfcomm_sock_setsockopt_old(struct socket *sock, int optname,
 
 	switch (optname) {
 	case RFCOMM_LM:
-		if (copy_from_sockptr(&opt, optval, sizeof(u32))) {
+		if (copy_from_sockptr(&opt, optval, min_t(int, sizeof(u32), optlen))) {
 			err = -EFAULT;
 			break;
 		}


  reply	other threads:[~2024-04-05  9:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05  6:55 syzbot
2024-04-05  9:30 ` Edward Adam Davis [this message]
2024-04-06  0:52   ` syzbot
2024-04-05 10:16 ` [PATCH] net/socket: the length value of the input socket option parameter is too small Edward Adam Davis
2024-04-05 11:08   ` Paul Menzel
2024-04-09 12:15     ` [PATCH] net/socket: Ensure length of input socket option param >= sizeof(int) Edward Adam Davis
2024-04-09 13:07       ` Eric Dumazet
2024-04-09 13:25         ` Luiz Augusto von Dentz
2024-04-09 13:36         ` [PATCH] Bluetooth: fix oob in rfcomm_sock_setsockopt Edward Adam Davis
2024-04-09 14:11           ` Luiz Augusto von Dentz
2024-04-09 14:01         ` [PATCH] net/socket: Ensure length of input socket option param >= sizeof(int) Edward Adam Davis
2024-04-09 14:17           ` Eric Dumazet
2024-04-09 18:27           ` Jakub Kicinski
2024-04-05 11:39   ` [PATCH] net/socket: the length value of the input socket option parameter is too small Eric Dumazet

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=tencent_53918DA792625DBADD92991DCFD98DDF2507@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+d4ecae01a53fd9b42e7d@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®