Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1826867imm; Mon, 3 Sep 2018 10:26:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaBYDz+PrOVVZW0uSayIX/GPEr83S7HVnfnehe9STV9vAxv4FcwsEwWG+HenTuV/fjJHPZ6 X-Received: by 2002:a63:ac54:: with SMTP id z20-v6mr26384154pgn.74.1535995610751; Mon, 03 Sep 2018 10:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995610; cv=none; d=google.com; s=arc-20160816; b=oZF2slrAs8iLwMnWBig2bBvX9g/Zj2r139Splqh5DO/8sZWt3spFZJotkMhXNdpAL4 pia8FpIXyFlZeen8SCDhyDKCDXuL4pqTzLbniJHk1dxfLFDRXn3j1Fg+HOP1ySYY5NE/ zDoXyUFYqaIBRGDV+IGwSNQHIVBqQIHdn/AwJ+RZJyzbVM4b9lcwNAj/HYJDJdyH9Ks9 VGenYrfIqSayCS3Htr31s0s5t7mKOtv4df6/6L6wPgtYaxXpZYve/yd2c2eVgCkZEdiP P/OHoV9S/vwXMUzZnVoCb7dbWVMTNDsOwCDlP1QUwnwyzl/tMEi/sfTLS2thHsYFSW/d 1j8g== 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=0JWbhM1CqsW34Dma50CUFed3YTg6yP50N3uJQI0Ki9Q=; b=qj90w+vAgWqKg4sR5ww+hPPkYAG4/7JE9hwnrYiagFWfIfPWF1NW5U1EeAelC7HwAX DSm4wn9LQL7UpnvsI3hq0mn3KOEvzgEFd8IM+yS/LMpOA/PcBZi3vYon8/CJEPXIvkBN x1NFv1ShfKVZyQiS4vAmpqeKjKG0nxQgodfNllMAVMf7je/e/AgvBO84pORX3JVNCXwB OvWkY75nNKc0IvYuvwAadpML3SYezgHrsxeGryR3KuzKm+nQEFgF8MoQt85cPqEKkPMU RfzJJYPpsptfPZ7uyHa7/3C1qvl5n4j+n9Y6mckhQrgnFFWEBhKZJz1dusNzfvAJ5cck fhbA== 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 l64-v6si4483270pgl.145.2018.09.03.10.26.35; Mon, 03 Sep 2018 10:26:50 -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 S1730665AbeICVqi (ORCPT + 99 others); Mon, 3 Sep 2018 17:46:38 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45754 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728380AbeICVqi (ORCPT ); Mon, 3 Sep 2018 17:46:38 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 957C1D24; Mon, 3 Sep 2018 17:25:30 +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 120/165] fuse: fix double request_end() Date: Mon, 3 Sep 2018 18:56:46 +0200 Message-Id: <20180903165701.555598735@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 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 @@ -364,7 +364,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); @@ -393,6 +393,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); } @@ -2103,6 +2104,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); @@ -2129,7 +2131,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); }