diff mbox series

ceph: fix double free for req when failing to allocate sparse ext map

Message ID 20230111011403.570964-1-xiubli@redhat.com (mailing list archive)
State New, archived
Headers show
Series ceph: fix double free for req when failing to allocate sparse ext map | expand

Commit Message

Xiubo Li Jan. 11, 2023, 1:14 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

Introduced by commit d1f436736924 ("ceph: add new mount option to enable
sparse reads") and will fold this into the above commit since it's
still in the testing branch.

Reported-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/addr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Ilya Dryomov Jan. 11, 2023, 12:22 p.m. UTC | #1
On Wed, Jan 11, 2023 at 2:14 AM <xiubli@redhat.com> wrote:
>
> From: Xiubo Li <xiubli@redhat.com>
>
> Introduced by commit d1f436736924 ("ceph: add new mount option to enable
> sparse reads") and will fold this into the above commit since it's
> still in the testing branch.
>
> Reported-by: Ilya Dryomov <idryomov@gmail.com>
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/addr.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 17758cb607ec..3561c95d7e23 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -351,10 +351,8 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
>
>         if (sparse) {
>                 err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
> -               if (err) {
> -                       ceph_osdc_put_request(req);
> +               if (err)
>                         goto out;
> -               }
>         }
>
>         dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);
> --
> 2.39.0
>

Hi Xiubo,

Looks good, let's fold this into that commit since it's still testing
branch material.

Thanks,

                Ilya
Xiubo Li Jan. 12, 2023, 4:22 a.m. UTC | #2
On 11/01/2023 20:22, Ilya Dryomov wrote:
> On Wed, Jan 11, 2023 at 2:14 AM <xiubli@redhat.com> wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> Introduced by commit d1f436736924 ("ceph: add new mount option to enable
>> sparse reads") and will fold this into the above commit since it's
>> still in the testing branch.
>>
>> Reported-by: Ilya Dryomov <idryomov@gmail.com>
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>>   fs/ceph/addr.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
>> index 17758cb607ec..3561c95d7e23 100644
>> --- a/fs/ceph/addr.c
>> +++ b/fs/ceph/addr.c
>> @@ -351,10 +351,8 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
>>
>>          if (sparse) {
>>                  err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
>> -               if (err) {
>> -                       ceph_osdc_put_request(req);
>> +               if (err)
>>                          goto out;
>> -               }
>>          }
>>
>>          dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);
>> --
>> 2.39.0
>>
> Hi Xiubo,
>
> Looks good, let's fold this into that commit since it's still testing
> branch material.

Yeah, sure will do.

Thanks

- Xiubo


> Thanks,
>
>                  Ilya
>
Jeffrey Layton Jan. 12, 2023, 12:09 p.m. UTC | #3
On Wed, 2023-01-11 at 09:14 +0800, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
> 
> Introduced by commit d1f436736924 ("ceph: add new mount option to enable
> sparse reads") and will fold this into the above commit since it's
> still in the testing branch.
> 
> Reported-by: Ilya Dryomov <idryomov@gmail.com>
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/addr.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 17758cb607ec..3561c95d7e23 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -351,10 +351,8 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
>  
>  	if (sparse) {
>  		err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
> -		if (err) {
> -			ceph_osdc_put_request(req);
> +		if (err)
>  			goto out;
> -		}
>  	}
>  
>  	dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);

Looks right.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Xiubo Li Jan. 13, 2023, 3:09 a.m. UTC | #4
On 12/01/2023 20:09, Jeff Layton wrote:
> On Wed, 2023-01-11 at 09:14 +0800, xiubli@redhat.com wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> Introduced by commit d1f436736924 ("ceph: add new mount option to enable
>> sparse reads") and will fold this into the above commit since it's
>> still in the testing branch.
>>
>> Reported-by: Ilya Dryomov <idryomov@gmail.com>
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>>   fs/ceph/addr.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
>> index 17758cb607ec..3561c95d7e23 100644
>> --- a/fs/ceph/addr.c
>> +++ b/fs/ceph/addr.c
>> @@ -351,10 +351,8 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
>>   
>>   	if (sparse) {
>>   		err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
>> -		if (err) {
>> -			ceph_osdc_put_request(req);
>> +		if (err)
>>   			goto out;
>> -		}
>>   	}
>>   
>>   	dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);
> Looks right.
>
> Reviewed-by: Jeff Layton <jlayton@kernel.org>

Already folded this into the previous commit.

Thanks Jeff.
diff mbox series

Patch

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 17758cb607ec..3561c95d7e23 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -351,10 +351,8 @@  static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
 
 	if (sparse) {
 		err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
-		if (err) {
-			ceph_osdc_put_request(req);
+		if (err)
 			goto out;
-		}
 	}
 
 	dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);