Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pnfs/flexfiles: Fix memory leak in nfs4_ff_alloc_deviceid_node()

In nfs4_ff_alloc_deviceid_node(), if the allocation for ds_versions fails,
the function jumps to the out_scratch label without freeing the already
allocated dsaddrs list, leading to a memory leak.

Fix this by jumping to the out_err_drain_dsaddrs label, which properly
frees the dsaddrs list before cleaning up other resources.

Fixes: d67ae825a59d6 ("pnfs/flexfiles: Add the FlexFile Layout Driver")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

authored by

Zilin Guan and committed by
Trond Myklebust
0c728083 cce0be6e

+1 -1
+1 -1
fs/nfs/flexfilelayout/flexfilelayoutdev.c
··· 103 103 sizeof(struct nfs4_ff_ds_version), 104 104 gfp_flags); 105 105 if (!ds_versions) 106 - goto out_scratch; 106 + goto out_err_drain_dsaddrs; 107 107 108 108 for (i = 0; i < version_count; i++) { 109 109 /* 20 = version(4) + minor_version(4) + rsize(4) + wsize(4) +