1 From: Jeff Mahoney <jeffm@suse.com>
2 Subject: [PATCH] reiserfs: add locking around error buffer
4 The formatting of the error buffer is race prone. It uses static buffers
5 for both formatting and output. While overwriting the error buffer
6 can product garbled output, overwriting the format buffer with incompatible
7 % directives can cause crashes.
9 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
11 fs/reiserfs/prints.c | 5 ++++-
12 1 file changed, 4 insertions(+), 1 deletion(-)
14 --- a/fs/reiserfs/prints.c
15 +++ b/fs/reiserfs/prints.c
16 @@ -184,7 +184,7 @@ static char *is_there_reiserfs_struct(ch
17 printk ("bad key %lu %lu %lu %lu", key->k_dir_id, key->k_objectid,
18 key->k_offset, key->k_uniqueness);
21 +static DEFINE_SPINLOCK(error_lock);
22 static void prepare_error_buf(const char *fmt, va_list args)
25 @@ -192,6 +192,8 @@ static void prepare_error_buf(const char
29 + spin_lock(&error_lock);
33 while ((k = is_there_reiserfs_struct(fmt1, &what)) != NULL) {
34 @@ -237,6 +239,7 @@ static void prepare_error_buf(const char
37 vsprintf(p, fmt1, args);
38 + spin_unlock(&error_lock);