Re: [PATCH] mm/slub: Fix incorrect checkings of s->offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/27/20 8:38 AM, Matthew Wilcox wrote:
On Sun, Apr 26, 2020 at 10:02:12PM -0400, Waiman Long wrote:
In a couple of places in the slub memory allocator, the code uses
"s->offset" as a check to see if the free pointer is put right after the
object. That check is no longer true with commit 3202fa62fb43 ("slub:
relocate freelist pointer to middle of object").

As a result, echoing "1" into the validate sysfs file, e.g. of dentry,
may cause a bunch of "Freepointer corrupt" error reports to appear with
the system in panic afterwards.

To fix it, use the check "s->offset == s->inuse" instead.
I think a little refactoring would make this more clear.

unsigned int track_offset(const struct kmem_cache *s)
{
	return s->inuse + (s->offset == s->inuse) ? sizeof(void *) : 0;
}

Yes, that was what I am thinking of doing in v2.

Thanks,
Longman





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux