FAILED: patch "[PATCH] pNFS/flexfiles: Check the layout validity in" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x e1c6cfbb3bd1377e2ddcbe06cf8fb1ec323ea7d3
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023102126-directed-excitable-b90e@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e1c6cfbb3bd1377e2ddcbe06cf8fb1ec323ea7d3 Mon Sep 17 00:00:00 2001
From: Trond Myklebust <[email protected]>
Date: Sun, 8 Oct 2023 14:28:46 -0400
Subject: [PATCH] pNFS/flexfiles: Check the layout validity in
ff_layout_mirror_prepare_stats
Ensure that we check the layout pointer and validity after dereferencing it in ff_layout_mirror_prepare_stats.
fs/nfs/flexfilelayout/flexfilelayout.c +10 -7
@@ -2520,9 +2520,9 @@ ff_layout_mirror_prepare_stats(struct pnfs_layout_hdr *lo,return i; } -static int -ff_layout_prepare_layoutstats (struct nfs42_layoutstat_args *args) +static int ff_layout_prepare_layoutstats (struct nfs42_layoutstat_args *args) { +struct pnfs_layout_hdr *lo;struct nfs4_flexfile_layout *ff_layout;const int dev_count =PNFS_LAYOUTSTATS_MAXDEV ;
@@ -2533,11 +2533,14 @@ ff_layout_prepare_layoutstats(struct nfs42_layoutstat_args *args)return -ENOMEM ;spin_lock (&args->inode->i_lock); - ff_layout =FF_LAYOUT_FROM_HDR (NFS_I (args->inode)->layout); - args->num_dev =ff_layout_mirror_prepare_stats (&ff_layout->generic_hdr, - &args->devinfo[0 ], - dev_count, -NFS4_FF_OP_LAYOUTSTATS ); + lo =NFS_I (args->inode)->layout; +if (lo &&pnfs_layout_is_valid (lo)) { + ff_layout =FF_LAYOUT_FROM_HDR (lo); + args->num_dev =ff_layout_mirror_prepare_stats ( + &ff_layout->generic_hdr, &args->devinfo[0 ], dev_count, +NFS4_FF_OP_LAYOUTSTATS ); + }else + args->num_dev =0 ;spin_unlock (&args->inode->i_lock);if (!args->num_dev) {kfree (args->devinfo);