netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Jon Maloy <jon.maloy@ericsson.com>,
	Kirill Tkhai <ktkhai@virtuozzo.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	syzbot <syzbot+749d9d87c294c00ca856@syzkaller.appspotmail.com>,
	Ying Xue <ying.xue@windriver.com>
Cc: Andrei Vagin <avagin@virtuozzo.com>,
	David Miller <davem@davemloft.net>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Florian Westphal <fw@strlen.de>,
	LKML <linux-kernel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>,
	"roman.kapl@sysgo.com" <roman.kapl@sysgo.com>,
	"syzkaller-bugs@googlegroups.com"
	<syzkaller-bugs@googlegroups.com>,
	"tipc-discussion@lists.sourceforge.net"
	<tipc-discussion@lists.sourceforge.net>
Subject: Re: BUG: sleeping function called from invalid context at net/core/sock.c:LINE (3)
Date: Mon, 19 Feb 2018 14:57:11 +0100	[thread overview]
Message-ID: <1519048631.2870.25.camel@redhat.com> (raw)
In-Reply-To: <BN6PR15MB155309E2A35F66298DAD8E2E9AC80@BN6PR15MB1553.namprd15.prod.outlook.com>

On Mon, 2018-02-19 at 13:23 +0000, Jon Maloy wrote:
> I don't understand this one. tipc_topsrv_stop() can only be trigged
> from a user doing rmmod(), and I double checked that this is running
> in user mode.
> How does the call chain you are reporting occur?

tipc_topsrv_stop() is called also at net namespace destruction time:

static void __net_exit tipc_exit_net(struct net *net)
{
	tipc_topsrv_stop(net);
#...

I *think* the following should fix the issue, but I'm unsure if it's
safe.

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master

---
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c
index 02013e00f287..63f35eae7236 100644
--- a/net/tipc/topsrv.c
+++ b/net/tipc/topsrv.c
@@ -693,9 +693,9 @@ void tipc_topsrv_stop(struct net *net)
        }
        __module_get(lsock->ops->owner);
        __module_get(lsock->sk->sk_prot_creator->owner);
-       sock_release(lsock);
        srv->listener = NULL;
        spin_unlock_bh(&srv->idr_lock);
+       sock_release(lsock);
        tipc_topsrv_work_stop(srv);
        idr_destroy(&srv->conn_idr);
        kfree(srv);

  parent reply	other threads:[~2018-02-19 13:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-17  3:00 BUG: sleeping function called from invalid context at net/core/sock.c:LINE (3) syzbot
2018-02-17  8:15 ` Dmitry Vyukov
2018-02-17 22:23   ` Kirill Tkhai
2018-02-19 13:23     ` Jon Maloy
2018-02-19 13:32       ` Dmitry Vyukov
2018-02-19 13:57       ` Paolo Abeni [this message]
2018-02-19 14:14         ` syzbot
2018-02-19 14:41       ` Kirill Tkhai

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=1519048631.2870.25.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=avagin@virtuozzo.com \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=ebiederm@xmission.com \
    --cc=fw@strlen.de \
    --cc=jon.maloy@ericsson.com \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=roman.kapl@sysgo.com \
    --cc=syzbot+749d9d87c294c00ca856@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tipc-discussion@lists.sourceforge.net \
    --cc=ying.xue@windriver.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).