From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx> This was: nvmem/gpio: fix resource management. These are the remaining patches from the series aimed at fixing resource management problems in nvmem. The first one adds a new descriptor validation macro. The second uses kref to add reference counting to GPIO descriptors. The last one fixes a potential use-after-free problem in nvmem. The last change should actually go into v5.6 but it depends on a new feature. I'm not sure how to go about applying this. Changes in patch 2/3 since the last submission: - add a stub for when GPIOLIB is not selected - use might_sleep() in gpiod_put() as we may not necessarily call gpiod_free() every time now (where it would have been called normally) depending on the reference count Bartosz Golaszewski (3): gpiolib: provide VALIDATE_DESC_PTR() macro gpiolib: use kref in gpio_desc nvmem: increase the reference count of a gpio passed over config drivers/gpio/gpiolib.c | 48 ++++++++++++++++++++++++++++++++--- drivers/gpio/gpiolib.h | 1 + drivers/nvmem/core.c | 2 +- include/linux/gpio/consumer.h | 9 +++++++ 4 files changed, 55 insertions(+), 5 deletions(-) -- 2.25.0