Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1833421imm; Mon, 3 Sep 2018 10:36:39 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZddNx9asygoIBZRaUBGSmEbx2annxW2jZ+OJrcBoq2AKIsSJnxtNmAYzVrv7CgmaQD4Ljp X-Received: by 2002:a17:902:a507:: with SMTP id s7-v6mr28845022plq.303.1535996199940; Mon, 03 Sep 2018 10:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535996199; cv=none; d=google.com; s=arc-20160816; b=fpaho8kBh5W2AM5Xdu4u82xa+7blX+wgI90VHUTTuEAgII00nK1jZMY0nNej+j+HFT RUBsGqEaoKV5jf7ZLEQPOiWZsmqUDWlgCVGhTEASqJR52noaDCf5MP/n0BmYvDV3CzBW 1EjlkVV+0LuN84Kr+fOWCnIqsZyCvioTtQtvOuqdPQVr3m4deVpgU7hGen4tdHUJG6CX SfZ8D4Q9ZozdSpOqgxAeMjqKg3CNg6Rl4QXyWofSels3YscNaRHot0cQj2kRUrDjUt7O W+7H5b5ugPK8J/xLpcbknjXN9kiGS6cPdYLxV56wA3dQ/fg//q/r7zCWLi6SvxQOXD7K Hl4Q== 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=bwX57GDV3zxeafc1l3scPQIjWfObp83yMhTljOOOLDo=; b=cEXaBVlJZonugC09eJV7Fj0O+16IMhbem00Jg3qguMXNy+extkbJz+oN8O1CFDDbTN q36YT5Aa3D1K2nwSg0NokbmY6QrJ8z8Qlj3NbZwB0ONoFyIQ9D3JgbwqcRE1KMbpFXwD jkRrddLYLbUZ8ypt8O7Z04vTYPkrlMJp7uG2l8Y0/bdpWMSuznIWGYgYTAbZpaRU4ns7 tkCosgDL+qpIgNu2Ok/aOFOWp1mD1+nvAd5YwLMbYxSHDJLq1hQqn1U4+Hp86iJeE327 q0ccUJ+b9XQPOr3LSVdlb8BW9F/sMbPlzr483M8vMy0u66sKyuqt4Ed7C9J19RxkHDOm 3V9w== 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 e1-v6si4209738pgl.75.2018.09.03.10.36.24; Mon, 03 Sep 2018 10:36:39 -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 S1731495AbeICV4b (ORCPT + 99 others); Mon, 3 Sep 2018 17:56:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47992 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727972AbeICV4b (ORCPT ); Mon, 3 Sep 2018 17:56:31 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4E9C8D1B; Mon, 3 Sep 2018 17:35:21 +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.18 061/123] fuse: fix unlocked access to processing queue Date: Mon, 3 Sep 2018 18:56:45 +0200 Message-Id: <20180903165722.018550967@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165719.499675257@linuxfoundation.org> References: <20180903165719.499675257@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.18-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 @@ -2153,9 +2153,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);