Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1838077imm; Mon, 3 Sep 2018 10:44:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZayAQCbkbrnM4D2ZkegJLfpK3lHjFr+TmBMbdF1BR4B11lEmlx1vd8RaA1NZcyR/izRu1b X-Received: by 2002:a65:5245:: with SMTP id q5-v6mr26764375pgp.67.1535996670899; Mon, 03 Sep 2018 10:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535996670; cv=none; d=google.com; s=arc-20160816; b=nAP6ENL+LEQHPmGClVhHNBY4z6l5xwqrBjeJO7MfS1E3gkclYMCSt/ZbjcjYjnqQq0 2O/MFbiC31wicFIgxw0BYaKI14Lfq4EQGpSehxMFJuDKz5+PShJoKhTJ7XLHDY1YDq2C t+z96DPfDSWxKDZa+dF+SjYDKXeBdbkXXEDadnQAkyxLTImdhibvR6DvxtbF7yMm04yJ chDCuT+6Q90wzEQuOH0KR0BgvfKj9pVI0TT9VcTB/p68km4FshZsengW666sNsbXsp2Q OtY2joX9ByBnUzhqwBAO39++288aIVqWarvFSLerGUFScm/U1vY1CKQhg3oeVmpeNgYA aQig== 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=dVRrZeR0Icp4CEWcBq1/Tkd+rq8L0J9xxSSuB7EdPUU=; b=YU7eT1BWY6GVVVK7FTo8JRhv6NlxwNV8cDmisGIgL2HAuGH0quKjz0s8wG7aA0hrZP TZrss1F2C9zPgwjP0Nz9QJpTedh19HPIuPrcMkN/94GGzbJzFeGsmSGTAPzepKfUF9wo 9XSKwqXdgyJHWO0WqOS+h8WvjLDfPoIePVFkhObr9y7GfHdWKmLhumRq7fND+V05KxZZ zLzYxlY2iNWYJjDrre4qOhgSNHHf5H8JBtaZnRgngJzSLQPo+fwJMYx0Utc+BwPXCKOj d61Z4yVLSMJZdnwF91enOsIbPhXvHi2gOzQ+TQt7YBkMeqcEYxsmwIwqKzihPC1C1UFj LMmw== 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 j9-v6si18138552pgm.428.2018.09.03.10.44.15; Mon, 03 Sep 2018 10:44:30 -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 S1731480AbeICV43 (ORCPT + 99 others); Mon, 3 Sep 2018 17:56:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47982 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730662AbeICV42 (ORCPT ); Mon, 3 Sep 2018 17:56:28 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1D6E8D1B; Mon, 3 Sep 2018 17:35:17 +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 060/123] fuse: fix double request_end() Date: Mon, 3 Sep 2018 18:56:44 +0200 Message-Id: <20180903165721.975040144@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 87114373ea507895a62afb10d2910bd9adac35a8 upstream. Refcounting of request is broken when fuse_abort_conn() is called and request is on the fpq->io list: - ref is taken too late - then it is not dropped Fixes: 0d8e84b0432b ("fuse: simplify request abort") Cc: # v4.2 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -371,7 +371,7 @@ static void request_end(struct fuse_conn struct fuse_iqueue *fiq = &fc->iq; if (test_and_set_bit(FR_FINISHED, &req->flags)) - return; + goto out_put_req; spin_lock(&fiq->waitq.lock); list_del_init(&req->intr_entry); @@ -400,6 +400,7 @@ static void request_end(struct fuse_conn wake_up(&req->waitq); if (req->end) req->end(fc, req); +out_put_req: fuse_put_request(fc, req); } @@ -2108,6 +2109,7 @@ void fuse_abort_conn(struct fuse_conn *f set_bit(FR_ABORTED, &req->flags); if (!test_bit(FR_LOCKED, &req->flags)) { set_bit(FR_PRIVATE, &req->flags); + __fuse_get_request(req); list_move(&req->list, &to_end1); } spin_unlock(&req->waitq.lock); @@ -2134,7 +2136,6 @@ void fuse_abort_conn(struct fuse_conn *f while (!list_empty(&to_end1)) { req = list_first_entry(&to_end1, struct fuse_req, list); - __fuse_get_request(req); list_del_init(&req->list); request_end(fc, req); }