diff options
author | Jann Horn <jannh@google.com> | 2019-02-18 22:43:09 +0100 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2019-03-18 13:43:54 +0100 |
commit | b9472f7d8224460499dd7128ec944735ed5345a0 (patch) | |
tree | f2410aed6f9d4aaaf3d299d62fc5caae126a6080 /drivers/soc | |
parent | 9e98c678c2d6ae3a17cb2de55d17f69dddaa231b (diff) | |
download | linux-b9472f7d8224460499dd7128ec944735ed5345a0.tar.gz linux-b9472f7d8224460499dd7128ec944735ed5345a0.tar.bz2 linux-b9472f7d8224460499dd7128ec944735ed5345a0.zip |
firmware: xilinx: fix debugfs write handler
- Userspace wants to write a string with `len` bytes, not counting the
terminating NULL, so we should allocate `len+1` bytes. It looks like the
current code relied on having a nullbyte directly behind `kern_buff`,
which happens to work reliably as long as `len` isn't one of the kmalloc
size classes.
- strncpy_from_user() is completely wrong here; userspace is giving us a
(not necessarily null-terminated) buffer and its length.
strncpy_from_user() is for cases in which we don't know the length.
- Don't let broken userspace allocate arbitrarily big kmalloc allocations.
Just use memdup_user_nul(), which is designed precisely for things like
this.
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Jolly Shah <jolly.shah@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'drivers/soc')
0 files changed, 0 insertions, 0 deletions