linux/drivers/staging/zcache
Piotr Sarna 02073798a6 staging: zcache: fix "zcache=" kernel parameter
Commit 835f2f5 ("staging: zcache: enable zcache to be built/loaded as
a module") introduced an incorrect handling of "zcache=" parameter.

Inside zcache_comp_init() function, zcache_comp_name variable is
checked for being empty. If not empty, the above variable is tested
for being compatible with Crypto API. Unfortunately, after that
function ends unconditionally (by the "goto out" directive) and returns:
- non-zero value if verification succeeded, wrongly indicating an error
- zero value if verification failed, falsely informing that function
  zcache_comp_init() ended properly.

A solution to this problem is as following:
1. Move the "goto out" directive inside the "if (!ret)" statement
2. In case that crypto_has_comp() returned 0, change the value of ret
   to non-zero before "goto out" to indicate an error.

This patch replaces an earlier one from Michal Hocko (based on report
from Cristian Rodriguez):

	http://permalink.gmane.org/gmane.linux.kernel.mm/102484

It also addressed the same issue but didn't fix the zcache_comp_init()
for case when the compressor data passed to "zcache=" option was invalid
or unsupported.

Signed-off-by: Piotr Sarna <p.sarna@partner.samsung.com>
[bzolnier: updated patch description]
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: stable <stable@vger.kernel.org> # 3.10
Cc: Cristian Rodriguez <crrodriguez@opensuse.org>
Cc: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-29 11:45:09 -07:00
..
ramster drivers: staging: zcache: fix compile error 2013-05-30 21:14:30 +09:00
debug.c staging: zcache: introduce zero-filled page stat count 2013-04-03 13:38:37 -07:00
debug.h staging: zcache/debug: fix coding style 2013-04-13 06:29:00 -07:00
Kconfig staging: zcache: enable zcache to be built/loaded as a module 2013-04-30 17:04:01 -07:00
Makefile staging: ramster/debug: Add CONFIG_RAMSTER_DEBUG Kconfig entry 2013-04-13 06:27:09 -07:00
ramster.h drivers: staging: zcache: fix compile error 2013-05-30 21:14:30 +09:00
tmem.c staging: zcache: enable zcache to be built/loaded as a module 2013-04-30 17:04:01 -07:00
tmem.h staging: zcache: enable zcache to be built/loaded as a module 2013-04-30 17:04:01 -07:00
TODO staging: zcache: clean TODO list 2013-04-03 13:38:37 -07:00
zbud.c drivers: staging: zcache: fix compile error 2013-04-02 12:43:41 -07:00
zbud.h staging: zcache: rename ramster to zcache 2013-01-18 13:43:44 -08:00
zcache-main.c staging: zcache: fix "zcache=" kernel parameter 2013-07-29 11:45:09 -07:00
zcache.h staging: zcache: enable zcache to be built/loaded as a module 2013-04-30 17:04:01 -07:00