]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.fixes/reiserfs-error-buffer-locking
Move xen patchset to new version's subdir.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / reiserfs-error-buffer-locking
diff --git a/src/patches/suse-2.6.27.31/patches.fixes/reiserfs-error-buffer-locking b/src/patches/suse-2.6.27.31/patches.fixes/reiserfs-error-buffer-locking
new file mode 100644 (file)
index 0000000..d82714d
--- /dev/null
@@ -0,0 +1,41 @@
+From: Jeff Mahoney <jeffm@suse.com>
+Subject: [PATCH] reiserfs: add locking around error buffer
+
+ The formatting of the error buffer is race prone. It uses static buffers
+ for both formatting and output. While overwriting the error buffer
+ can product garbled output, overwriting the format buffer with incompatible
+ % directives can cause crashes.
+
+Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+---
+ fs/reiserfs/prints.c |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/fs/reiserfs/prints.c
++++ b/fs/reiserfs/prints.c
+@@ -184,7 +184,7 @@ static char *is_there_reiserfs_struct(ch
+    printk ("bad key %lu %lu %lu %lu", key->k_dir_id, key->k_objectid,
+            key->k_offset, key->k_uniqueness);
+ */
+-
++static DEFINE_SPINLOCK(error_lock);
+ static void prepare_error_buf(const char *fmt, va_list args)
+ {
+       char *fmt1 = fmt_buf;
+@@ -192,6 +192,8 @@ static void prepare_error_buf(const char
+       char *p = error_buf;
+       int what;
++      spin_lock(&error_lock);
++
+       strcpy(fmt1, fmt);
+       while ((k = is_there_reiserfs_struct(fmt1, &what)) != NULL) {
+@@ -237,6 +239,7 @@ static void prepare_error_buf(const char
+               fmt1 = k + 2;
+       }
+       vsprintf(p, fmt1, args);
++      spin_unlock(&error_lock);
+ }