On Wed, Jun 30, 2021 at 01:12:26PM +0200, Marek Szyprowski wrote: > Hi Leon, > > On 29.06.2021 10:40, Leon Romanovsky wrote: > > From: Maor Gottlieb <maorg@xxxxxxxxxx> > > > > orig_nents should represent the number of entries with pages, > > but __sg_alloc_table_from_pages sets orig_nents as the number of > > total entries in the table. This is wrong when the API is used for > > dynamic allocation where not all the table entries are mapped with > > pages. It wasn't observed until now, since RDMA umem who uses this > > API in the dynamic form doesn't use orig_nents implicit or explicit > > by the scatterlist APIs. > > > > Fix it by: > > 1. Set orig_nents as number of entries with pages also in > > __sg_alloc_table_from_pages. > > 2. Add a new field total_nents to reflect the total number of entries > > in the table. This is required for the release flow (sg_free_table). > > This filed should be used internally only by scatterlist. > > > > Fixes: 07da1223ec93 ("lib/scatterlist: Add support in dynamic allocation of SG table from pages") > > Signed-off-by: Maor Gottlieb <maorg@xxxxxxxxxx> > > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx> <...> > For now I would suggest to revert this change. Thanks for the report, we will drop this patch.