Re: perf: use-after-free in perf_release

From: Peter Zijlstra
Date: Thu Mar 16 2017 - 09:58:22 EST


On Wed, Mar 15, 2017 at 05:43:02PM +0100, Oleg Nesterov wrote:
> static inline int list_is_first(const struct list_head *list,
> const struct list_head *head)
> {
> return head->next == list;
> }
>
> won't be symmetrical with list_is_last() we already have.

This is the one that makes sense to me though; that is, the current
list_is_last() doesn't make sense to me.

I would expect:

static inline int list_is_last(const struct list_head *list,
const struct list_head *head)
{
return head->prev == list
}

because @head is the list argument (yes, I know, horrible naming!).