summaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
authorFedor Pchelkin <pchelkin@ispras.ru>2023-07-20 18:37:51 +0300
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2023-08-24 13:24:15 -0400
commit96562c45af5c31b89a197af28f79bfa838fb8391 (patch)
tree3d2229c963e035a04a25005e3533e31265c10a0a /fs/nfs
parent08be82ba0cffdfa15ce2e2c312cb704823971862 (diff)
NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info
It is an almost improbable error case but when page allocating loop in nfs4_get_device_info() fails then we should only free the already allocated pages, as __free_page() can't deal with NULL arguments. Found by Linux Verification Center (linuxtesting.org). Cc: stable@vger.kernel.org Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/pnfs_dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c
index ddbbf4fcda86..178001c90156 100644
--- a/fs/nfs/pnfs_dev.c
+++ b/fs/nfs/pnfs_dev.c
@@ -154,7 +154,7 @@ nfs4_get_device_info(struct nfs_server *server,
set_bit(NFS_DEVICEID_NOCACHE, &d->flags);
out_free_pages:
- for (i = 0; i < max_pages; i++)
+ while (--i >= 0)
__free_page(pages[i]);
kfree(pages);
out_free_pdev: