Re: [PATCH v2] ceph: fix memory leakage in ceph_readdir

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

 



On Tue, 2022-03-01 at 21:17 +0800, xiubli@xxxxxxxxxx wrote:
> From: Xiubo Li <xiubli@xxxxxxxxxx>
> 
> Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx>
> Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
> ---
>  fs/ceph/dir.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> index 0cf6afe283e9..bf69678d6434 100644
> --- a/fs/ceph/dir.c
> +++ b/fs/ceph/dir.c
> @@ -478,8 +478,10 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
>  					2 : (fpos_off(rde->offset) + 1);
>  			err = note_last_dentry(dfi, rde->name, rde->name_len,
>  					       next_offset);
> -			if (err)
> +			if (err) {
> +				ceph_mdsc_put_request(dfi->last_readdir);
>  				return err;
> +			}
>  		} else if (req->r_reply_info.dir_end) {
>  			dfi->next_offset = 2;
>  			/* keep last name */
> @@ -521,6 +523,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
>  			      ceph_present_ino(inode->i_sb, le64_to_cpu(rde->inode.in->ino)),
>  			      le32_to_cpu(rde->inode.in->mode) >> 12)) {
>  			dout("filldir stopping us...\n");
> +			ceph_mdsc_put_request(dfi->last_readdir);
>  			return 0;
>  		}
>  		ctx->pos++;

Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx>



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux