UBIFS: Fix potential integer overflow in allocation
authorSilvio Cesare <silvio.cesare@gmail.com>
Fri, 4 May 2018 03:44:02 +0000 (13:44 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Jul 2018 09:24:59 +0000 (11:24 +0200)
commitb7261fc5f5748b3f6f1a839dbc5a744b8871dfcd
tree1e1ec8d6f4bc32c243ad123af8c018054dcce57f
parenta23cf10d9abb04652ec2daf93d494dc0e2cd835f
UBIFS: Fix potential integer overflow in allocation

commit 353748a359f1821ee934afc579cf04572406b420 upstream.

There is potential for the size and len fields in ubifs_data_node to be
too large causing either a negative value for the length fields or an
integer overflow leading to an incorrect memory allocation. Likewise,
when the len field is small, an integer underflow may occur.

Signed-off-by: Silvio Cesare <silvio.cesare@gmail.com>
Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ubifs/journal.c