Message ID | 20240619063819.2445-1-cliang01.li@samsung.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed | expand |
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 <cliang01.li@samsung.com> > --- > 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
在 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 <cliang01.li@samsung.com> >> --- >> 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 >
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 <cliang01.li@samsung.com> >>> --- >>> 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 <asml.silence@gmail.com>
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,
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 {
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 <cliang01.li@samsung.com> --- io_uring/rsrc.c | 1 - 1 file changed, 1 deletion(-) base-commit: 3b87184f7eff27fef7d7ee18b65f173152e1bb81