]> git.baikalelectronics.ru Git - kernel.git/commit
ubifs: Don't leak kernel memory to the MTD
authorRichard Weinberger <richard@nod.at>
Fri, 16 Jun 2017 14:21:44 +0000 (16:21 +0200)
committerRichard Weinberger <richard@nod.at>
Fri, 14 Jul 2017 20:50:52 +0000 (22:50 +0200)
commitc9f246d548d719a4e1cd82c989c5f2d66e1c0c63
treef352b5b37c1f1da4f73e2e8c1bccea9b05c767dd
parentcf23354f782000af9597ae18643eccedba2c0ea7
ubifs: Don't leak kernel memory to the MTD

When UBIFS prepares data structures which will be written to the MTD it
ensues that their lengths are multiple of 8. Since it uses kmalloc() the
padded bytes are left uninitialized and we leak a few bytes of kernel
memory to the MTD.
To make sure that all bytes are initialized, let's switch to kzalloc().
Kzalloc() is fine in this case because the buffers are not huge and in
the IO path the performance bottleneck is anyway the MTD.

Cc: stable@vger.kernel.org
Fixes: 974763da840d ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/journal.c