Received: by 10.213.65.68 with SMTP id h4csp1381008imn; Wed, 14 Mar 2018 19:45:44 -0700 (PDT) X-Google-Smtp-Source: AG47ELt30o2aDBrDm+PPCcl9uI0/mgfIH8aJSINYd4v8W5O/13aPtKlrupq8oYshX7KA0tL1rrge X-Received: by 10.99.107.6 with SMTP id g6mr5590180pgc.109.1521081944064; Wed, 14 Mar 2018 19:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521081944; cv=none; d=google.com; s=arc-20160816; b=TJPCsKYlWP0GAv+fwkGRMd4a3ze4V0PDbXj1d+JJyI9gdpzoUKw+N2KnWKm6zwu5sN urow9TC1OdNbq8ZQAllqpBmH9R7yRL8yChRxNJ3lehDHibQaukNwm06tK6MJmQX7XR1/ 4OCd4y4hDsXLlDjtptaP2ln1W+BT8O+rHIvBB8WznQQE5dAJs13+9mMx+l5uJ9EcJXvF W+ea2dbGCe8qOBSXpwvqXvKbSuEZQTJzgdP4whu5nrpDm7Q0kjXNrp8e71MsLyoP2OdL +iXpbTzOcye+2HTOa5ZEkE6e+Ai1x+ccixcC04ahwSAyC0SEoHQmA4kLhVBFa73eoRhF 4yaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=TOBtHWqOxmDaQ1WFSsIlAqKqIgig84fcy+K9+3lghJk=; b=OMYOVsjoy+mZmUTif/znFyBJExk33GGPXP2fICq5xBQoaACwG0sgqd4letiu1g6Eb9 YFnYUoMKAwzYywUItrMMbFJh2L5X3xcrqfkAt4pAp/SHhU18G555TgMLPcLHwXTVOVKs 5CG67X8zt2SHzfLT//zrO7WHWEWKNh7KbDjWMaca71GJVh3B36SSiBK+JCikFCLhG9sY B5a6NonxBwbQ7+DNAs2zImiDkk7a9UC8WlThQiPIe/BxgsI7Mj5KYS2PVipUBg0rEj6y UBO+Fk6GeqETGF9sCTUNGQ4eYwrnXuy602xVsHQ+nYzI52SZz6uvTvOAb3OWlVF6H4+y hudw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=CCJXyb0L; 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 l6-v6si2577848pls.438.2018.03.14.19.45.26; Wed, 14 Mar 2018 19:45:44 -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=@messagingengine.com header.s=fm2 header.b=CCJXyb0L; 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 S1751840AbeCOCoc (ORCPT + 99 others); Wed, 14 Mar 2018 22:44:32 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:36809 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751517AbeCOCob (ORCPT ); Wed, 14 Mar 2018 22:44:31 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 0165820DC5; Wed, 14 Mar 2018 22:44:31 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Wed, 14 Mar 2018 22:44:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=TOBtHWqOxmDaQ1WFS sIlAqKqIgig84fcy+K9+3lghJk=; b=CCJXyb0LBcNj6Sc1205etg1/YUGCt60pX isvvutoCg1bnPw8bbzwTcmf3PD5zv1SOzouFXWt2v2ViXlAW3rO8KEMNuezO+LGm isQ+sY+3EQdir3G+Rc8IV8XB6+e0QTXlTp/pFMqkZjXog8hTI23jrVXJNLXQG/qN IuWWBVPzVwb5b6ipsSvaowVrTGkAq+89bPdip60NW9R/43ORzDgJ/R5oZ4F8NDML J/PpzRxB9hgFhUKxY2Rt9HqY/7+Y8MRjUJtlQM2wcS5x8ND+fPF/AILV8JObeAW4 dXPTXV4Zl4RLR/y50QUDW8vlNPf+tqzK3AB/FR6aU4UVLBjQpg1Og== X-ME-Sender: Received: from localhost (unknown [185.220.101.0]) by mail.messagingengine.com (Postfix) with ESMTPA id EC2CC24066; Wed, 14 Mar 2018 22:44:27 -0400 (EDT) From: Simon Gaiser To: xen-devel@lists.xenproject.org Cc: Simon Gaiser , stable@vger.kernel.org, Boris Ostrovsky , Juergen Gross , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] xen: xenbus_dev_frontend: Fix XS_TRANSACTION_END handling Date: Thu, 15 Mar 2018 03:43:20 +0100 Message-Id: <20180315024322.27429-1-simon@invisiblethingslab.com> X-Mailer: git-send-email 2.16.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/xen/xenbus/xenbus_dev_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index a493e99bed21..81a84b3c1c50 100644 --- 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_req_data *req) 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; -- 2.16.2