Skip to content

Commit 96562c4

Browse files
pchelkin91amschuma-ntap
authored andcommitted
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>
1 parent 08be82b commit 96562c4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/nfs/pnfs_dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ nfs4_get_device_info(struct nfs_server *server,
154154
set_bit(NFS_DEVICEID_NOCACHE, &d->flags);
155155

156156
out_free_pages:
157-
for (i = 0; i < max_pages; i++)
157+
while (--i >= 0)
158158
__free_page(pages[i]);
159159
kfree(pages);
160160
out_free_pdev:

0 commit comments

Comments
 (0)