Re: [PATCH v2] smb: client: fill cache fields after populating cache in copy_ref_data()
From: Paulo Alcantara
Date: Thu Sep 03 2026 - 11:36:07 EST
Fredric Cover <fredric.cover.lkernel@xxxxxxxxx> writes:
> In copy_ref_data(), struct cache_entry *ce has its fields populated
> at the beginning of the function. Later, if alloc_target fails with
> an ERR_PTR, free_tgts() is called on the cache, leaving the cache
> metadata populated without any targets. Critically, this extends
> ce->etime, making the cache appear valid for longer without any
> targets.
>
> Also, free_tgts() does not set ce->numtgts to zero. On error, when
> the cache is freed, ce->numtgts is not zeroed, and other cache users
> may attempt to access nonexistent entries.
>
> Update fields after copying targets to prevent partial-state updates.
> Set ce->numtgts to zero at the end of free_tgts().
> ...
Applied.