Re: [PATCH v2 2/3] nvmem: check for NULL reg_read and reg_write before dereferencing

From: Srinivas Kandagatla
Date: Thu Mar 05 2020 - 12:03:24 EST




On 02/03/2020 15:43, Nicholas Johnson wrote:
Return -EPERM if reg_read is NULL in bin_attr_nvmem_read() or if
reg_write is NULL in bin_attr_nvmem_write().

This prevents NULL dereferences such as the one described in
03cd45d2e219 ("thunderbolt: Prevent crash if non-active NVMem file is
read")

Signed-off-by: Nicholas Johnson <nicholas.johnson-opensource@xxxxxxxxxxxxxx>
---
drivers/nvmem/nvmem-sysfs.c | 6 ++++++
1 file changed, 6 insertions(+)


Applied thanks,
--srini