android_kernel_oneplus_msm8998/net/nfc/nci
Johan Hovold f4d41096f4 NFC: fix broken device allocation
commit 20777bc57c346b6994f465e0d8261a7fbf213a09 upstream.

Commit 7eda8b8e96 ("NFC: Use IDR library to assing NFC devices IDs")
moved device-id allocation and struct-device initialisation from
nfc_allocate_device() to nfc_register_device().

This broke just about every nfc-device-registration error path, which
continue to call nfc_free_device() that tries to put the device
reference of the now uninitialised (but zeroed) struct device:

kobject: '(null)' (ce316420): is not initialized, yet kobject_put() is being called.

The late struct-device initialisation also meant that various work
queues whose names are derived from the nfc device name were also
misnamed:

  421 root         0 SW<  [(null)_nci_cmd_]
  422 root         0 SW<  [(null)_nci_rx_w]
  423 root         0 SW<  [(null)_nci_tx_w]

Move the id-allocation and struct-device initialisation back to
nfc_allocate_device() and fix up the single call site which did not use
nfc_free_device() in its error path.

Fixes: 7eda8b8e96 ("NFC: Use IDR library to assing NFC devices IDs")
Cc: Samuel Ortiz <sameo@linux.intel.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>
2017-07-27 15:06:03 -07:00
..
core.c NFC: fix broken device allocation 2017-07-27 15:06:03 -07:00
data.c NFC: nci: Add function to get max packet size for conn 2015-10-25 19:11:42 +01:00
hci.c NFC: st-nci: Add few code style fixes 2015-10-27 03:55:13 +01:00
Kconfig NFC: NCI: move generic spi driver to a module 2015-10-27 04:21:38 +01:00
lib.c nfc: Fix FSF address in file headers 2013-12-11 10:56:21 -05:00
Makefile NFC: NCI: move generic spi driver to a module 2015-10-27 04:21:38 +01:00
ntf.c NFC: nci: Allow the driver to set handler for core nci ops 2015-10-25 19:12:57 +01:00
rsp.c NFC: nci: Allow the driver to set handler for core nci ops 2015-10-25 19:12:57 +01:00
spi.c NFC: NCI: allow spi driver to choose transfer clock 2015-10-27 04:23:34 +01:00
uart.c NFC: nci: fix mistake in uart generic driver 2015-06-15 18:10:37 +02:00