]> git.baikalelectronics.ru Git - kernel.git/commit
zswap: potential NULL dereference on error in init_zswap()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 31 Jan 2020 06:15:07 +0000 (22:15 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 31 Jan 2020 18:30:39 +0000 (10:30 -0800)
commit8c1c6d1ac8f4aa79795eac9e61e9a7824a05e22a
tree07073e33afe6e5bdf8a9de955bc3366150c6e808
parentb0416ce7be9f8d65098054b2b15ed480e74d229a
zswap: potential NULL dereference on error in init_zswap()

The "pool" pointer can be NULL at the end of the init_zswap().  (We
would allocate a new pool later in that situation)

So in the error handling then we need to make sure pool is a valid
pointer before calling "zswap_pool_destroy(pool);" because that function
dereferences the argument.

Link: http://lkml.kernel.org/r/20200114050902.og32fkllkod5ycf5@kili.mountain
Fixes: 93d4dfa9fbd0 ("mm/zswap.c: add allocation hysteresis if pool limit is hit")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/zswap.c