From patchwork Sat Jan 21 14:47:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengen Du X-Patchwork-Id: 1729950 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=jK/Nanbl; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NzfNQ2Px6z23gL for ; Sun, 22 Jan 2023 01:47:34 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pJF9T-0000FT-7E; Sat, 21 Jan 2023 14:47:27 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pJF9P-0000Az-0C for kernel-team@lists.ubuntu.com; Sat, 21 Jan 2023 14:47:23 +0000 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 8C4C5418E4 for ; Sat, 21 Jan 2023 14:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1674312442; bh=0bl0UGbtEp0YresrzuBy4C9WetOQWvdy91vfOBslV1c=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jK/NanblYblcV50/P8Z2t0OjVs+SXfoign6USndzxta6WNHiA1rF7uDrIrsxoWlMF Xt9LSDTqG/5FkU/SIj5OKH4l4c2hxMDm97MSZcX4rI+71juW96g/Iw9kWWKgQfk2i8 YKEDr5ZDxhPbRMn2AP24PBBXYen/8nn4hy4SCt68O2Ycv+EWL1jlPVr0FdP5097dJ+ J37nYMdHtl2zdXwdjhsBjIDfqLee5F2agl6wVaw/q4W0M2XEyoporGO7kjlOLCCXra cxADmEYKikScz1dh1KL45spv3riEtEMammBkscQR6fcKQrESmdne/aZIAqTbGzpoeY uLOjaWGsdwqvQ== Received: by mail-pj1-f71.google.com with SMTP id nb8-20020a17090b35c800b0022bb3fd0718so1662850pjb.4 for ; Sat, 21 Jan 2023 06:47:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0bl0UGbtEp0YresrzuBy4C9WetOQWvdy91vfOBslV1c=; b=DeyAxEDGy42iPHAJ6BHYk060sDA8oR7kZSE4e5XmsMSvpBLzUkskbuHFri75v6227p Pk0NIV2IJgkiKBXaovRJdBnrDgN7zJixjp11ZrFWVd1vqp+nzzVp2g3TKMethUnJy/Ue VA+nR7ciqLJxzcCg1Y9/hJEAvrn/1+9lnOt015GuqmazRbvSV+GNABB8ZMn36mkJcB6H rUUA8dyrb2hUnG0p5tpR2w5KQ68xxS24/AU1Uu+7R8NzOMYbQHLMDcdpF0UZe+O1EDyf qIG6LzyQvtdD4w/Ht1q5Jt2gDrD+HSA2Y3KIGmMNOvMee3l6hhtijqGAf/TWoqS/uENe B3Cw== X-Gm-Message-State: AFqh2krUOup2xIh4DcIMtMwATs437WFjJ3Z8ODYyYhumCZc5AkR+azWH x2ivggvNwh8aKBiiZmaQsrwA8tX4xMcnXYfrt5SRzrHGCw4Gkk+CAZ9vFqoHhOcwXR7Fs5mdRIR gFAo84Tqc/5cqymvVV10cQBSaParFtzy7A5s/xiO2EQ== X-Received: by 2002:a05:6a21:170d:b0:b6:3a0:6ec1 with SMTP id nv13-20020a056a21170d00b000b603a06ec1mr17326178pzb.25.1674312440975; Sat, 21 Jan 2023 06:47:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXuAwm6wjq72FQPcuCBO/fYnasbjZGcfIzJnFqczrEH23plcs7TKDOM2X+mYyW6tizeICrER/A== X-Received: by 2002:a05:6a21:170d:b0:b6:3a0:6ec1 with SMTP id nv13-20020a056a21170d00b000b603a06ec1mr17326171pzb.25.1674312440703; Sat, 21 Jan 2023 06:47:20 -0800 (PST) Received: from chengendu.. (111-248-116-144.dynamic-ip.hinet.net. [111.248.116.144]) by smtp.gmail.com with ESMTPSA id p5-20020a170902bd0500b001932a9e4f2csm25656235pls.255.2023.01.21.06.47.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 06:47:20 -0800 (PST) From: Chengen Du To: kernel-team@lists.ubuntu.com Subject: [SRU][Bionic][PATCH 4/4] (upstream) NFS: Fix up a sparse warning Date: Sat, 21 Jan 2023 22:47:13 +0800 Message-Id: <20230121144713.39111-5-chengen.du@canonical.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230121144713.39111-1-chengen.du@canonical.com> References: <20230121144713.39111-1-chengen.du@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Trond Myklebust BugLink: https://bugs.launchpad.net/bugs/2003053 sparse is warning about an incorrect RCU dereference. fs/nfs/dir.c:2965:56: warning: incorrect type in argument 1 (different address spaces) fs/nfs/dir.c:2965:56: expected struct cred const * fs/nfs/dir.c:2965:56: got struct cred const [noderef] __rcu *const cred Signed-off-by: Trond Myklebust (cherry picked from commit 5e9a7b9c2ea18551759833146a181b14835bfe39) Signed-off-by: Chengen Du --- fs/nfs/dir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 9a39bb94d5d8..b98b19ca367c 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2298,12 +2298,14 @@ static u64 nfs_access_login_time(const struct task_struct *task, const struct cred *cred) { const struct task_struct *parent; + const struct cred *pcred; u64 ret; rcu_read_lock(); for (;;) { parent = rcu_dereference(task->real_parent); - if (parent == task || cred_fscmp(parent->cred, cred) != 0) + pcred = rcu_dereference(parent->cred); + if (parent == task || cred_fscmp(pcred, cred) != 0) break; task = parent; }