Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1072918ybl; Wed, 14 Aug 2019 10:15:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFbCqtmlkwNCOjY19SLO1bgRx2PI0C7F3QG4LK9NlxYvhdzeFlgW/2wCDecrdP1T6FQhbc X-Received: by 2002:a17:902:f216:: with SMTP id gn22mr457814plb.59.1565802924784; Wed, 14 Aug 2019 10:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802924; cv=none; d=google.com; s=arc-20160816; b=FwbAN4MOC0yxfrC5tt9BAisOZzuGSedpvGRYCP0Vy5+Ny7t502VdTfbwWEuFjfimDC E0kOr/n4Iz4v6OtcmrEVYnYMwZj0GzA24eZ/yp7w6TswyKXfTZmKJ40XppJhz9C25NZn C0Cf+0XVna0J8ukB/WkCqf1UCN5GT4AYRxWYitQYe5PYs1vMXHpwvMS0mDfhUxWTM30m wzbtLdU0mJQjSHsk+kkQD8KczdoG2XWzOOO7w6Bgu8AyAsIdv3XP0/iBtKFCaKnaHeOS 9UgNRRp4YvtOYWn8bcweIHpFQM/f+wiGgPDoL1bOkDcGXznjpq6OpKMYQE5iorAh46kl Z9lw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yEVZl5rmNGXb7YymroT0ZqoDGEO0Eo7ki9PRCYIzkzo=; b=z1jWHHPvVjG5QYha+rA7GjlTg20QL64Igy6dZqzo7xi5Q4xF1pgsjIIWCi+Nsr5/R5 jUBAvaO79QAlRGjtn8Zg0MNGpaUa/1Y9q+LSpDzksY+jwMqpl5Szr6YNUwpurZPECd84 LAt3KiO6ZoPJ6vXMe9yvTOvAK+YzbzYNYoCbZ3ed5wtH0vjwDnW/pPW7nYskNb49uH3h egksxu+mT7JEEhyDMeLjEAfR1cbRUpfnjOHuqRasg8wsSizI3cUDcR0jW94aRaFM1xvj G79/xDs71QCA2LPWyAQPBNF/Fnk8Au1cX9vRjwV20Nnz8CZaLrT10ZaT9zwIC9avRrjd NBkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bLQ4R8Az; 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 i18si84687pfq.58.2019.08.14.10.15.08; Wed, 14 Aug 2019 10:15:24 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=bLQ4R8Az; 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 S1731109AbfHNROi (ORCPT + 99 others); Wed, 14 Aug 2019 13:14:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:39074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729485AbfHNROe (ORCPT ); Wed, 14 Aug 2019 13:14:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7E1662133F; Wed, 14 Aug 2019 17:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802874; bh=JDqGp7ficmkhH3OHfXmiMvWvv77TF/w7o7o0AB9EMSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bLQ4R8AznmozEMUHu6rQIT1BxVnU7mI3GbD6M04H+EfBgNUsHF4W41oU/mMAopZwY /Uk3Re2mhFIGuENnoqj9gx2ZYW5b5CXZz/KfBQC0fhqJeHcOZqRIEfDu6tnQ9TLHrd hgpInMSfP4J4gQgcglcs0mnSfADELm31jHJ4GXww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Shilovsky , Steve French , Ronnie Sahlberg Subject: [PATCH 4.14 60/69] SMB3: Fix deadlock in validate negotiate hits reconnect Date: Wed, 14 Aug 2019 19:01:58 +0200 Message-Id: <20190814165749.957581495@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165744.822314328@linuxfoundation.org> References: <20190814165744.822314328@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Shilovsky commit e99c63e4d86d3a94818693147b469fa70de6f945 upstream. Currently we skip SMB2_TREE_CONNECT command when checking during reconnect because Tree Connect happens when establishing an SMB session. For SMB 3.0 protocol version the code also calls validate negotiate which results in SMB2_IOCL command being sent over the wire. This may deadlock on trying to acquire a mutex when checking for reconnect. Fix this by skipping SMB2_IOCL command when doing the reconnect check. Signed-off-by: Pavel Shilovsky Signed-off-by: Steve French Reviewed-by: Ronnie Sahlberg CC: Stable Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -166,7 +166,7 @@ smb2_reconnect(__le16 smb2_command, stru if (tcon == NULL) return 0; - if (smb2_command == SMB2_TREE_CONNECT) + if (smb2_command == SMB2_TREE_CONNECT || smb2_command == SMB2_IOCTL) return 0; if (tcon->tidStatus == CifsExiting) {