mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
ep93xx: clock: Fix UAF in ep93xx_clk_register_gate()
commit3b68b08885
upstream. arch/arm/mach-ep93xx/clock.c:154:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc] arch/arm/mach-ep93xx/clock.c:151:2: note: Taking true branch if (IS_ERR(clk)) ^ arch/arm/mach-ep93xx/clock.c:152:3: note: Memory is released kfree(psc); ^~~~~~~~~~ arch/arm/mach-ep93xx/clock.c:154:2: note: Use of memory after it is freed return &psc->hw; ^ ~~~~~~~~ Fixes:9645ccc7bd
("ep93xx: clock: convert in-place to COMMON_CLK") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Cc: stable@vger.kernel.org Link: https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/B5YCO2NJEXINCYE26Y255LCVMO55BGWW/ Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c5628533a3
commit
0f12166872
1 changed files with 3 additions and 1 deletions
|
@ -148,8 +148,10 @@ static struct clk_hw *ep93xx_clk_register_gate(const char *name,
|
|||
psc->lock = &clk_lock;
|
||||
|
||||
clk = clk_register(NULL, &psc->hw);
|
||||
if (IS_ERR(clk))
|
||||
if (IS_ERR(clk)) {
|
||||
kfree(psc);
|
||||
return ERR_CAST(clk);
|
||||
}
|
||||
|
||||
return &psc->hw;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue