Commit 0d765021 authored by Baokun Li's avatar Baokun Li Committed by Richard Weinberger
Browse files

ubifs: fix double return leb in ubifs_garbage_collect



If ubifs_garbage_collect_leb() returns -EAGAIN and enters the "out"
branch, ubifs_return_leb will execute twice on the same lnum. This
can cause data loss in concurrency situations.

Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 88618fee
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -758,6 +758,8 @@ int ubifs_garbage_collect(struct ubifs_info *c, int anyway)
				err = ubifs_return_leb(c, lp.lnum);
				if (err)
					ret = err;
				/*  Maybe double return LEB if goto out */
				lp.lnum = -1;
				break;
			}
			goto out;