Re: [PATCH 5/5] staging/lustre/lnet: fix potential null pointer dereference

From: Oleg Drokin
Date: Sun Apr 27 2014 - 19:28:51 EST


Hello!

On Apr 27, 2014, at 6:39 PM, Greg Kroah-Hartman wrote:
>>
>> - lnet_ni_notify_locked(ni, lp);
>> + if (ni != NULL)
>> + lnet_ni_notify_locked(ni, lp);
>
> Why can't lnet_ni_notify_locked() accept NULL as an input?

It makes no sense, because then there is nowhere to send the notification.
That said, it appears a race is possible where one caller updated let_peer structure to ask for a notification
and then we fell through here with a NULL ni and called into lnet_ni_notify_locked
where we'd try to dereference this NULL ni.
But this is the only called that accepts separate ni and lp, where as the only other caller gets them from the same struct
where they are updated more in sync.

I guess it makes sense to update lnet_ni_notify_locked as a future-proofing excercise.

Thanks, I'll update this patch.

Bye,
Oleg--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/