Received: by 10.192.165.156 with SMTP id m28csp254981imm; Tue, 17 Apr 2018 09:35:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4979wV0J8wHmb+xpF+YtRFd0l5TSUTlxt9YzW9qw8P0PBUkexxjvdf1h9zeofDcmqk2Q6Fz X-Received: by 2002:a17:902:f83:: with SMTP id 3-v6mr2671141plz.336.1523982931651; Tue, 17 Apr 2018 09:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523982931; cv=none; d=google.com; s=arc-20160816; b=CJaeV028abmDYf4C/MeYJhadEX6ecLp8Ja7tAmieqG39i9Vpq68XARGRjiS5rotsGB WzSt7D+q+zJyQxE6yUhprDSpD61wE1fyGgu0WIJh11HjPNB/zFkghWjlKYX/6bFG7kJL MY0YSx6rvNhQSQ2F7EjV7jjFren9oUBKnvfH5TEU25IQLneF3NUU5o1ksfR/1/zWyXNF stkfNFNwEwZuh51kZ+M3uoysO3gM1MeF4IKAe6gxpEzSlr3izGKgn5ayrqJtIu+SNADf TL90GwePgBwNUn242NhpUflizUw2hU9VFkqsI1efF26KTAOwzAgaS3J/mZ2XDAJ9BcEU tT9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=aH2OHPCa+ZSnYZbyuF4zE2oGXEFec8IvBbo8hNMvqUs=; b=wjtsqccxmrVbFxq1DPppWB6PoKmrQ0l6A4gLsI/O2eS7Q4JCI0Cq4V00uqcWogXSuD oP8D+sOgClC8iPqizI3p+YMVH3q8MVB/c1UVUDp/jW0KPfIFMdkT7M95hkVwgqOZ0yGx QFGfaM+nKFDFprLMgrDsj8RCCpiy9+ySxEtwNFHTc+sdIQUQQSLcnKyF0+PoDiawRLOq hH0pookX+u78isqqllPaqflZk+SQPbJyhNw+XZagGVh2ildxDcCL8TH7Gwnfwv8vk0oN AMqqxRljK8k571DJzrQVADQHx/e20qYxZKt7mEgo9kP4G0qBIKCwKFvXSo28j3Oi740X EUlQ== 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 w31-v6si14828959pla.193.2018.04.17.09.35.18; Tue, 17 Apr 2018 09:35:31 -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; 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 S1755237AbeDQQHj (ORCPT + 99 others); Tue, 17 Apr 2018 12:07:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35174 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755225AbeDQQHc (ORCPT ); Tue, 17 Apr 2018 12:07:32 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2A481E58; Tue, 17 Apr 2018 16:07:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Gaiser , Juergen Gross , Boris Ostrovsky Subject: [PATCH 4.14 47/49] xen: xenbus_dev_frontend: Fix XS_TRANSACTION_END handling Date: Tue, 17 Apr 2018 17:59:26 +0200 Message-Id: <20180417155717.278117685@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155715.032245882@linuxfoundation.org> References: <20180417155715.032245882@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Simon Gaiser commit 2a22ee6c3ab1d761bc9c04f1e4117edd55b82f09 upstream. Commit fd8aa9095a95 ("xen: optimize xenbus driver for multiple concurrent xenstore accesses") made a subtle change to the semantic of xenbus_dev_request_and_reply() and xenbus_transaction_end(). Before on an error response to XS_TRANSACTION_END xenbus_dev_request_and_reply() would not decrement the active transaction counter. But xenbus_transaction_end() has always counted the transaction as finished regardless of the response. The new behavior is that xenbus_dev_request_and_reply() and xenbus_transaction_end() will always count the transaction as finished regardless the response code (handled in xs_request_exit()). But xenbus_dev_frontend tries to end a transaction on closing of the device if the XS_TRANSACTION_END failed before. Trying to close the transaction twice corrupts the reference count. So fix this by also considering a transaction closed if we have sent XS_TRANSACTION_END once regardless of the return code. Cc: # 4.11 Fixes: fd8aa9095a95 ("xen: optimize xenbus driver for multiple concurrent xenstore accesses") Signed-off-by: Simon Gaiser Reviewed-by: Juergen Gross Signed-off-by: Boris Ostrovsky Signed-off-by: Greg Kroah-Hartman --- drivers/xen/xenbus/xenbus_dev_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c @@ -365,7 +365,7 @@ void xenbus_dev_queue_reply(struct xb_re if (WARN_ON(rc)) goto out; } - } else if (req->msg.type == XS_TRANSACTION_END) { + } else if (req->type == XS_TRANSACTION_END) { trans = xenbus_get_transaction(u, req->msg.tx_id); if (WARN_ON(!trans)) goto out;