Re: [PATCH 2/4] nfsd: Can leak pnfs_block_extent on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2016-05-24 at 22:09 -0700, Tom Haynes wrote:
> Signed-off-by: Tom Haynes <loghyr@xxxxxxxxxxxxxxx>
> ---
>  fs/nfsd/blocklayout.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c
> index 248adb6..9a195f1 100644
> --- a/fs/nfsd/blocklayout.c
> +++ b/fs/nfsd/blocklayout.c
> @@ -23,7 +23,7 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp,
>  	struct nfsd4_layout_seg *seg = &args->lg_seg;
>  	struct super_block *sb = inode->i_sb;
>  	u32 block_size = (1 << inode->i_blkbits);
> -	struct pnfs_block_extent *bex;
> +	struct pnfs_block_extent *bex = NULL;
>  	struct iomap iomap;
>  	u32 device_generation = 0;
>  	int error;
> @@ -105,9 +105,11 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp,
>  	return 0;
>  
>  out_error:
> +	kfree(bex);
>  	seg->length = 0;
>  	return nfserrno(error);
>  out_layoutunavailable:
> +	kfree(bex);
>  	seg->length = 0;
>  	return nfserr_layoutunavailable;
>  }

Nice catch! Might be reasonable for stable?

Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux