mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 12:52:29 -04:00
smb: client: clear ce->tgthint in free_tgts()
When free_tgts() frees all structures in ce->tlist, ce->tgthint
is left pointing to one of the freed cache_dfs_tgt structures.
If ce->tgthint is not reset before it is used later, it results
in a use-after-free.
Set ce->tgthint to NULL in free_tgts() after the elements are
freed to reflect that no elements remain.
Fixes: 54be1f6c1c ("cifs: Add DFS cache routines")
Cc: stable@vger.kernel.org # depends on: smb: client: harden DFS cache against invalid target hints
Signed-off-by: Fredric Cover <fredric.cover.lkernel@gmail.com>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
This commit is contained in:
committed by
Paulo Alcantara
parent
bf86c08123
commit
b1b741cf8e
@@ -122,6 +122,8 @@ static inline void free_tgts(struct cache_entry *ce)
|
||||
kfree(t->name);
|
||||
kfree(t);
|
||||
}
|
||||
|
||||
WRITE_ONCE(ce->tgthint, NULL);
|
||||
}
|
||||
|
||||
static inline void flush_cache_ent(struct cache_entry *ce)
|
||||
|
||||
Reference in New Issue
Block a user