On (25/05/04 20:00), Sergey Senozhatsky wrote:
Do not mix class->size and object size during offsets/sizes calculation in zs_obj_write(). Size classes can merge into clusters, based on objects-per-zspage and pages-per-zspage characteristics, so some size classes can store objects smaller than class->size. This becomes problematic when object size is much smaller than class->size - we can determine that object spans two physical pages, because we use a larger class->size for this, while the actual object is much smaller and fits one physical page, so there is nothing to write to the second page and memcpy() size calculation underflows.
We always know the exact size in bytes of the object that we are about to write (store), so use it instead of class->size.
I think it's
Fixes: 44f76413496e ("zsmalloc: introduce new object mapping API")