Re: [PATCH 7/8] cachefiles: Fix NULL pointer dereference in object->file

From: David Howells
Date: Thu Oct 10 2024 - 07:26:28 EST


Zizhi Wo <wozizhi@xxxxxxxxxx> wrote:

> + spin_lock(&object->lock);
> if (object->file) {
> fput(object->file);
> object->file = NULL;
> }
> + spin_unlock(&object->lock);

I would suggest stashing the file pointer in a local var and then doing the
fput() outside of the locks.

David