linux/drivers/firmware/xilinx
Jann Horn b9472f7d82 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>
2019-03-18 13:43:54 +01:00
..
Kconfig drivers: soc: xilinx: Add ZynqMP power domain driver 2019-02-12 13:38:16 +01:00
Makefile firmware: xilinx: Add debugfs interface 2018-09-26 08:47:35 +02:00
zynqmp-debug.c firmware: xilinx: fix debugfs write handler 2019-03-18 13:43:54 +01:00
zynqmp-debug.h firmware: xilinx: Add debugfs interface 2018-09-26 08:47:35 +02:00
zynqmp.c drivers: soc: xilinx: Add ZynqMP power domain driver 2019-02-12 13:38:16 +01:00