diff options
author | Johan Hovold <johan@kernel.org> | 2017-03-30 10:15:37 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-07-27 22:07:56 (GMT) |
commit | 4b4f74d6c4f801aee5add0cab1d68904e6141380 (patch) | |
tree | 1eefba0e8e6d6ffcd9a63036642353f72c7dc941 /net/sysctl_net.c | |
parent | 7de6ff402dd02cbfc6b963068efd6efecc0e4978 (diff) | |
download | linux-4b4f74d6c4f801aee5add0cab1d68904e6141380.tar.xz |
NFC: nfcmrvl: do not use device-managed resources
commit 0cbe40112f42cf5e008f9127f6cd5952ba3946c7 upstream.
This specifically fixes resource leaks in the registration error paths.
Device-managed resources is a bad fit for this driver as devices can be
registered from the n_nci line discipline. Firstly, a tty may not even
have a corresponding device (should it be part of a Unix98 pty)
something which would lead to a NULL-pointer dereference when
registering resources.
Secondly, if the tty has a class device, its lifetime exceeds that of
the line discipline, which means that resources would leak every time
the line discipline is closed (or if registration fails).
Currently, the devres interface was only being used to request a reset
gpio despite the fact that it was already explicitly freed in
nfcmrvl_nci_unregister_dev() (along with the private data), something
which also prevented the resource leak at close.
Note that the driver treats gpio number 0 as invalid despite it being
perfectly valid. This will be addressed in a follow-up patch.
Fixes: b2fe288eac72 ("NFC: nfcmrvl: free reset gpio")
Fixes: 4a2b947f56b3 ("NFC: nfcmrvl: add chip reset management")
Cc: Vincent Cuissard <cuissard@marvell.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sysctl_net.c')
0 files changed, 0 insertions, 0 deletions