]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
UBIFS: fix double free of ubifs_orphan objects
authorAdam Thomas <adamthomas1111@gmail.com>
Sat, 2 Feb 2013 22:35:08 +0000 (22:35 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Mar 2014 23:10:05 +0000 (16:10 -0700)
commit8a4188e2d84ab2ec720f29ede1799a6882969857
tree5eeabcf01e6872d2eca29c0de4aa7d4ac3e6ba44
parentebdc12a0b5ed501c23b52b1ab5d28aea681badcd
UBIFS: fix double free of ubifs_orphan objects

commit 8afd500cb52a5d00bab4525dd5a560d199f979b9 upstream.

The last orphan in the dnext list has its dnext set to NULL. Because
of that, ubifs_delete_orphan assumes that it is not on the dnext list
and frees it immediately instead ignoring it as a second delete. The
orphan is later freed again by erase_deleted.

This change adds an explicit flag to ubifs_orphan indicating whether
it is pending delete.

Signed-off-by: Adam Thomas <adamthomas1111@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Rui Xiang <rui.xiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ubifs/orphan.c
fs/ubifs/ubifs.h