Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1811244imm; Mon, 3 Sep 2018 10:03:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYNSmuG9CT1K13ER9tHQonKBtJrrSUKnAOBP4gyMgtgRNWO9/C30KW2kO6vfzlYgXWCOh6t X-Received: by 2002:a62:a6cc:: with SMTP id r73-v6mr30347632pfl.60.1535994191832; Mon, 03 Sep 2018 10:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535994191; cv=none; d=google.com; s=arc-20160816; b=NhXIx05VaIu4PdIJfDLBa6/HgTR14/DK7wvfF7ahNRFQ6xin+SbbeSanaJvgVKUoW8 E6IK14+cD3uAu16M9+SSTrGi/CZsi/VnuuGamWxBGvdMxUPuYFakCZKhuYLPKhKeiURh cnthwl+u1LQ4B0cRZY2sAAWDfSmy3GFx5vdBsaZ2xlyvGJIHNFnBnecF60LwNPZpH4uC u2vmKTn7fzMBq6duby7sQul/jpEfC7PWVXX9hOtxhgvNp/R4/b7z8zXT40xL93+48cck ifLe1jjW3z5rHPVf0+jr+QtK6vbzjnntXZCk+vlsLoXN5E2qnbPLBBTHTDsBGp1HydSs epSQ== 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=wbHaGCZvfR5XUgIxDeCrZRsgZvjajS+S9oFFkjwO/o0=; b=PmdVtXW1kuIUcTpHPnJ2/BFYZZY3SmimtkSV9/wS37zqHBuqqKOX+Rez92ukW7JgOV 8J4dOt/avbXW9AgXN5NlkalcOJ/0xAcMPUojeYZCyljfCOXk5kM1y+YRoa+dMgBop0EV qToa8nX6YOFbBeqyP1+NKz7dOPplegWXXCHkUezXlyu1jeXzc5So+YWQTYXyDwmcfXkC Ylil4BNQ+Z6kYp/yVYIxI+gpjoditBnz+NlFgfmaqlsa5Au7gEEt10tT69N32O/XoMGE hX8HBaT/156Ia9LfJpUz7/TLxpqsGQq7c60BLat/WYZM6zLFGE1i8Pb0ZaDYTZF7AXGi B/EQ== 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 s29-v6si17738772pgn.47.2018.09.03.10.02.56; Mon, 03 Sep 2018 10:03:11 -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 S1728569AbeICVWy (ORCPT + 99 others); Mon, 3 Sep 2018 17:22:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38772 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727836AbeICVWx (ORCPT ); Mon, 3 Sep 2018 17:22:53 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1C743CFE; Mon, 3 Sep 2018 17:01:53 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miklos Szeredi Subject: [PATCH 4.4 59/80] fuse: fix unlocked access to processing queue Date: Mon, 3 Sep 2018 18:49:37 +0200 Message-Id: <20180903164936.507895778@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903164934.171677301@linuxfoundation.org> References: <20180903164934.171677301@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Miklos Szeredi commit 45ff350bbd9d0f0977ff270a0d427c71520c0c37 upstream. fuse_dev_release() assumes that it's the only one referencing the fpq->processing list, but that's not true, since fuse_abort_conn() can be doing the same without any serialization between the two. Fixes: c3696046beb3 ("fuse: separate pqueue for clones") Cc: # v4.2 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/dev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2199,9 +2199,15 @@ int fuse_dev_release(struct inode *inode if (fud) { struct fuse_conn *fc = fud->fc; struct fuse_pqueue *fpq = &fud->pq; + LIST_HEAD(to_end); + spin_lock(&fpq->lock); WARN_ON(!list_empty(&fpq->io)); - end_requests(fc, &fpq->processing); + list_splice_init(&fpq->processing, &to_end); + spin_unlock(&fpq->lock); + + end_requests(fc, &to_end); + /* Are we the last open device? */ if (atomic_dec_and_test(&fc->dev_count)) { WARN_ON(fc->iq.fasync != NULL);