Subject: Re: [PATCH net-next] netlink: make getters tolerate NULL nla arg

From: Toke Høiland-Jørgensen <[email-masked]>
Date: Thu, 16 Jan 2020 17:23:31 +0100

Florian Westphal <[email-masked]> writes:

> Toke Høiland-Jørgensen <[email-masked]> wrote:
>> Florian Westphal <[email-masked]> writes:
>> 
>> > One recurring bug pattern triggered by syzbot is NULL dereference in
>> > netlink code paths due to a missing "tb[NL_ARG_FOO] != NULL" test.
>> >
>> > At least some of these missing checks would not have crashed the kernel if
>> > the various nla_get_XXX helpers would return 0 in case of missing arg.
>> 
>> Won't this risk just papering over the issue and lead to subtly wrong
>> behaviour instead? At least a crash is somewhat visible :)
>
> How?  Its no different than tb[X] being set with a 0 value.

I was thinking that at lack of NULL check could also imply a lack of
proper bounds checking. And that the crashes at least shine a light on
them forcing people to consider whether that is indeed the case?

(IDK if that's actually the case, I'm asking :))

-Toke