From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 262401624C0 for ; Wed, 29 Jul 2026 02:18:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785291529; cv=none; b=e9wlRpqdPGeWOs3oMb2YkNvOr2o+eTZ0RI8Dtxwgr1PB5TmYsu8cF/DsdJ6xCRA0RTB5f+fm/Vc8H+eooOeTsyUYM4VxSrEx7ba+HV7+HOJv1PcyufpFzWwAn3gcEKqBJgEHMiv1dRXz8hidEH/y/9w+AJBKp50QzIwUAHryQ2U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785291529; c=relaxed/simple; bh=dmriazfhWcf5wW8lxOVtQBUgCYLeSYhcaY4KgrG7ctA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Dn8n4fCtp81JMzpLZFM/Oj9HDOZUvgQUfATd0+OtMr8tLPYkbH3sGKHMLAEVLbd7Zmf8TE73ylmFA5gqSRGL89opAaABkzOoJnRpS6nOKRZN0bRbqTnekzxjvikx2TwTkh5FzvGMrGnU2CFOPlohaHNFhhfxH5VigSzRz5EEjBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cxcpqN8r; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cxcpqN8r" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2cfff5f88dbso5344435ad.3 for ; Tue, 28 Jul 2026 19:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785291527; x=1785896327; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=A3vGTZ+9cBJHUjmSn73Xe4evmb/1PkSIQ94tual6z3w=; b=cxcpqN8rq7HglPHwR2IbvxtN3GRe4NGzynmTkyK5gm0qBOA+Aoz+G+e9xEZZjKgB6P 3Q/limCrCp0xbEw3GNbLkuj5QLRHJTRt6eORffvT3s+BMDQDUJeAGZbTg3wHS+m/UPij ngZ3i1pVCHG/6wDjRDKQ5BU62/lfhPfTq3duGviYVBcd2Oe8KQM6Xcm2sqAI9+7O0pSI lluM3cOhYR/sIi8ZXxX1DuHyxd5gO2E/FZEPjnRBZmIkOq7LGkhLaqqnZKKTvwOxDqt0 LB+a5BjnJZzHdtUivq1OnMYyrc5XvRRlg+EJRY7wnHHcDz5D6znhpAQtkKUXRb0gAfLw Whrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785291527; x=1785896327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=A3vGTZ+9cBJHUjmSn73Xe4evmb/1PkSIQ94tual6z3w=; b=BnNGxttcIT6X05bW434F4Xw1tU+Hi7e5RsamUVNgtKI5j+1Ao5pRSJLI0zmj2RYgqx s32iwbLY2do9I50P5WeHPsOk6sxa8eY5NkiG7EOMV8ieO4ugxfWgsxvhr+Wu3kCJeXSk t28+fgYeEelv9VpmNJX4054bInQKzV/6rx9hyiWC6VRMqKzXAiRIox5blXnAIrRczhnX bfWyuphfijItue4tJ1aWj94pkyrKjCWR5gZVB5aXzIAx6JbHGa3I1yiz4/PnHPSi1xU9 6L6sU7CcOsZPnFIo3lJufM3NWlgYTNm/S5+ktWeNOSq2OJBKA1W7FfCQny38U+OHx9Nq VQJg== X-Forwarded-Encrypted: i=1; AHgh+RqIJoNttTaQkyX+7/3frDR3EjoExzgOlTxUkqewDlD3WoojGn4CPuaSUGWk5CLi8BDP7DNoOukQMEopHXE=@vger.kernel.org X-Gm-Message-State: AOJu0YyoOmKEfhkxyRa4EYpeGPCGJs4bW/P2dsyAKgbmPRCVR1ou1mQO j+ot1cmOUeWRe+QVZXhd5PrTD++7JU8XVJs0oqZIkVaVZZndgcM607U= X-Gm-Gg: AR+sD11D9YlH77w7vz0eOHbPONMs7LyXO7j9J4RWifAt3spr/vu+zsZwR8uVzTgZZ4T nLDje6cCyE0cqPL6JqATfx/iZgxBoRn2NEOH173Mb9EE/KQDBmRo+6aPJNbpqDxWuLEEPlztkaS yyOprsKXIVvHrMBWQY0k7fcVdPV8jmNt3Q/m1FPbVh3JyaUtVXyJMLh0QL2litPioZhmRX1LzIr ptfqApzxU+DVFbTQlgrTxqQHjttQXvxklvHnN94FXTNKeMVEBKbYoKsAtUftPzydOcqlgps40zF 6+PaoLKNT832HBvBVuYSdVFrV/9cE/9AzgFO5DASM5vwHEJdplO7vxVDCKr1oOIQ42hbk9qVvG5 ccvCsSPV+livMXx//bWIb8nw09mLloRwa8egDxQkPff6C0IxMdGYTT112SAJf5WMsGszisq6maQ XmG5TgiEDlZE4Owo1B1EPQ19vIL8RngTp1lTmr9AMpacPz5umDBeO4hlZWOkgfsZi0GfI6JfkUH hfAsl3U5eOjiYmNtu/QTZKb2CZtoNG16uCH+Sj1SOubTfK99ESudd2zDPYDWRuNY/WQq8MtfLzn FXTVslcyX+S+9asf2XnfzcH0WEf90PreMw== X-Received: by 2002:a17:903:1905:b0:2ca:ca48:c36a with SMTP id d9443c01a7336-2d015c0fcacmr52704555ad.18.1785291527425; Tue, 28 Jul 2026 19:18:47 -0700 (PDT) Received: from localhost.localdomain ([1.226.165.54]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d022a46774sm3848685ad.27.2026.07.28.19.18.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 Jul 2026 19:18:45 -0700 (PDT) From: Myeonghun Pak To: Alain Volmat Cc: Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , linux-media@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Biren Pandya , Ijae Kim , stable@vger.kernel.org, Myeonghun Pak Subject: [PATCH] media: stm32: csi: unregister async notifier on cleanup Date: Wed, 29 Jul 2026 11:18:34 +0900 Message-ID: <20260729021834.50550-1-mhun512@gmail.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit stm32_csi_parse_dt() registers the async notifier before probe finishes. If a later operation fails, the error path only cleans up the notifier's connections. It does not unregister the notifier, leaving its entry on the global notifier list after the devm-allocated csidev is freed. The remove path has the same problem. A later async operation can then walk the stale notifier entry and access freed memory. Unregister the notifier before cleaning up its resources on both paths. Fixes: dcb0f4c16be5 ("media: stm32: csi: addition of the STM32 CSI driver") Cc: stable@vger.kernel.org Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak --- drivers/media/platform/st/stm32/stm32-csi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c --- a/drivers/media/platform/st/stm32/stm32-csi.c +++ b/drivers/media/platform/st/stm32/stm32-csi.c @@ -1059,6 +1059,7 @@ static int stm32_csi_probe(struct platform_device *pdev) return 0; err_cleanup: + v4l2_async_nf_unregister(&csidev->notifier); v4l2_async_nf_cleanup(&csidev->notifier); return ret; } @@ -1068,6 +1069,8 @@ static void stm32_csi_remove(struct platform_device *pdev) struct stm32_csi_dev *csidev = platform_get_drvdata(pdev); + v4l2_async_nf_unregister(&csidev->notifier); + v4l2_async_nf_cleanup(&csidev->notifier); v4l2_async_unregister_subdev(&csidev->sd); pm_runtime_disable(&pdev->dev); } -- 2.50.1