public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed
       [not found] <CGME20240619063825epcas5p26224fc244b0ff14899731dea6d5a674b@epcas5p2.samsung.com>
@ 2024-06-19  6:38 ` Chenliang Li
  2024-06-19 14:27   ` Pavel Begunkov
  2024-06-20 12:52   ` Jens Axboe
  0 siblings, 2 replies; 5+ messages in thread
From: Chenliang Li @ 2024-06-19  6:38 UTC (permalink / raw)
  To: axboe, asml.silence
  Cc: io-uring, peiwei.li, joshi.k, kundan.kumar, anuj20.g, gost.dev,
	Chenliang Li

In io_import_fixed when advancing the iter within the first bvec, the
iter->nr_segs is set to bvec->bv_len. nr_segs should be the number of
bvecs, plus we don't need to adjust it here, so just remove it.

Fixes: b000ae0ec2d7 ("io_uring/rsrc: optimise single entry advance")
Signed-off-by: Chenliang Li <[email protected]>
---
 io_uring/rsrc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 60c00144471a..a860516bf448 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -1049,7 +1049,6 @@ int io_import_fixed(int ddir, struct iov_iter *iter,
 			 * branch doesn't expect non PAGE_SIZE'd chunks.
 			 */
 			iter->bvec = bvec;
-			iter->nr_segs = bvec->bv_len;
 			iter->count -= offset;
 			iter->iov_offset = offset;
 		} else {

base-commit: 3b87184f7eff27fef7d7ee18b65f173152e1bb81
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed
  2024-06-19  6:38 ` [PATCH] io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed Chenliang Li
@ 2024-06-19 14:27   ` Pavel Begunkov
  2024-06-19 15:47     ` Chenliang Li
  2024-06-20 12:52   ` Jens Axboe
  1 sibling, 1 reply; 5+ messages in thread
From: Pavel Begunkov @ 2024-06-19 14:27 UTC (permalink / raw)
  To: Chenliang Li, axboe
  Cc: io-uring, peiwei.li, joshi.k, kundan.kumar, anuj20.g, gost.dev

On 6/19/24 07:38, Chenliang Li wrote:
> In io_import_fixed when advancing the iter within the first bvec, the
> iter->nr_segs is set to bvec->bv_len. nr_segs should be the number of
> bvecs, plus we don't need to adjust it here, so just remove it.

Good catch, quite old. It's our luck that bvec iteration
honours the length and doesn't step outside of the first entry.

> Fixes: b000ae0ec2d7 ("io_uring/rsrc: optimise single entry advance")
> Signed-off-by: Chenliang Li <[email protected]>
> ---
>   io_uring/rsrc.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
> index 60c00144471a..a860516bf448 100644
> --- a/io_uring/rsrc.c
> +++ b/io_uring/rsrc.c
> @@ -1049,7 +1049,6 @@ int io_import_fixed(int ddir, struct iov_iter *iter,
>   			 * branch doesn't expect non PAGE_SIZE'd chunks.
>   			 */
>   			iter->bvec = bvec;
> -			iter->nr_segs = bvec->bv_len;

iter->nr_segs = 1, please


>   			iter->count -= offset;
>   			iter->iov_offset = offset;
>   		} else {
> 
> base-commit: 3b87184f7eff27fef7d7ee18b65f173152e1bb81

-- 
Pavel Begunkov

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed
  2024-06-19 14:27   ` Pavel Begunkov
@ 2024-06-19 15:47     ` Chenliang Li
  2024-06-20 10:35       ` Pavel Begunkov
  0 siblings, 1 reply; 5+ messages in thread
From: Chenliang Li @ 2024-06-19 15:47 UTC (permalink / raw)
  To: Pavel Begunkov, Chenliang Li, axboe
  Cc: io-uring, peiwei.li, joshi.k, kundan.kumar, anuj20.g, gost.dev


在 2024/6/19 22:27, Pavel Begunkov 写道:
> On 6/19/24 07:38, Chenliang Li wrote:
>> In io_import_fixed when advancing the iter within the first bvec, the
>> iter->nr_segs is set to bvec->bv_len. nr_segs should be the number of
>> bvecs, plus we don't need to adjust it here, so just remove it.
>
> Good catch, quite old. It's our luck that bvec iteration
> honours the length and doesn't step outside of the first entry.
>
>> Fixes: b000ae0ec2d7 ("io_uring/rsrc: optimise single entry advance")
>> Signed-off-by: Chenliang Li <[email protected]>
>> ---
>>   io_uring/rsrc.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
>> index 60c00144471a..a860516bf448 100644
>> --- a/io_uring/rsrc.c
>> +++ b/io_uring/rsrc.c
>> @@ -1049,7 +1049,6 @@ int io_import_fixed(int ddir, struct iov_iter 
>> *iter,
>>                * branch doesn't expect non PAGE_SIZE'd chunks.
>>                */
>>               iter->bvec = bvec;
>> -            iter->nr_segs = bvec->bv_len;
>
> iter->nr_segs = 1, please
Why 1? There could be multiple bvecs.
>
>
>>               iter->count -= offset;
>>               iter->iov_offset = offset;
>>           } else {
>>
>> base-commit: 3b87184f7eff27fef7d7ee18b65f173152e1bb81
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed
  2024-06-19 15:47     ` Chenliang Li
@ 2024-06-20 10:35       ` Pavel Begunkov
  0 siblings, 0 replies; 5+ messages in thread
From: Pavel Begunkov @ 2024-06-20 10:35 UTC (permalink / raw)
  To: Chenliang Li, Chenliang Li, axboe
  Cc: io-uring, peiwei.li, joshi.k, kundan.kumar, anuj20.g, gost.dev

On 6/19/24 16:47, Chenliang Li wrote:
> 
> 在 2024/6/19 22:27, Pavel Begunkov 写道:
>> On 6/19/24 07:38, Chenliang Li wrote:
>>> In io_import_fixed when advancing the iter within the first bvec, the
>>> iter->nr_segs is set to bvec->bv_len. nr_segs should be the number of
>>> bvecs, plus we don't need to adjust it here, so just remove it.
>>
>> Good catch, quite old. It's our luck that bvec iteration
>> honours the length and doesn't step outside of the first entry.
>>
>>> Fixes: b000ae0ec2d7 ("io_uring/rsrc: optimise single entry advance")
>>> Signed-off-by: Chenliang Li <[email protected]>
>>> ---
>>>   io_uring/rsrc.c | 1 -
>>>   1 file changed, 1 deletion(-)
>>>
>>> diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
>>> index 60c00144471a..a860516bf448 100644
>>> --- a/io_uring/rsrc.c
>>> +++ b/io_uring/rsrc.c
>>> @@ -1049,7 +1049,6 @@ int io_import_fixed(int ddir, struct iov_iter *iter,
>>>                * branch doesn't expect non PAGE_SIZE'd chunks.
>>>                */
>>>               iter->bvec = bvec;
>>> -            iter->nr_segs = bvec->bv_len;
>>
>> iter->nr_segs = 1, please
> Why 1? There could be multiple bvecs.

You're right

Reviewed-by: Pavel Begunkov <[email protected]>

-- 
Pavel Begunkov

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed
  2024-06-19  6:38 ` [PATCH] io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed Chenliang Li
  2024-06-19 14:27   ` Pavel Begunkov
@ 2024-06-20 12:52   ` Jens Axboe
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2024-06-20 12:52 UTC (permalink / raw)
  To: asml.silence, Chenliang Li
  Cc: io-uring, peiwei.li, joshi.k, kundan.kumar, anuj20.g, gost.dev


On Wed, 19 Jun 2024 14:38:19 +0800, Chenliang Li wrote:
> In io_import_fixed when advancing the iter within the first bvec, the
> iter->nr_segs is set to bvec->bv_len. nr_segs should be the number of
> bvecs, plus we don't need to adjust it here, so just remove it.
> 
> 

Applied, thanks!

[1/1] io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed
      commit: a23800f08a60787dfbf2b87b2e6ed411cb629859

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-20 12:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20240619063825epcas5p26224fc244b0ff14899731dea6d5a674b@epcas5p2.samsung.com>
2024-06-19  6:38 ` [PATCH] io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed Chenliang Li
2024-06-19 14:27   ` Pavel Begunkov
2024-06-19 15:47     ` Chenliang Li
2024-06-20 10:35       ` Pavel Begunkov
2024-06-20 12:52   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox