diff mbox series

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

Message ID 20230111011403.570964-1-xiubli@redhat.com
State New
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

Xiubo Li Jan. 13, 2023, 3:09 a.m. UTC | #1
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);