netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: syzbot <syzbot+2dc91e7fc3dea88b1e8a@syzkaller.appspotmail.com>,
	courmisch@gmail.com, davem@davemloft.net, kuba@kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] kernel BUG at net/phonet/socket.c:LINE!
Date: Mon, 20 Dec 2021 00:09:47 +0300	[thread overview]
Message-ID: <dac227fc-b0ce-79e1-c42f-eb03b4f5d699@gmail.com> (raw)
In-Reply-To: <00000000000005721f05d3810165@google.com>

On 12/19/21 17:58, syzbot wrote:
> syzbot has found a reproducer for the following issue on:
> 
> HEAD commit:    60ec7fcfe768 qlcnic: potential dereference null pointer of..
> git tree:       net
> console output: https://syzkaller.appspot.com/x/log.txt?x=11b3505db00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=fa556098924b78f0
> dashboard link: https://syzkaller.appspot.com/bug?extid=2dc91e7fc3dea88b1e8a
> compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=168791cdb00000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14a0cbcdb00000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+2dc91e7fc3dea88b1e8a@syzkaller.appspotmail.com
> 

This bug can be triggered via simple

sk = socket(AF_PHONET)
ioctl(sk, SIOCPNENABLEPIPE, 0)
connect(sk);


ioctl() sets sk->sk_state to TCP_SYN_SENT in pep_sock_enable() and then 
there is following check in pn_socket_bind():

	if (sk->sk_state != TCP_CLOSE || pn_port(pn->sobject)) {
		err = -EINVAL; /* attempt to rebind */
		goto out;
	}

Looks like "sk->sk_state != TCP_CLOSE" check is redundant and 
pn_port(pn->sobject) is unique flag, that socket is already binded.




With regards,
Pavel Skripkin

      reply	other threads:[~2021-12-19 21:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10  7:16 kernel BUG at net/phonet/socket.c:LINE! syzbot
2020-04-11  0:43 ` Vito Caputo
2020-04-11  7:36   ` Rémi Denis-Courmont
2020-04-13  5:49     ` Vito Caputo
2020-04-13  6:01       ` Rémi Denis-Courmont
2020-04-13  6:05         ` Vito Caputo
2021-12-19 14:58 ` [syzbot] " syzbot
2021-12-19 21:09   ` Pavel Skripkin [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=dac227fc-b0ce-79e1-c42f-eb03b4f5d699@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=courmisch@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+2dc91e7fc3dea88b1e8a@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;
as well as URLs for NNTP newsgroup(s).