summary refs log tree commit diff
path: root/fs/fscache
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2023-01-27 10:40:10 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-09 11:28:24 +0100
commit39708bc8da7858de0bed9b3a88b3beb1d1e0b443 (patch)
tree29d8a9a2393154f1956c3d5286dd97bc2930b559 /fs/fscache
parent1e2a745a896ec220a9f22f000f64f0f778991414 (diff)
downloadlinux-39708bc8da7858de0bed9b3a88b3beb1d1e0b443.tar.gz
nvmem: core: fix cleanup after dev_set_name()
commit 560181d3ace61825f4ca9dd3481d6c0ee6709fa8 upstream.

If dev_set_name() fails, we leak nvmem->wp_gpio as the cleanup does not
put this. While a minimal fix for this would be to add the gpiod_put()
call, we can do better if we split device_register(), and use the
tested nvmem_release() cleanup code by initialising the device early,
and putting the device.

This results in a slightly larger fix, but results in clear code.

Note: this patch depends on "nvmem: core: initialise nvmem->id early"
and "nvmem: core: remove nvmem_config wp_gpio".

Fixes: 5544e90c8126 ("nvmem: core: add error handling for dev_set_name")
Cc: stable@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
[Srini: Fixed subject line and error code handing with wp_gpio while applying.]
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230127104015.23839-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/fscache')
0 files changed, 0 insertions, 0 deletions