This is a note to let you know that I've just added the patch titled cxl/pci: Remove unnecessary device reference management in sanitize work to the 6.5-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: cxl-pci-remove-unnecessary-device-reference-manageme.patch and it can be found in the queue-6.5 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 96a97a93d1c21a2196992b4463b975c465bc8b04 Author: Dan Williams <dan.j.williams@xxxxxxxxx> Date: Fri Sep 29 14:44:46 2023 -0700 cxl/pci: Remove unnecessary device reference management in sanitize work [ Upstream commit 76fe8713dd0a1331d84d767e8e5d3f365d959e8a ] Given that any particular put_device() could be the final put of the device, the fact that there are usages of cxlds->dev after put_device(cxlds->dev) is a red flag. Drop the reference counting since the device is pinned by being registered and will not be unregistered without triggering the driver + workqueue to shutdown. Reviewed-by: Dave Jiang <dave.jiang@xxxxxxxxx> Reviewed-by: Davidlohr Bueso <dave@xxxxxxxxxxxx> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx> Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx> Stable-dep-of: 5f2da1971446 ("cxl/pci: Fix sanitize notifier setup") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index 2323169b6e5fe..51dbd0c81497b 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -152,8 +152,6 @@ static void cxl_mbox_sanitize_work(struct work_struct *work) mutex_lock(&mds->mbox_mutex); if (cxl_mbox_background_complete(cxlds)) { mds->security.poll_tmo_secs = 0; - put_device(cxlds->dev); - if (mds->security.sanitize_node) sysfs_notify_dirent(mds->security.sanitize_node); @@ -296,9 +294,6 @@ static int __cxl_pci_mbox_send_cmd(struct cxl_memdev_state *mds, */ if (mbox_cmd->opcode == CXL_MBOX_OP_SANITIZE) { if (mds->security.poll) { - /* hold the device throughout */ - get_device(cxlds->dev); - /* give first timeout a second */ timeout = 1; mds->security.poll_tmo_secs = timeout;