This is a note to let you know that I've just added the patch titled
UBIFS: fix oops when R/O file-system is fsync'ed
to the 2.6.38-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:
ubifs-fix-oops-when-r-o-file-system-is-fsync-ed.patch
and it can be found in the queue-2.6.38 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From 78530bf7f2559b317c04991b52217c1608d5a58d Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy <[email protected]>
Date: Wed, 13 Apr 2011 10:31:52 +0300
Subject: UBIFS: fix oops when R/O file-system is fsync'ed
From: Artem Bityutskiy <[email protected]>
commit 78530bf7f2559b317c04991b52217c1608d5a58d upstream.
This patch fixes severe UBIFS bug: UBIFS oopses when we 'fsync()' an
file on R/O-mounter file-system. We (the UBIFS authors) incorrectly
thought that VFS would not propagate 'fsync()' down to the file-system
if it is read-only, but this is not the case.
It is easy to exploit this bug using the following simple perl script:
use strict;
use File::Sync qw(fsync sync);
die "File path is not specified" if not defined $ARGV[0];
my $path = $ARGV[0];
open FILE, "<", "$path" or die "Cannot open $path: $!";
fsync(\*FILE) or die "cannot fsync $path: $!";
close FILE or die "Cannot close $path: $!";
Thanks to Reuben Dowle <[email protected]> for reporting about this
issue.
Signed-off-by: Artem Bityutskiy <[email protected]>
Reported-by: Reuben Dowle <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
fs/ubifs/file.c | 3 +++
1 file changed, 3 insertions(+)
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1309,6 +1309,9 @@ int ubifs_fsync(struct file *file, int d
dbg_gen("syncing inode %lu", inode->i_ino);
+ if (inode->i_sb->s_flags & MS_RDONLY)
+ return 0;
+
/*
* VFS has already synchronized dirty pages for this inode. Synchronize
* the inode unless this is a 'datasync()' call.
Patches currently in stable-queue which might be from
[email protected] are
queue-2.6.38/ubifs-fix-assertion-warnings.patch
queue-2.6.38/ubifs-fix-oops-when-r-o-file-system-is-fsync-ed.patch
queue-2.6.38/ubifs-restrict-world-writable-debugfs-files.patch
_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable