]> www.infradead.org Git - users/dwmw2/linux.git/commit
ubifs: wbuf: Don't leak kernel memory to flash
authorRichard Weinberger <richard@nod.at>
Mon, 16 Nov 2020 21:05:30 +0000 (22:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jan 2021 12:58:59 +0000 (13:58 +0100)
commit2c3747b1a8b41a8b35e21071242bf6bd1e7b5203
treed81e76b58bc892cdf4c3f924839ddc95d958d815
parent8746ab6ce5f321e3b33841078b2cf6bf3a63a89d
ubifs: wbuf: Don't leak kernel memory to flash

commit 20f1431160c6b590cdc269a846fc5a448abf5b98 upstream

Write buffers use a kmalloc()'ed buffer, they can leak
up to seven bytes of kernel memory to flash if writes are not
aligned.
So use ubifs_pad() to fill these gaps with padding bytes.
This was never a problem while scanning because the scanner logic
manually aligns node lengths and skips over these gaps.

Cc: <stable@vger.kernel.org>
Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
[sudip: adjust context]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ubifs/io.c