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

David Howells dhowells at redhat.com
Thu Oct 10 22:26:05 AEDT 2024


Zizhi Wo <wozizhi at huawei.com> 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



More information about the Linux-erofs mailing list