Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4481152ivc; Tue, 3 Nov 2020 13:09:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcfahLvyYiIMHQvRVLu9k9eY4m/Jml+Wv6qwN6XLpU+U1jFe50qDM1UL6UInsXjl74doQo X-Received: by 2002:aa7:c2c4:: with SMTP id m4mr15174105edp.66.1604437792292; Tue, 03 Nov 2020 13:09:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437792; cv=none; d=google.com; s=arc-20160816; b=SuGCjubKC0Y+ssAuaIOUvms3Zr/M1jkOXF/EXYInnRJOSoA8XR1PFvobuHr9hFNU6j UqBX5T9A1iv11nGFOWvGjN2xdfBS42E2R0IS5jhKlJsm5JoFvJH6UIMf441pwfhd+6M0 WbxPcjkUVGqng7m6R+vqSAz70ujsVeQGda/ArLnJTwg69jzQspFfk0kWs4zTBSZl0IwK Y1nMqu7brpze05D2ejq1gvp2d77AZE8Ct95wRxZxNA5UzGOxE5nnkXP8f1MQeYuocN4e ZLyY7OFbA2v/GsaQWE6GUnSfAm7eUVbivmqvrM4QlkJiFgGyfYClEawSudcSCtGzaaec JBWg== 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=dNyL341qIH5OS/yZNRhoZZaafFjDdfpEtpJACA8YxxFInnMLpvcrZAS9KbgQ7mnOwn ug/Ljj/GyCPHMRO1/HK8KH6z9q43sQ21hC4qu1yaaHXgYY1UcIsGY33aitxr6gE5rsAe pAwki2pFpexaWq3ROo/ZH0tWsWyP/Z9SON7jv/OuX2aXVzwcjqz4tBrVUUUiqOECr/XY jni0UnwpVZoKSEaGchutFtsRfr2eS8Z3nDou5xKYojuKkxEgl88d8N5qLvn853pSOOFG vlhz5EGQl/mFAxQp2B8CBwTKCf4uDAWxH5bq9o2UtuJx+P55e6lk0qo1k/xlL1+jEejb SWww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HNwjLo9b; 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 t20si21203ejj.396.2020.11.03.13.09.29; Tue, 03 Nov 2020 13:09:52 -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=HNwjLo9b; 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 S2388635AbgKCVIQ (ORCPT + 99 others); Tue, 3 Nov 2020 16:08:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:47452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388386AbgKCVIC (ORCPT ); Tue, 3 Nov 2020 16:08:02 -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 564EE20757; Tue, 3 Nov 2020 21:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437681; bh=IIAOtgt89gqbo9vAelAbodztDRMXT2h/qI7NZYHRdWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HNwjLo9bzvKSUlLTJOYKWN0NWqQ2rDsZn8rDSVYqGQDU8W0hTIvKwX1GZSzeeG9PK yvp8iLU/Drt1m29YgkHDGt+Lytpx3g3ZtZZwh5CvovUI7Gla1wHeNfr1BEg4lKnJPy NP8FiqEiQgI7rsNWX30dZwV1oazv44jKbaLA4bRY= 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.19 181/191] cachefiles: Handle readpage error correctly Date: Tue, 3 Nov 2020 21:37:53 +0100 Message-Id: <20201103203249.646289926@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@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);