From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 E9F6A3B71B1 for ; Sat, 8 Aug 2026 09:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786180321; cv=none; b=ttC4oXqHEnLS88QCXlSVx4PXaTyTAxmtN7tgE0zB6quM4eta97VJ7sVe1UQczYwZqr+7xHOB7sCnk0ydjT0eKXmnmIbSkYFMF8ABqbXGS/q7DaCq1CgwNrj6YBYf8NAKMZYY/Gen4ZEX8fOmGTdzt0pwqJ6NEdxHB/KPfedCelY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786180321; c=relaxed/simple; bh=oJ42448NVLVzg/Jd4WQT7WZLZMZvxVSOD0A/N+s45qY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gLlWkVVi7Iadn/UkYMAbfLGGvaqqEndVtorN3FycRzsEinHYHQLJkwMEeEs9GgQvaiKECnXlPmQYTKC5dgYHqrRub/jZQDg3MNNikkBRnBMNLVwtYbyp8wBGo8Aoq+jS0YSJBJMdItxgmhFiCZTf9q+DBJvqQuXimo9JEYCap/c= 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=A0BxS4o4; arc=none smtp.client-ip=209.85.214.178 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="A0BxS4o4" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2cca0c5799eso3352395ad.0 for ; Sat, 08 Aug 2026 02:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786180319; x=1786785119; 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=BveM5cMWSJ3TieKfU41UkYe+p2SvuBRd6rFqa8L96gE=; b=A0BxS4o4oY1uk7TRgN+5zCBXO5yzpGq6YxQyF23MjbZbvFu/SwpUoi6Woh2jvis6Lq pQ2ap8lJWwVjoS/5SLTQ/aEnJuBcX+rw7UsjHY8KtJLugANXCZZtCflWRXMTxfKObwMR 5ICxAzfbuorZZfa/cyo0GRlN2Qxf3PMsR5oJ3hr+GdGm4jufIAukp/DxQeDtxfuanVDk 9qC2tLIJXfxOAy1Mmh0hhEn5eKvq1F047fqI4he/x1aWN2/qBQY6Uzsqu6/diu+v84V0 UEwKJ4npfJSQZee4d6X+WPHAysxtA2p1f6RLaeU5dIo8QnTjZnzhz3MFEIvWruUicSKO QgIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786180319; x=1786785119; 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=BveM5cMWSJ3TieKfU41UkYe+p2SvuBRd6rFqa8L96gE=; b=RN9ACW8Zvzp9gJ0YGABEWs2q7yF9+OhnY2MZxSeP3R2ci8yx9f5UplBu1cKCMqqMi8 Owwfdk2d+nrwT5eMIHjFi4PIsfA2261NSdLosy5pk27gaorA66GmkGPq/x2G7csqpjah moU04+MsTQaS714iudaLnF6BYgmNian7HNoJphQ0tOT4k1oqdjPIQZjC5YgjvrSFYM+Q 6k/O5wtxqZrlm/J8cooZINPAWHt4nqs+kNFxuNjcXCaYDxb3k5tzjmYrKRbbY2i1O4Ra Rncky5moopetaQPsXJ2FuXLZDpK/JRr9zJ8poRiWkd1LUZ+vczeiduW43l9WQ2Vk7t8W Vviw== X-Forwarded-Encrypted: i=1; AHgh+RrjS7s2SePtanvP05gRscVTa5hD3ql8qH5P560qNghrBc0VRkBWbqfE0m1u1c969aZyOnLG4PHVJadA43Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yzg8b/O01iOsYuxsliibS1UcizDnrGuO2kszzugo78fxPy2Qgyq MDHo2vE2AnFbwroPv4KLrcuMXkrdeYjYqQyxHTb1q4lZVZwLHDCzdb+6 X-Gm-Gg: AR+sD13G9Y8JYwZDDIBomKtM8jE8o2LBPEunwAR+ZvnQ4nBHVbovFRiVWf6C5aCM9O/ V9ItzoSOe4MN5iWs+moi13otT1fEm549igqNb7Li10weljYez1AugRHXFMzDYFJmcaeY/qlLADI r0eR5NDNZDYITjaNCA1ht8fuE+r5BW2KAuE7wx7dk6eyTrwIbqhaJy8oWD+V+a4y0gKfHneBfc1 hC+qZhtkgRxqwG0yik4fuEgYH7wkKCLJVOb3CYYsdCPWqjmMpJInxqaselWLNAnvHj4AIFkrF5W IDuipKv9Zh8IXTT+KmEk/xF95YkhyRfUMpmhs7EYb240LxbKNYjRdGCShRz6QI0pagtjcUsEHYH PMMEgxrM0wENAGAwUgL0PwXHfaXVKcJJzaXN5cB8VOrXZE0WrTV8YXgvnEEUl2wymx0/aKoDTpx l7GcypYkJ8zCmgzXMK1gm3AgMcQGjqcXOYbGjl4N0rv3EoFRKN3Fx7Via+uViZ6N8DRiMe6nFTr M4fVw== X-Received: by 2002:a17:902:f709:b0:2ca:1b97:70c5 with SMTP id d9443c01a7336-2d2a8458b93mr88228315ad.4.1786180318914; Sat, 08 Aug 2026 02:11:58 -0700 (PDT) Received: from SGN-LDSENG.tasernet.com ([2405:4800:5cc3:11a:1ac0:4dff:fe8b:4a69]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-315bebde308sm17126060eec.20.2026.08.08.02.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Aug 2026 02:11:58 -0700 (PDT) From: Cong Nguyen To: Maxime Ripard Cc: Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: sun4i-csi: fix async connection leak when notifier registration fails Date: Sat, 8 Aug 2026 16:11:51 +0700 Message-Id: <20260808091151.2691482-1-congnt264@gmail.com> X-Mailer: git-send-email 2.25.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 sun4i_csi_notifier_init() adds a v4l2_async_connection to the notifier's waiting list with v4l2_async_nf_add_fwnode_remote(). If the subsequent v4l2_async_nf_register() then fails, probe jumps to err_unregister_media, which never calls v4l2_async_nf_cleanup(). The core does not free the waiting list on a failed registration, so the async connection is leaked. Add an err_clean_notifier label that cleans up the notifier on the registration-failure path, matching the teardown done in sun4i_csi_remove(). The notifier-init failure path adds nothing to the notifier and continues to skip the cleanup. Fixes: 577bbf23b758 ("media: sunxi: Add A10 CSI driver") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4 Signed-off-by: Cong Nguyen --- drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c index e53a07b770b7..a8db851ab5a5 100644 --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c @@ -255,13 +255,15 @@ static int sun4i_csi_probe(struct platform_device *pdev) ret = v4l2_async_nf_register(&csi->notifier); if (ret) { dev_err(csi->dev, "Couldn't register our notifier.\n"); - goto err_unregister_media; + goto err_clean_notifier; } pm_runtime_enable(&pdev->dev); return 0; +err_clean_notifier: + v4l2_async_nf_cleanup(&csi->notifier); err_unregister_media: media_device_unregister(&csi->mdev); sun4i_csi_dma_unregister(csi); -- 2.25.1