Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp317747lqp; Mon, 10 Jun 2024 05:21:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUKrJPzfknWHhZnCT8ScMY9TffhoUGfP4rWsS1FVYbM/KRFFfDHisbC4+nw+GBQZ1xBXNJ1LPyuseccsNSjoNbX4xW6CAtRnOui61hKpw== X-Google-Smtp-Source: AGHT+IFiqAa0wtI9V6ORpSYBPx2BRcSuzJMVLJLzgwvPbsUlTFVSMYA8fGuQqlI0XgUjCCO4f0eT X-Received: by 2002:a67:ce11:0:b0:48c:4741:cd05 with SMTP id ada2fe7eead31-48c4741cfedmr3671048137.3.1718022116834; Mon, 10 Jun 2024 05:21:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718022116; cv=pass; d=google.com; s=arc-20160816; b=RRi6a6M91RFit2SVUwIEsRBkCH80D39L61C4ZpUvsXlLGYdaZw+sgICOFUj1I93O79 OEZtqjYZbKQhJ6WG7fqPDynli0J60A9PDpOV8GUMfUSj2TfNJklo/dvNTRuBLCRRyHDB 9XQv4S4Eb8UckGuBB2mc3uzzAtDOe+S4F+0WgV5PUYT9NS2lLMqMn0GfOGwAkvCJZVjq O25yKBFjQ9255ax5mDhd4lp/ZoZGGeRPxo65oTNsmbtBqVc6tahHkLHcbdMPeVkiclbR W6SHnLXsVMg64zlDdEJfuNUSAnCl0/YXfvT4Qi5+cX71bl7g9zjUe3aKJYU4+V6EuGjO ha8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=bi6cgPfzWClwiQ8HzOEtHm8XJPWsHgpLsfOfIxzC5xg=; fh=YigaOY9+RB3iuUhpoinhBxkLELrcfWQjpwhCsgjv31U=; b=yFJT+rBo/rZ5r/oI8vWGNvjzIHi/+895xGpQdJTKv5dAu/icYqNRSMrCpVSuKrPlFr czwpj8uGqbWFu2rw/mKgXOMUjR6i2gTaOXQmFqMdI64CKn1KXc8cO1i4XduS6ekgo/Yg TuDnPjS89rWoodmdMbk4NX78VS92XzvOz42c0QyuQDVz/dK5aBgnRgACtBUFavb4FyeS Dj2V7uhkYBGOmJ2tuPJtbTHU/SwQjaIEgXG0nddYmW80CAWZQ2yIdeZXKegaEunedL6q lGYHcRv2SyVZuGTrXXoG+tUvJr4T8uIEMVRrpf6xm2Nl4xQVkzxyqIgRGBgrYQTllmEr cSKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=biyd+hYL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-3628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ada2fe7eead31-48c3f24964esi740927137.456.2024.06.10.05.21.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 05:21:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-3628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=biyd+hYL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-3628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 87D1C1C21339 for ; Mon, 10 Jun 2024 12:21:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A6737F499; Mon, 10 Jun 2024 12:21:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="biyd+hYL" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB2E17F7C6 for ; Mon, 10 Jun 2024 12:21:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718022102; cv=none; b=HVIQoRdSb3cJCbKt8Ken1vcpBYS2dgiAolDl/SycHlnEBkj/lUVN0ETFvP2AjYxiJUNTgE7caojzDDXuPuKzMNSBf70kUn0znebHe1bfD1HkAZr9/5bLt5Elr2GZ+1VGGiL9qwUn98PZdFiW5BV2Q1vSXeizSBs3nCicDDrvLOk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718022102; c=relaxed/simple; bh=3ixPS2CoFpF1Evucbd5egsI/P5ahevKi50HuuhvLcY0=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=WAAyC5phRKThTbz0kW1D91lbHF1Aoja8BwuTv8UFStT6nb4GHwBMuGpdkgf8Q14LAptgY8uM6msiMRrEfgy/mHiOQdAHb8V7d4dzDk1wdnUAF0I2XPP9si/tvdPJ6fnl0sWDmnVj65jYNRgItSnGBnzu/jN5/+7YxL5zSXVYD+E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=biyd+hYL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8853C2BBFC; Mon, 10 Jun 2024 12:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718022102; bh=3ixPS2CoFpF1Evucbd5egsI/P5ahevKi50HuuhvLcY0=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=biyd+hYL7cyohLYJCi0qHbL9f4yeThdbMqI/mvTjXvL4y5HzuFyfF+GsSv9DKSv0y Mwr4JRyXqugQzm2x2QxW5TyWWYz/j9T1j4KtinFujqakTo1d+21NlrcZ/+xLVJl7es RAhlFlRRZ3FrOFY3kLhxmy96S/bjhSUfzej7bvFu52JS2ug4SipOdedfabiI1SZNaZ P4wtbVOBRUKqK9EGSnTQ8UxsB6Zf5gUWdJxMI6yPgMEhJHQVJmzConRn2LSNL4Lnkm OH/6YsVir9AKZfdEkT1a2fb3uYgOQZP1KYj7mIeI1e9WYj+97rz3/6lb4g/jqBMt6o DBywnhl/mwZ6A== Message-ID: <903610ef28512c03fd8db6b4b57e65b3a8bda8a9.camel@kernel.org> Subject: Re: [for-6.11 PATCH 04/29] sunrpc: handle NULL req->defer in cache_defer_req From: Jeff Layton To: Mike Snitzer , linux-nfs@vger.kernel.org Cc: Chuck Lever , Trond Myklebust , snitzer@hammerspace.com, neilb@suse.de Date: Mon, 10 Jun 2024 08:21:40 -0400 In-Reply-To: <20240607142646.20924-5-snitzer@kernel.org> References: <20240607142646.20924-1-snitzer@kernel.org> <20240607142646.20924-5-snitzer@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-1.fc39) Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2024-06-07 at 10:26 -0400, Mike Snitzer wrote: > From: Weston Andros Adamson >=20 > Dont crash with a NULL pointer dereference when req->defer isn't > set. This is needed for the localio path. >=20 > Signed-off-by: Weston Andros Adamson > Signed-off-by: Lance Shelton > Signed-off-by: Trond Myklebust > Signed-off-by: Mike Snitzer > --- > =C2=A0net/sunrpc/cache.c | 2 ++ > =C2=A01 file changed, 2 insertions(+) >=20 > diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c > index 95ff74706104..b757b891382c 100644 > --- a/net/sunrpc/cache.c > +++ b/net/sunrpc/cache.c > @@ -714,6 +714,8 @@ static bool cache_defer_req(struct cache_req > *req, struct cache_head *item) > =C2=A0 return false; > =C2=A0 } > =C2=A0 > + if (!req->defer) > + return false; > =C2=A0 dreq =3D req->defer(req); > =C2=A0 if (dreq =3D=3D NULL) > =C2=A0 return false; I've gone over it many times, but I still don't quite "get" the deferral handling code. I think the above is probably safe, but please do Cc Neil Brown on later postings of this series since he has a better grasp of that code. --=20 Jeff Layton