Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1827137imm; Mon, 3 Sep 2018 10:27:15 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ/NwoR88wji2i0e6WBTEFuSgwLst2bRE3b5OnucpZ75FvtwplqZgW8JN4UIQ5apeNr5QcG X-Received: by 2002:a62:4fd9:: with SMTP id f86-v6mr12207505pfj.110.1535995634941; Mon, 03 Sep 2018 10:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995634; cv=none; d=google.com; s=arc-20160816; b=fd1bTq4Z/VpctpKpjcyWuImdbWHERxGRaHbADm47lX4SFdTPRbH5e/GhW1rcM6ehUV uFb/GhcfT09VH5xnyURtulPtIDqfc2lmb2hG8OcRJAXyFOZuTjhibf7iYj41/rRCPZCm m3rFg0wRlI9zBy2Xi9ELumFNMCn+FxPgLDTg6tQqv4enAU3i/ZdFbZlUIywKaUn4ge6i IqxkYW86juG2w6Z5joCux2vIQw0TeJbLrZj0hzH5OK97yRDFVbqEmR5/toYTGvDSkTVk h3u9HRzMLFrTlBX0Jlyp0YBStqU5wmvsZI8MmytEdnzuqf1KoTXM9uU7a9+krZc6N7EJ almg== 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=sVP+0XaqxDZbMWLsiX+edreeisGjagQtyl2o0Nq6B6Q=; b=Pu1Dr1bqn3vk0lwqVRCFnML3lKaU0FR7dly97d62b39w/ijLe9tl0Y/vIrEHGH1pa/ pKdXYxUKFwO/q3OXox1ncqaUrWjYIrNwzbRimhcnMwERzzhKyMANpaQ2mI6aIfUguRLG 6qFPkzM5hbRkM+ZJjF9kdgRVb7amQydrJmqe1QmzWpKowHL8UNLvMH3s1LqkU7yMen/S 5ZkEjTcJFgVhB1AGgl4WAiyjsILCjK3IhfMT+D77WPzeSV0MLZFf7gQNobwkuh/PwN8l WvExarK48iFgzuKWweDsmrdyn0+DsNU4yAm8IPsI4r/qXhZnG/SsjSIg3w3OibtjTLjn d6VQ== 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 b10-v6si19027533pgi.416.2018.09.03.10.26.59; Mon, 03 Sep 2018 10:27:14 -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 S1730679AbeICVqm (ORCPT + 99 others); Mon, 3 Sep 2018 17:46:42 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45764 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728380AbeICVql (ORCPT ); Mon, 3 Sep 2018 17:46:41 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A66C7D36; Mon, 3 Sep 2018 17:25:33 +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.14 121/165] fuse: fix unlocked access to processing queue Date: Mon, 3 Sep 2018 18:56:47 +0200 Message-Id: <20180903165701.614959153@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@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: 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 @@ -2148,9 +2148,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);