Received: by 10.213.65.68 with SMTP id h4csp1381309imn; Wed, 14 Mar 2018 19:46:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELv3TLCuxzPGu4ztUi2PcVxVez/3rSr3PAXvUFXX96qqd52nyPBc80acbAdCZmzVJcOrLTel X-Received: by 10.98.74.67 with SMTP id x64mr6292328pfa.135.1521082000997; Wed, 14 Mar 2018 19:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521082000; cv=none; d=google.com; s=arc-20160816; b=UmDWzQ7YHT4FumvqAkX3mL6rutXA/0Y2m/OD0lhPDKm3H/dkhdl/CYf/iTkyfTNkSe 9pKUKbqDGXw5UEMoae5RzYb+T9FH5Rrsh6OmTPOkF4R3Sdx99Bkj3ECb9CUHJzmMocrN 1PzdP23oZOEwiMw3XGIzifriKEkRDRbac7d8qc3qGIMDvuMo+44TedhIjFQw+qB3z0j3 W5sSuGP5an7xg0DIqjNWC1aK4e2FERVdsPSGDqmhWqy6LEzqSyZ5Sdfa2A2giY1pGgAq 25KyoQGIgbT+AQRwG36yjuCSwjfY57DkSpIcvpfXEV+cjmrLKc1UXHhOiRNliNveOLoY zslQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ngQ6Dll+Gj5p+nxo3bq3yACcP4TJEyiWgPemfKFy3lY=; b=huJxCiBduACSsugfC6g5sATc6pfo6xmhuWFK3MgSDgAMmynjDS3OOYuBzSJVBhAy1Z GZBBA+fR8QBtZa0v8ysA03eq7OWv9WnoBbg772ntH7U98CT0sAej2RDa8776h79CWyrq 5ub8fQCWSdJMvr9YMRQH2181xBuzi+R7wbwQnuQ66uAoxMtwONb4/HQn3F/aIBhx99a0 QFit8mCK9P3UloLfZqG70tmRlPNty1psvQQeanKUYm2bhrUDiYPYGChA1wODaAHfPixa DAnn5i4zb/ZjiBJZtiCE9DkcljZkiBAjTDUhyuox/uxX6k1NQt9AF+xNW501NzqcgG0X jE7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Jxxykz99; 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 u1-v6si3015901pls.488.2018.03.14.19.46.26; Wed, 14 Mar 2018 19:46:40 -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=Jxxykz99; 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 S1752038AbeCOCpf (ORCPT + 99 others); Wed, 14 Mar 2018 22:45:35 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55961 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751488AbeCOCpe (ORCPT ); Wed, 14 Mar 2018 22:45:34 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 5EA0F20CD2; Wed, 14 Mar 2018 22:45:34 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Wed, 14 Mar 2018 22:45:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=ngQ6Dll+Gj5p+nxo3bq3yACcP4TJEyiWgPemfKFy3lY=; b=Jxxykz99 ioscCPJGacdyMi7XPfwV2BQUQFjYMwEhcWknY37WXDAsiiNWJ16Ago63Q8fktVko /++d/hVaRaUDRsRavtJvk7C6VxHMDZE1bTiIZYu1A6OWfgrp/AhHhBpg3++9nhwJ BqITkhEeRDv2HkLodauT86deVXHdBh8pZ8sFPYe9puw614P2TTgc1Oy8ajKKl3lo jqmd9t0XawmhH0LJNXjmjEwhSCJLPLvHdFF85X2Oum1xtLW1FPV+nI7pPDOPp2xm J+GichvQ6YVdCJOazluknduE/8zX52Tg4RpUMdeoAu3+abgaRSeLkGElOy1P/4RU q5QP+7NPPMX/MA== X-ME-Sender: Received: from localhost (unknown [185.220.101.0]) by mail.messagingengine.com (Postfix) with ESMTPA id BCC812413F; Wed, 14 Mar 2018 22:45:31 -0400 (EDT) From: Simon Gaiser To: xen-devel@lists.xenproject.org Cc: Simon Gaiser , Boris Ostrovsky , Juergen Gross , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] xen: xenbus: Catch closing of non existent transactions Date: Thu, 15 Mar 2018 03:43:21 +0100 Message-Id: <20180315024322.27429-2-simon@invisiblethingslab.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180315024322.27429-1-simon@invisiblethingslab.com> References: <20180315024322.27429-1-simon@invisiblethingslab.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Users of the xenbus functions should never close a non existent transaction (for example by trying to closing the same transaction twice) but better catch it in xs_request_exit() than to corrupt the reference counter. Signed-off-by: Simon Gaiser --- drivers/xen/xenbus/xenbus_xs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index 3f3b29398ab8..49a3874ae6bb 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c @@ -140,7 +140,9 @@ void xs_request_exit(struct xb_req_data *req) spin_lock(&xs_state_lock); xs_state_users--; if ((req->type == XS_TRANSACTION_START && req->msg.type == XS_ERROR) || - req->type == XS_TRANSACTION_END) + (req->type == XS_TRANSACTION_END && + !WARN_ON_ONCE(req->msg.type == XS_ERROR && + !strcmp(req->body, "ENOENT")))) xs_state_users--; spin_unlock(&xs_state_lock); -- 2.16.2