Commit edb23125 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 59d2c635 beca3e31
...@@ -126,6 +126,7 @@ config PSTORE_CONSOLE ...@@ -126,6 +126,7 @@ config PSTORE_CONSOLE
config PSTORE_PMSG config PSTORE_PMSG
bool "Log user space messages" bool "Log user space messages"
depends on PSTORE depends on PSTORE
select RT_MUTEXES
help help
When the option is enabled, pstore will export a character When the option is enabled, pstore will export a character
interface /dev/pmsg0 to log user space messages. On reboot interface /dev/pmsg0 to log user space messages. On reboot
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/rtmutex.h>
#include "internal.h" #include "internal.h"
static DEFINE_MUTEX(pmsg_lock); static DEFINE_RT_MUTEX(pmsg_lock);
static ssize_t write_pmsg(struct file *file, const char __user *buf, static ssize_t write_pmsg(struct file *file, const char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
...@@ -28,9 +29,9 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf, ...@@ -28,9 +29,9 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,
if (!access_ok(buf, count)) if (!access_ok(buf, count))
return -EFAULT; return -EFAULT;
mutex_lock(&pmsg_lock); rt_mutex_lock(&pmsg_lock);
ret = psinfo->write_user(&record, buf); ret = psinfo->write_user(&record, buf);
mutex_unlock(&pmsg_lock); rt_mutex_unlock(&pmsg_lock);
return ret ? ret : count; return ret ? ret : count;
} }
......
...@@ -680,7 +680,7 @@ static int ramoops_parse_dt(struct platform_device *pdev, ...@@ -680,7 +680,7 @@ static int ramoops_parse_dt(struct platform_device *pdev,
field = value; \ field = value; \
} }
parse_u32("mem-type", pdata->record_size, pdata->mem_type); parse_u32("mem-type", pdata->mem_type, pdata->mem_type);
parse_u32("record-size", pdata->record_size, 0); parse_u32("record-size", pdata->record_size, 0);
parse_u32("console-size", pdata->console_size, 0); parse_u32("console-size", pdata->console_size, 0);
parse_u32("ftrace-size", pdata->ftrace_size, 0); parse_u32("ftrace-size", pdata->ftrace_size, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment