Received: by 10.223.176.5 with SMTP id f5csp1189333wra; Wed, 7 Feb 2018 14:25:11 -0800 (PST) X-Google-Smtp-Source: AH8x224Ad+Dpp2XIUTZ7OnTNUM0X4g0NTtyurmdf5APAT0xoRvcGrFYQAyGfphVjo1ezfaoFfAwl X-Received: by 2002:a17:902:7402:: with SMTP id g2-v6mr7375276pll.170.1518042310941; Wed, 07 Feb 2018 14:25:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518042310; cv=none; d=google.com; s=arc-20160816; b=rAAYdaO7gRhsvdIBiQJJBn+v5A18E3z6BkBE5/gQ10Vw4KpmhPTmDEEjrw5Tm69u4M f2HTxFgZbcYQYn7jv/HMNoT61uksPbNDHcb6h3i6vukv3ZO/sk7oX4CIBgbcBj0Y8ZOq UXtbnbo03BUgK8kuWP4ozAzaJpm731ipmFnaV8vg3BL8kbT8ca+DpioNp5nQ2SVr/aat NdG2JFkmuZaE3JU5IFh6cIR4l3hxO+H/NcIJfADIdq8DA4Rf7/JQ1qh9bVFmf6nGJ/C0 R/ryYn/KnnON5T/1mPlPIL/oJ4Zb1DPX3xUOcOGWyyE1WOLyz5nV9IKEycxcTWdsnb5J xKJg== 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=Bz+0FRUsv2sQqgcFsIh+LfQ1qBjEKAkofIX5eY5FqZg=; b=TADAuuPnFHFTgLOxNoaghW5Qyf4nft6ycpv4qapD36iPkx1YOchlp3qQ7j82ZqY1PR MoxN3Q7odYsNgv9dxNlU2ucJznHO/YoJ2fI4cNt74uhzVOdZsO1X4qAVRLoCl17t/s+M Y/5MubOQQ5Y27S3q/Vakai21ICN9pYv3Ro9zDUTu57N8xc2oUxetUj/Q7YoFU4rzPsFO vQkVMj9tUH3sC7W47A+BkJtzb5eKpf81klSgBjUHazoQNTFteBMOGbACzkxB3rRdcdsE n81xbIVWyMCZ4yDPJukQVNfaCuugSZveKHXMmnG4gCFrTcUZNbWycL062VnaJGIN9Pmk JqHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=VqkpCcAL; 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 x15si1508149pgq.25.2018.02.07.14.24.56; Wed, 07 Feb 2018 14:25:10 -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; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=VqkpCcAL; 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 S1751175AbeBGWXv (ORCPT + 99 others); Wed, 7 Feb 2018 17:23:51 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:51325 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750729AbeBGWXu (ORCPT ); Wed, 7 Feb 2018 17:23:50 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 4EF6F20C4D; Wed, 7 Feb 2018 17:23:49 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Wed, 07 Feb 2018 17:23:49 -0500 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=fm1; bh=Bz+0FRUsv2sQqgcFs Ih+LfQ1qBjEKAkofIX5eY5FqZg=; b=VqkpCcALc4EeXv8R+O6y+7inkRX0mnTn8 tO4FPTO2ZqSvJIoFZZus+n0YnIRH3JomP1pis62UrkQAgnYL+xz9ElDwLCZ7Urmh TSgxujSMn1ubmE2WEmfkFFxXw/tR78gIHJTItZ7GIRV2ynU2nj17eXK7XqMIb4Fw NC1KZsEPopD71CtuzDYU8uoiyXuv6uiN+q2rjNeTimEtaJpRGIQGb1zDcFcFMjWR 4anbOQZI60Eq8+LpoMq2JUT/yiKw2ISFgzPSPCbz/NFWpEyXqgm3bss6ZEJv+e8b oGgwMwqiXEGTLVq3RRMX6cmZ8xNtzjDc6dYHTTTNxnzhk7x6TeK4A== X-ME-Sender: Received: from localhost (unknown [109.236.90.209]) by mail.messagingengine.com (Postfix) with ESMTPA id B4F527E2E5; Wed, 7 Feb 2018 17:23:47 -0500 (EST) 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 1/2] xen: xenbus_dev_frontend: Fix XS_TRANSACTION_END handling Date: Wed, 7 Feb 2018 23:22:35 +0100 Message-Id: <20180207222236.7434-1-simon@invisiblethingslab.com> X-Mailer: git-send-email 2.15.1 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 f3b089b7c0b6..d2edbc79384a 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.15.1