stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "f2fs: fix overflow due to condition check order" has been added to the 4.8-stable tree
@ 2017-01-04 10:06 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-01-04 10:06 UTC (permalink / raw)
  To: jaegeuk, gregkh; +Cc: stable, stable-commits


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 <stable@vger.kernel.org> know about it.


>From e87f7329bbd6760c2acc4f1eb423362b08851a71 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@kernel.org>
Date: Wed, 23 Nov 2016 10:51:17 -0800
Subject: f2fs: fix overflow due to condition check order

From: Jaegeuk Kim <jaegeuk@kernel.org>

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")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/f2fs/file.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -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 jaegeuk@kernel.org 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-04 10:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04 10:06 Patch "f2fs: fix overflow due to condition check order" has been added to the 4.8-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).