Skip to contentSkip to conversation

Patch "f2fs: fix overflow due to condition check order" has been added to the 4.8-stable tree

PATCH [email protected] 1 participant 1 message Jan 4, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

f2fs: fix overflow due to condition check order

to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
f2fs-fix-overflow-due-to-condition-check-order.patch
and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From e87f7329bbd6760c2acc4f1eb423362b08851a71 Mon Sep 17 00:00:00 2001

From: Jaegeuk Kim <[email protected]>
Date: Wed, 23 Nov 2016 10:51:17 -0800
Subject: f2fs: fix overflow due to condition check order

From: Jaegeuk Kim <[email protected]>

commit e87f7329bbd6760c2acc4f1eb423362b08851a71 upstream.

In the last ilen case, i was already increased, resulting in accessing out- of-boundary entry of do_replace and blkaddr.
Fix to check ilen first to exit the loop.

Fixes 2aa8fbb9693020 ("f2fs: refactor __exchange_data_block for speed up")
---
 fs/f2fs/file.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/file.c +1 -1
@@ -970,7 +970,7 @@ static int __clone_blkaddrs(struct inode
 				new_size = (dst + i) << PAGE_SHIFT;
 				if (dst_inode->i_size < new_size)
 					f2fs_i_size_write(dst_inode, new_size);
-			} while ((do_replace[i] || blkaddr[i] == NULL_ADDR) && --ilen);
+			} while (--ilen && (do_replace[i] || blkaddr[i] == NULL_ADDR));
 
 			f2fs_put_dnode(&dn);
 		} else {

Patches currently in stable-queue which might be from [email protected] are

queue-4.8/f2fs-fix-overflow-due-to-condition-check-order.patch queue-4.8/revert-f2fs-use-percpu_counter-for-of-dirty-pages-in-inode.patch queue-4.8/f2fs-set-owner-for-debugfs-status-file-s-file_operations.patch