Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp805587pxb; Tue, 3 Nov 2020 13:03:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzX1euWhjj2BltSqG/1ne8CqaULwUt4jFP34AtsjUfNfTKQmv28qKh6BQAArtQZkbBMWr63 X-Received: by 2002:aa7:d408:: with SMTP id z8mr16082347edq.166.1604437382630; Tue, 03 Nov 2020 13:03:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437382; cv=none; d=google.com; s=arc-20160816; b=wK0bMtgElUp8ep6zl3PwhaVjQwCYx2rg+OTrXjUe++eXVSjONNPlvGR69Z9s176K7C 8Y83t+lGjhBM2jMvCCbvWLLQU1OAMPBZ4Nthmwyf7nrioV/jEsCTA4YbAYM1iG95n98M clkgmL1AnoFzd580n48NPGQzzbsWeFD0PsOgt/KRM8WtVCt9FjJOD94Ny9lPcePNPuos c9E11rXVkzbFQzk5NdlDyMVN0vOsm0mA1FBmDooD2j+fQCkvZgsmPpDSpFyjK5J2rVkb GBdZXh24oNofDE5jK1Wv+eug9ruLJPnuqPd8deJtrJ8AH4M944fhjFKLKzdvHdy+ymZl SwNA== 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=1F1rhEg7bfIqCBVIiywP9tcXRTyggbOLxMn5W+sabqg=; b=EL7othA2oGtGO6cBD7iqZvr1WJvQw3FctgqNvZ39503V6bGwuddOHiudE/WkfpX2Nu 8RljKYLIEcXRW1/nY7hlW/5qjohCoSaATAOOjGsM92QcPR3PIi+whWUIjhkgiKVkCpiz IsolcmIaqKqvkAIwVRYkxH++CvyPEjY0ZHaQL1d0BT3yWfw+8Y5tH1+zxuL/CO32h6rC YB8aMlBtsVkFG3TA99i/01ub5/apiS3v1/cRNadaN9BoAN/2wtjMv30v0YKVD8KRj/KV pXDgbErg0ub4MNsmGpTr9MWZBPly8wsCS9GgCs3ef6NzUitR2U5zjAMR+A1a7j9QwvNV cVRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="XRhE7oZ/"; 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 u19si36061ejx.98.2020.11.03.13.02.38; Tue, 03 Nov 2020 13:03:02 -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="XRhE7oZ/"; 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 S2387436AbgKCVBP (ORCPT + 99 others); Tue, 3 Nov 2020 16:01:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:37608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731208AbgKCVBN (ORCPT ); Tue, 3 Nov 2020 16:01:13 -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 9766F22226; Tue, 3 Nov 2020 21:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437273; bh=WO/ScDgnIcLpusW7IfzMoFEU6c2HkLknbh+ilnrtuzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XRhE7oZ/R4wz0ExH5exmFHyKlH1A/Wsp891QjKOwotNxluDV6czEVBv+MO7cIYJwQ XMN7g7nKm4ljuB2zIFXmkrDW11g7bg5k3gr3Uz/5PGEnHx/8jonWSPMTB0K2XcVX7t lgXt+Q5zi/R57iXxCP7pZjsI9nMpFEu7IrZ+BsqI= 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 5.4 202/214] cachefiles: Handle readpage error correctly Date: Tue, 3 Nov 2020 21:37:30 +0100 Message-Id: <20201103203309.556398799@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@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 @@ -121,7 +121,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 @@ -138,6 +138,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);