Skip to content

Commit

Permalink
NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info
Browse files Browse the repository at this point in the history
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: [email protected]
Signed-off-by: Fedor Pchelkin <[email protected]>
Reviewed-by: Benjamin Coddington <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>
  • Loading branch information
pchelkin91 authored and amschuma-ntap committed Aug 24, 2023
1 parent 08be82b commit 96562c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/nfs/pnfs_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 96562c4

Please sign in to comment.