Skip to content

Commit 76ff294

Browse files
committed
Merge tag 'nfs-for-5.19-3' of git://git.linux-nfs.org/projects/anna/linux-nfs
Pull NFS client fixes from Anna Schumaker: - Allocate a fattr for _nfs4_discover_trunking() - Fix module reference count leak in nfs4_run_state_manager() * tag 'nfs-for-5.19-3' of git://git.linux-nfs.org/projects/anna/linux-nfs: NFSv4: Add an fattr allocation to _nfs4_discover_trunking() NFS: restore module put when manager exits.
2 parents 6f8693e + 4f40a5b commit 76ff294

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

fs/nfs/nfs4proc.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4012,22 +4012,29 @@ static int _nfs4_discover_trunking(struct nfs_server *server,
40124012
}
40134013

40144014
page = alloc_page(GFP_KERNEL);
4015+
if (!page)
4016+
return -ENOMEM;
40154017
locations = kmalloc(sizeof(struct nfs4_fs_locations), GFP_KERNEL);
4016-
if (page == NULL || locations == NULL)
4017-
goto out;
4018+
if (!locations)
4019+
goto out_free;
4020+
locations->fattr = nfs_alloc_fattr();
4021+
if (!locations->fattr)
4022+
goto out_free_2;
40184023

40194024
status = nfs4_proc_get_locations(server, fhandle, locations, page,
40204025
cred);
40214026
if (status)
4022-
goto out;
4027+
goto out_free_3;
40234028

40244029
for (i = 0; i < locations->nlocations; i++)
40254030
test_fs_location_for_trunking(&locations->locations[i], clp,
40264031
server);
4027-
out:
4028-
if (page)
4029-
__free_page(page);
4032+
out_free_3:
4033+
kfree(locations->fattr);
4034+
out_free_2:
40304035
kfree(locations);
4036+
out_free:
4037+
__free_page(page);
40314038
return status;
40324039
}
40334040

fs/nfs/nfs4state.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2753,5 +2753,6 @@ static int nfs4_run_state_manager(void *ptr)
27532753
goto again;
27542754

27552755
nfs_put_client(clp);
2756+
module_put_and_kthread_exit(0);
27562757
return 0;
27572758
}

0 commit comments

Comments
 (0)