Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1494245ybf; Thu, 27 Feb 2020 12:04:56 -0800 (PST) X-Google-Smtp-Source: APXvYqzHkYqQdzKpQCooYH5YQhJBSxn24el2OtlRuhGCgtI/l8JO4FP3qvvIa1PmXMfFi3ODBYGf X-Received: by 2002:a9d:d06:: with SMTP id 6mr506948oti.176.1582833896785; Thu, 27 Feb 2020 12:04:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582833896; cv=none; d=google.com; s=arc-20160816; b=jZDF4hUZZ/jqjWVLv5FUcHDgo1Z5grVC9MU86Tu8kig+Zwp2C8wccKI4a42plS/d1K +F5HLpEvDOEbvKV4cnFDuy10GB3b/AkO9UnOAB0taLNV6/GCsn9uBrsG7i4VBfEqJaJn GWie9MOKCKmrWdqYv2M3FW1odqP3pzVwAdfVLAJ5MkVsggCKX3G3hwmsxI3O5qE9xNbQ Zx3OsF1j/RIH0y9zNPjOmUvYIyQSiFVHUOpr8/dMzFiTFFl9RuJ2tmAfm0TUxAdLwGWL eBktoLIoAdA19W26u1wO6h28sxVYxpI8sghD6SJ+93++stc212kXhwUv9GQAMnlohGAk I6Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=keHeT8eMAKeaE7lFBhzJtTXYfVt5llvoCNtweLiBp5k=; b=zTwukNEQAr7i8ANVzkWfQZJ98pbREOsBACdvpH9meaDrnsyWOOtcd5TkEYotEmORPF FJ/n3fgLqRe7ivUXEZ+1NZWtyfYnQJZONFYEDZpOGG26gYTl3eBZJ2vp1eCQT7HYoP8P 3uHMzN0kt3t3lOull3BzDvN0D+D4QN6I+MO/FGJ+JX59s7JUUaxdZ6HfsjwL68+QOzed O2BKBdybObfpb+ed3YYmi1jgHm77IzjqWOR4lWV4WCNUkBtmalWD57cz/2G/m2NfaZ7H oZVCjkVKSHr6mrZF29KWaMg4qU3083cljb3ujF9UwduDfDwIPStpzYDSqPZ3g1I9zZMp pkiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v25si178884otq.93.2020.02.27.12.04.35; Thu, 27 Feb 2020 12:04:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730752AbgB0UEZ (ORCPT + 99 others); Thu, 27 Feb 2020 15:04:25 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:44680 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727159AbgB0UEZ (ORCPT ); Thu, 27 Feb 2020 15:04:25 -0500 Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 370B2121793F1; Thu, 27 Feb 2020 12:04:24 -0800 (PST) Date: Thu, 27 Feb 2020 12:04:23 -0800 (PST) Message-Id: <20200227.120423.2054408641031093845.davem@davemloft.net> To: sgarzare@redhat.com Cc: decui@microsoft.com, hdanton@sina.com, virtualization@lists.linux-foundation.org, kys@microsoft.com, kvm@vger.kernel.org, sthemmin@microsoft.com, syzbot+731710996d79d0d58fbc@syzkaller.appspotmail.com, netdev@vger.kernel.org, sashal@kernel.org, sunilmut@microsoft.com, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, kuba@kernel.org, haiyangz@microsoft.com, stefanha@redhat.com, jhansen@vmware.com Subject: Re: [PATCH net] vsock: fix potential deadlock in transport->release() From: David Miller In-Reply-To: <20200226105818.36055-1-sgarzare@redhat.com> References: <20200226105818.36055-1-sgarzare@redhat.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 27 Feb 2020 12:04:24 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefano Garzarella Date: Wed, 26 Feb 2020 11:58:18 +0100 > Some transports (hyperv, virtio) acquire the sock lock during the > .release() callback. > > In the vsock_stream_connect() we call vsock_assign_transport(); if > the socket was previously assigned to another transport, the > vsk->transport->release() is called, but the sock lock is already > held in the vsock_stream_connect(), causing a deadlock reported by > syzbot: ... > To avoid this issue, this patch remove the lock acquiring in the > .release() callback of hyperv and virtio transports, and it holds > the lock when we call vsk->transport->release() in the vsock core. > > Reported-by: syzbot+731710996d79d0d58fbc@syzkaller.appspotmail.com > Fixes: 408624af4c89 ("vsock: use local transport when it is loaded") > Signed-off-by: Stefano Garzarella Applied, thank you.