2012-10-09 18:52:27

by Sasha Levin

[permalink] [raw]
Subject: Re: [PATCH 2/2] xattr: prevent NULL ptr deref warnings in __simple_xattr_set

On 09/14/2012 04:58 PM, Aristeu Rozanski wrote:
> On Fri, Sep 14, 2012 at 01:55:55PM -0700, Tejun Heo wrote:
>> On Fri, Sep 14, 2012 at 01:54:34PM -0700, Tejun Heo wrote:
>>> On Fri, Sep 14, 2012 at 09:35:54PM +0200, Sasha Levin wrote:
>>>> Prevent warnings generated by smatch due to unchecked dereference of
>>>> 'new_xattr' in __simple_xattr_set().
>>>
>>> Isn't this an actual bug w/ or w/o smatch? Remove request (NULL
>>> @value) w/o XATTR_REPLACE for an non-existent node would end up
>>> calling list_add() on NULL, right? If so, please collapse these two
>>> patches and mention the actual bug instead of smatch warning.
>>
>> And can somebody please make that function less confusing? -
>> restructuring / commenting whatever. It's doing something simple.
>> It's not supposed to be this confusing.
>
> I'll work on that.
>

As it's still happening in linux-next, should I send a simple patch to fix it along
with Tejun's comments? Or is the rewrite of __simple_xattr_set() behind the corner?


Thanks,
Sasha


2012-10-15 13:16:43

by Aristeu Rozanski

[permalink] [raw]
Subject: Re: [PATCH 2/2] xattr: prevent NULL ptr deref warnings in __simple_xattr_set

Sasha,
On Tue, Oct 09, 2012 at 02:52:15PM -0400, Sasha Levin wrote:
> On 09/14/2012 04:58 PM, Aristeu Rozanski wrote:
> > On Fri, Sep 14, 2012 at 01:55:55PM -0700, Tejun Heo wrote:
> >> On Fri, Sep 14, 2012 at 01:54:34PM -0700, Tejun Heo wrote:
> >>> On Fri, Sep 14, 2012 at 09:35:54PM +0200, Sasha Levin wrote:
> >>>> Prevent warnings generated by smatch due to unchecked dereference of
> >>>> 'new_xattr' in __simple_xattr_set().
> >>>
> >>> Isn't this an actual bug w/ or w/o smatch? Remove request (NULL
> >>> @value) w/o XATTR_REPLACE for an non-existent node would end up
> >>> calling list_add() on NULL, right? If so, please collapse these two
> >>> patches and mention the actual bug instead of smatch warning.
> >>
> >> And can somebody please make that function less confusing? -
> >> restructuring / commenting whatever. It's doing something simple.
> >> It's not supposed to be this confusing.
> >
> > I'll work on that.
> >
>
> As it's still happening in linux-next, should I send a simple patch to fix it along
> with Tejun's comments? Or is the rewrite of __simple_xattr_set() behind the corner?

the problem isn't because of the way __simple_xattr_set(), but because
the fix took another route and wasn't present when you hit it last.

--
Aristeu