From patchwork Tue Sep 1 15:09:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 264721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08814C433E6 for ; Tue, 1 Sep 2020 15:40:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1B5E206EF for ; Tue, 1 Sep 2020 15:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974851; bh=fgw8t3NnhMFaUUKRwL+4eoTTjNCPCjwBU1jrwJ9Oky8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1LiDnAXMaY/k/ptuXUQUr6cfCrdy+oW8O4LELx59H4IZq4Lm/nEwWol2zDDzPgq2X R29qf4WekX0zH9Ty6jjji5UkeC325jDjsSnrtjfjeazYf08rLCjnRFeV7QTynpOtPn aodGBEWLBGkMKaImZ/Udpg8bkIvhaX7lefrmMW34= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731504AbgIAPkr (ORCPT ); Tue, 1 Sep 2020 11:40:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:52146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731251AbgIAPko (ORCPT ); Tue, 1 Sep 2020 11:40:44 -0400 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 99F05206EF; Tue, 1 Sep 2020 15:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974844; bh=fgw8t3NnhMFaUUKRwL+4eoTTjNCPCjwBU1jrwJ9Oky8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A2d9Fg2g1tVFBrJJBhASPwbfqUXXStgYIkfXItzQipJ8ifq+II3a02dmW7NUO2X0R 9G84XdQYDWEp6Z4VrHgAuQAkUteyKGbRPyyeg3pdpZuorjtDufyvydjLju41UaKVtc C5k5fXH8f0FGbYGC62mcvTzjVPkMliyM282dPeh4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Dinse , "J. Bruce Fields" , Chuck Lever , Sasha Levin Subject: [PATCH 5.8 085/255] nfsd: fix oops on mixed NFSv4/NFSv3 client access Date: Tue, 1 Sep 2020 17:09:01 +0200 Message-Id: <20200901151004.808554866@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901151000.800754757@linuxfoundation.org> References: <20200901151000.800754757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: J. Bruce Fields [ Upstream commit 34b09af4f54e6485e28f138ccad159611a240cc1 ] If an NFSv2/v3 client breaks an NFSv4 client's delegation, it will hit a NULL dereference in nfsd_breaker_owns_lease(). Easily reproduceable with for example mount -overs=4.2 server:/export /mnt/ sleep 1h Fixes: 28df3d1539de50 ("nfsd: clients don't need to break their own delegations") BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208807 Signed-off-by: J. Bruce Fields Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index c9056316a0b35..cea682ce8aa12 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4597,6 +4597,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl) if (!i_am_nfsd()) return NULL; rqst = kthread_data(current); + if (!rqst->rq_lease_breaker) + return NULL; clp = *(rqst->rq_lease_breaker); return dl->dl_stid.sc_client == clp; }