Skip to content

Commit edb2312

Browse files
committed
Merge tag 'pstore-v6.2-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull pstore fixes from Kees Cook: - Switch pmsg_lock to an rt_mutex to avoid priority inversion (John Stultz) - Correctly assign mem_type property (Luca Stefani) * tag 'pstore-v6.2-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: pstore: Properly assign mem_type property pstore: Make sure CONFIG_PSTORE_PMSG selects CONFIG_RT_MUTEXES pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion
2 parents 59d2c63 + beca3e3 commit edb2312

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

fs/pstore/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ config PSTORE_CONSOLE
126126
config PSTORE_PMSG
127127
bool "Log user space messages"
128128
depends on PSTORE
129+
select RT_MUTEXES
129130
help
130131
When the option is enabled, pstore will export a character
131132
interface /dev/pmsg0 to log user space messages. On reboot

fs/pstore/pmsg.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
#include <linux/device.h>
88
#include <linux/fs.h>
99
#include <linux/uaccess.h>
10+
#include <linux/rtmutex.h>
1011
#include "internal.h"
1112

12-
static DEFINE_MUTEX(pmsg_lock);
13+
static DEFINE_RT_MUTEX(pmsg_lock);
1314

1415
static ssize_t write_pmsg(struct file *file, const char __user *buf,
1516
size_t count, loff_t *ppos)
@@ -28,9 +29,9 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,
2829
if (!access_ok(buf, count))
2930
return -EFAULT;
3031

31-
mutex_lock(&pmsg_lock);
32+
rt_mutex_lock(&pmsg_lock);
3233
ret = psinfo->write_user(&record, buf);
33-
mutex_unlock(&pmsg_lock);
34+
rt_mutex_unlock(&pmsg_lock);
3435
return ret ? ret : count;
3536
}
3637

fs/pstore/ram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ static int ramoops_parse_dt(struct platform_device *pdev,
680680
field = value; \
681681
}
682682

683-
parse_u32("mem-type", pdata->record_size, pdata->mem_type);
683+
parse_u32("mem-type", pdata->mem_type, pdata->mem_type);
684684
parse_u32("record-size", pdata->record_size, 0);
685685
parse_u32("console-size", pdata->console_size, 0);
686686
parse_u32("ftrace-size", pdata->ftrace_size, 0);

0 commit comments

Comments
 (0)