summaryrefslogtreecommitdiffstats
path: root/mm/hugetlb_cgroup.c
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2015-08-14 15:35:19 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2015-08-14 15:56:32 -0700
commit4ce321f574a97f3453bca5a4117610b43dabd3ee (patch)
tree0d615f7abf1f080f541a031015f24e7acfbee777 /mm/hugetlb_cgroup.c
parentf9126ab9241f66562debf69c2c9d8fee32ddcc53 (diff)
downloadlinux-4ce321f574a97f3453bca5a4117610b43dabd3ee.tar.gz
linux-4ce321f574a97f3453bca5a4117610b43dabd3ee.tar.bz2
linux-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/hugetlb_cgroup.c')
0 files changed, 0 insertions, 0 deletions