Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3208152pxb; Mon, 9 Nov 2020 05:37:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXRzEhutZAe7VWAn0yISzfFpZM4ra01HSroM51eppeJ6I0crVCC/ITrpeO0IFbiN1j96XZ X-Received: by 2002:a50:ed90:: with SMTP id h16mr14878323edr.255.1604929068410; Mon, 09 Nov 2020 05:37:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604929068; cv=none; d=google.com; s=arc-20160816; b=GgYolqVQcENpZJ5MzQbEm37X7YeRrSLIa3+tfGlTw157l6LdwR4FAuJLjH+l1YgW8J k5AsLDWRmX4G+rniFoxoWcHf4EHYpgtnFmXJXUGoBcQ6KkKBEfvDbwywYUzmFnGKG5JY g5E8z7JKTXvo1A6aGnXXogwnyioID3m8Wm/+kxWJwdUK13PM6qZutaJkAmv38kuYhBBA 8P6S7ECNHkE2AVgXgPaGWQikhW6Z9GlsGDOqCJ7QEJuy9vFw+DAKSivug4Rynz2GUrYH J3BjGyKNq8eHPI+FmlubEMIs7NUCE2y2ozzqz8Jkbm7snonAGkswpUuWrH3jpUoSSAff 38Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qM5JbBwlSYyftMpm1nwze0LJICODNUkbg24rv5jcfhk=; b=sGEel0OuiSkm138x8vekbPcgzeW16YYOp8VmpXY9p7Abao4H0WDVhOY+ByZxxybPqj 3nnhfl0Wzzk4Dz63xR8I5FceMQ9NHdrGEoVWWDqOccNf80YUztkGWBY3IFomxwepZDbZ smf6bkR/tyEH1hoLfhSXvt76igvIt5ZtJJXcktvjqnegIYi0eqf5PBmL6cYDrg5EnebW fJsiAqawa1aakzGcP8Hj3nDNxpt7mDWcw74uBK4lbeIX4QnZsTSTzd+0nEViivxyuQnS ZlSbZSteFtlbtdEvjYBVw4XoKz7lrbExLTNlY4BWzP4SMKp/6AZAxmYihXjYXPGJ9dZQ vCQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O3TcCIO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 92si7382373edg.183.2020.11.09.05.37.24; Mon, 09 Nov 2020 05:37:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O3TcCIO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731802AbgKINfq (ORCPT + 99 others); Mon, 9 Nov 2020 08:35:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:58066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730827AbgKINFU (ORCPT ); Mon, 9 Nov 2020 08:05:20 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A2E0206C0; Mon, 9 Nov 2020 13:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927108; bh=IIAOtgt89gqbo9vAelAbodztDRMXT2h/qI7NZYHRdWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O3TcCIO5nuo1jh2SERTDQ0bTek/+IL7H9qM7+fSAT3KxNRfr+ho6ILBOQhiknu6gF c6JAW6yNgH7yCsL/H06hNITpOFo3niqgiaPjpvhD7TOkKwfspyvYMrZbzyWtTepJNJ tFpvnS8T8uM8+8IRfEt8RHKd91aY0Np0K8KJkF9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Matthew Wilcox (Oracle)" , David Howells , Linus Torvalds Subject: [PATCH 4.9 082/117] cachefiles: Handle readpage error correctly Date: Mon, 9 Nov 2020 13:55:08 +0100 Message-Id: <20201109125029.580735387@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125025.630721781@linuxfoundation.org> References: <20201109125025.630721781@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox (Oracle) commit 9480b4e75b7108ee68ecf5bc6b4bd68e8031c521 upstream. If ->readpage returns an error, it has already unlocked the page. Fixes: 5e929b33c393 ("CacheFiles: Handle truncate unlocking the page we're reading") Cc: stable@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: David Howells Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/cachefiles/rdwr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c @@ -125,7 +125,7 @@ static int cachefiles_read_reissue(struc _debug("reissue read"); ret = bmapping->a_ops->readpage(NULL, backpage); if (ret < 0) - goto unlock_discard; + goto discard; } /* but the page may have been read before the monitor was installed, so @@ -142,6 +142,7 @@ static int cachefiles_read_reissue(struc unlock_discard: unlock_page(backpage); +discard: spin_lock_irq(&object->work_lock); list_del(&monitor->op_link); spin_unlock_irq(&object->work_lock);