diff options
author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2015-08-14 15:35:19 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-08-14 15:56:32 -0700 |
commit | 4ce321f574a97f3453bca5a4117610b43dabd3ee (patch) | |
tree | 0d615f7abf1f080f541a031015f24e7acfbee777 /mm/cma.h | |
parent | f9126ab9241f66562debf69c2c9d8fee32ddcc53 (diff) | |
download | linux-stable-4ce321f574a97f3453bca5a4117610b43dabd3ee.tar.gz linux-stable-4ce321f574a97f3453bca5a4117610b43dabd3ee.tar.bz2 linux-stable-4ce321f574a97f3453bca5a4117610b43dabd3ee.zip |
zram: fix pool name truncation
zram_meta_alloc() constructs a pool name for zs_create_pool() call as
snprintf(pool_name, sizeof(pool_name), "zram%d", device_id);
However, it defines pool name buffer to be only 8 bytes long (minus
trailing zero), which means that we can have only 1000 pool names: zram0
-- zram999.
With CONFIG_ZSMALLOC_STAT enabled an attempt to create a device zram1000
can fail if device zram100 already exists, because snprintf() will
truncate new pool name to zram100 and pass it debugfs_create_dir(),
causing:
debugfs dir <zram100> creation failed
zram: Error creating memory pool
... and so on.
Fix it by passing zram->disk->disk_name to zram_meta_alloc() instead of
divice_id. We construct zram%d name earlier and keep it as a ->disk_name,
no need to snprintf() it again.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/cma.h')
0 files changed, 0 insertions, 0 deletions