public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Jeremy Cline <jeremy@jcline.org>,
	Simon Horman <horms@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	syzbot+c1d0a03d305972dbbe14@syzkaller.appspotmail.com
Subject: [PATCH 5.15 49/75] net: nfc: llcp: Add lock when modifying device list
Date: Mon,  9 Oct 2023 15:02:11 +0200	[thread overview]
Message-ID: <20231009130112.953066738@linuxfoundation.org> (raw)
In-Reply-To: <20231009130111.200710898@linuxfoundation.org>

5.15-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jeremy Cline <jeremy@jcline.org>

[ Upstream commit dfc7f7a988dad34c3bf4c053124fb26aa6c5f916 ]

The device list needs its associated lock held when modifying it, or the
list could become corrupted, as syzbot discovered.

Reported-and-tested-by: syzbot+c1d0a03d305972dbbe14@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=c1d0a03d305972dbbe14
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Fixes: 6709d4b7bc2e ("net: nfc: Fix use-after-free caused by nfc_llcp_find_local")
Link: https://lore.kernel.org/r/20230908235853.1319596-1-jeremy@jcline.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/nfc/llcp_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c
index ddfd159f64e13..b1107570eaee8 100644
--- a/net/nfc/llcp_core.c
+++ b/net/nfc/llcp_core.c
@@ -1646,7 +1646,9 @@ int nfc_llcp_register_device(struct nfc_dev *ndev)
 	timer_setup(&local->sdreq_timer, nfc_llcp_sdreq_timer, 0);
 	INIT_WORK(&local->sdreq_timeout_work, nfc_llcp_sdreq_timeout_work);
 
+	spin_lock(&llcp_devices_lock);
 	list_add(&local->list, &llcp_devices);
+	spin_unlock(&llcp_devices_lock);
 
 	return 0;
 }
-- 
2.40.1




  parent reply	other threads:[~2023-10-09 13:26 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09 13:01 [PATCH 5.15 00/75] 5.15.135-rc1 review Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 01/75] spi: zynqmp-gqspi: Convert to platform remove callback returning void Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 02/75] spi: zynqmp-gqspi: fix clock imbalance on probe failure Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 03/75] ASoC: soc-utils: Export snd_soc_dai_is_dummy() symbol Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 04/75] ASoC: tegra: Fix redundant PLLA and PLLA_OUT0 updates Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 05/75] NFS: Cleanup unused rpc_clnt variable Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 06/75] NFS: rename nfs_client_kset to nfs_kset Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 07/75] NFSv4: Fix a state manager thread deadlock regression Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 08/75] ring-buffer: remove obsolete comment for free_buffer_page() Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 09/75] ring-buffer: Fix bytes info in per_cpu buffer stats Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 10/75] arm64: Avoid repeated AA64MMFR1_EL1 register read on pagefault path Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 11/75] iommu/arm-smmu-v3: Set TTL invalidation hint better Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 12/75] iommu/arm-smmu-v3: Avoid constructing invalid range commands Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 13/75] rbd: move rbd_dev_refresh() definition Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 14/75] rbd: decouple header read-in from updating rbd_dev->header Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 15/75] rbd: decouple parent info read-in from updating rbd_dev Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 16/75] rbd: take header_rwsem in rbd_dev_refresh() only when updating Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 17/75] block: fix use-after-free of q->q_usage_counter Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 18/75] Revert "clk: imx: pll14xx: dynamically configure PLL for 393216000/361267200Hz" Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 19/75] scsi: zfcp: Fix a double put in zfcp_port_enqueue() Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 20/75] vringh: dont use vringh_kiov_advance() in vringh_iov_xfer() Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 21/75] qed/red_ll2: Fix undefined behavior bug in struct qed_ll2_info Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 22/75] wifi: mwifiex: Fix tlv_buf_left calculation Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 23/75] net: replace calls to sock->ops->connect() with kernel_connect() Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 24/75] btrfs: reject unknown mount options early Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 25/75] net: prevent rewrite of msg_name in sock_sendmsg() Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 26/75] drm/amd: Fix detection of _PR3 on the PCIe root port Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 27/75] arm64: Add Cortex-A520 CPU part definition Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 28/75] HID: sony: Fix a potential memory leak in sony_probe() Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 29/75] ubi: Refuse attaching if mtds erasesize is 0 Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 30/75] wifi: iwlwifi: dbg_ini: fix structure packing Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 31/75] iwlwifi: avoid void pointer arithmetic Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 32/75] wifi: iwlwifi: mvm: Fix a memory corruption issue Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 33/75] wifi: mwifiex: Fix oob check condition in mwifiex_process_rx_packet Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 34/75] bpf: Fix tr dereferencing Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 35/75] drivers/net: process the result of hdlc_open() and add call of hdlc_close() in uhdlc_close() Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 36/75] wifi: mt76: mt76x02: fix MT76x0 external LNA gain handling Greg Kroah-Hartman
2023-10-09 13:01 ` [PATCH 5.15 37/75] regmap: rbtree: Fix wrong register marked as in-cache when creating new node Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 38/75] ima: Finish deprecation of IMA_TRUSTED_KEYRING Kconfig Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 39/75] scsi: target: core: Fix deadlock due to recursive locking Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 40/75] ima: rework CONFIG_IMA dependency block Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 41/75] NFSv4: Fix a nfs4_state_manager() race Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 42/75] bpf, sockmap: Reject sk_msg egress redirects to non-TCP sockets Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 43/75] modpost: add missing else to the "of" check Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 44/75] net: fix possible store tearing in neigh_periodic_work() Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 45/75] ipv4, ipv6: Fix handling of transhdrlen in __ip{,6}_append_data() Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 46/75] ptp: ocp: Fix error handling in ptp_ocp_device_init Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 47/75] net: dsa: mv88e6xxx: Avoid EEPROM timeout when EEPROM is absent Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 48/75] net: usb: smsc75xx: Fix uninit-value access in __smsc75xx_read_reg Greg Kroah-Hartman
2023-10-09 13:02 ` Greg Kroah-Hartman [this message]
2023-10-09 13:02 ` [PATCH 5.15 50/75] net: ethernet: ti: am65-cpsw: Fix error code in am65_cpsw_nuss_init_tx_chns() Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 51/75] ibmveth: Remove condition to recompute TCP header checksum Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 52/75] netfilter: handle the connecting collision properly in nf_conntrack_proto_sctp Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 53/75] netfilter: nf_tables: nft_set_rbtree: fix spurious insertion failure Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 54/75] ipv4: Set offload_failed flag in fibmatch results Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 55/75] net: stmmac: dwmac-stm32: fix resume on STM32 MCU Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 56/75] tipc: fix a potential deadlock on &tx->lock Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 57/75] tcp: fix quick-ack counting to count actual ACKs of new data Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 58/75] tcp: fix delayed ACKs for MSS boundary condition Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 59/75] sctp: update transport state when processing a dupcook packet Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 60/75] sctp: update hb timer immediately after users change hb_interval Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 61/75] HID: sony: remove duplicate NULL check before calling usb_free_urb() Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 62/75] HID: intel-ish-hid: ipc: Disable and reenable ACPI GPE bit Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 63/75] dm zoned: free dmz->ddev array in dmz_put_zoned_devices Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 64/75] RDMA/core: Require admin capabilities to set system parameters Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 65/75] of: dynamic: Fix potential memory leak in of_changeset_action() Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 66/75] IB/mlx4: Fix the size of a buffer in add_port_entries() Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 67/75] gpio: aspeed: fix the GPIO number passed to pinctrl_gpio_set_config() Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 68/75] gpio: pxa: disable pinctrl calls for MMP_GPIO Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 69/75] RDMA/cma: Initialize ib_sa_multicast structure to 0 when join Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 70/75] RDMA/cma: Fix truncation compilation warning in make_cma_ports Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 71/75] RDMA/uverbs: Fix typo of sizeof argument Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 72/75] RDMA/siw: Fix connection failure handling Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 73/75] RDMA/mlx5: Fix NULL string error Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 74/75] ksmbd: fix uaf in smb20_oplock_break_ack Greg Kroah-Hartman
2023-10-09 13:02 ` [PATCH 5.15 75/75] parisc: Restore __ldcw_align for PA-RISC 2.0 processors Greg Kroah-Hartman
2023-10-09 18:43 ` [PATCH 5.15 00/75] 5.15.135-rc1 review SeongJae Park
2023-10-09 22:48 ` Florian Fainelli
2023-10-09 22:54 ` Shuah Khan
2023-10-10  9:58 ` Jon Hunter
2023-10-10 14:48 ` Harshit Mogalapalli
2023-10-10 15:09 ` Allen Pais
2023-10-10 17:27 ` Naresh Kamboju
2023-10-10 18:19 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231009130112.953066738@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=horms@kernel.org \
    --cc=jeremy@jcline.org \
    --cc=kuba@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+c1d0a03d305972dbbe14@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox