linux/net/nfc
Johan Hovold 38af0e73a8 NFC: fix broken device allocation
commit 20777bc57c 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>
[bwh: Backported to 3.16: drop change in nci_allocate_device()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2017-10-12 15:27:50 +01:00
..
hci NFC: hci: Fix sparse: cast to restricted __be16 2014-04-22 00:37:29 +02:00
nci NFC: NCI: Send all NCI frames to raw sockets 2014-05-20 00:23:59 +02:00
af_nfc.c nfc: Fix FSF address in file headers 2013-12-11 10:56:21 -05:00
core.c NFC: fix broken device allocation 2017-10-12 15:27:50 +01:00
digital.h NFC: digital: Add support for ISO/IEC 14443-B Protocol 2014-04-22 00:37:28 +02:00
digital_core.c NFC: digital: Randomize poll cycles 2014-05-26 00:42:02 +02:00
digital_dep.c NFC: digital: Return proper error code when sending ATR_REQ 2014-05-26 00:42:02 +02:00
digital_technology.c NFC: digital: digital_in_send_attrib_req() can be static 2014-05-26 00:52:15 +02:00
Kconfig NFC Digital: Add NFC-F technology support 2013-09-25 02:02:25 +02:00
llcp.h nfc: Fix FSF address in file headers 2013-12-11 10:56:21 -05:00
llcp_commands.c NFC: Add RAW socket type support for SOCKPROTO_RAW 2014-05-20 00:06:04 +02:00
llcp_core.c net: add __pskb_copy_fclone and pskb_copy_for_clone 2014-06-11 15:38:02 -07:00
llcp_sock.c net: add build-time checks for msg->msg_name size 2014-01-18 23:04:16 -08:00
Makefile NFC Digital: Add initiator NFC-DEP support 2013-09-25 02:02:27 +02:00
netlink.c NFC: Add netlink support for ISO/IEC 15693 2014-02-16 23:49:53 +01:00
nfc.h NFC: Add RAW socket type support for SOCKPROTO_RAW 2014-05-20 00:06:04 +02:00
rawsock.c net: add __pskb_copy_fclone and pskb_copy_for_clone 2014-06-11 15:38:02 -07:00