From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 9F8EC3E63BA for ; Fri, 24 Apr 2026 16:52:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777049564; cv=none; b=iWv2kLJhvoHQ6efZ3f4QsSw7WUdn/XMcU4g+tVa9djkKQlmgGmgmimkzH1HZyecPANxAl2eOdYVqJUguSysx13Gi7pAaTR9QHmZYP89c17VR1fBOnexbYYiILuzTj8YTc11irwvUVkyLhth5ncATxmQFEQ+FJ5JDam3QXH0/R94= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777049564; c=relaxed/simple; bh=gOq1TfW+S0UWD7Z2KXCott8iD54/eMJygLK8vcCtgp0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=V0+UHZO6G3sm6jU/YGsuZyL/KQ6uP8rcpfq39SlAyrCNYq+Hj5w769ou57YdILIRiOxBHy5tNjfkJEdSGCIZcxRV1JxQjoGNIOAvmSRjgO0ia+A5B7lLTGoUUxgbw54FhDVP8sP7x9vl4H52qdpRhwZrdczdHf9P4lYRrnm+2iA= 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=HcKRubrl; arc=none smtp.client-ip=209.85.214.182 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="HcKRubrl" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2b788a98557so33245145ad.2 for ; Fri, 24 Apr 2026 09:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777049563; x=1777654363; 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; bh=N8m0d9jgffml56tOWD/yiI/9bSBwutf977iNuQiC6e8=; b=HcKRubrlSQ7PC7nzavVHXfghnZn1C/YbRWO8DaN/buFU0/PAZlWqoCPt4bwMxyGUO2 9iD/RZRQxp3RJHoOANXZwI59iWzuEiw+/BFnIszwjpIEMqyTdGk6OevIcJz89/4JfH2Q 9DBRXDbzlC9tJtYVlHy0bXsIRIn57vAwXy3OoJQZrdU8jtinjThtTbk5rFg22hNBE/3P SPJMWM5lcMxRn1TvFcxlLjlJksKlwVIi7gaQCeBrGqjoqtMzQICr/pH6EIFL6+MJ1zBh GM/jYOsjoYR2WxhOHZ3dJywHrupQAoW3GPCXlpSUg5xoJGt/LewTx5Dhh6uLAAkwkVQQ Sapg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777049563; x=1777654363; 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; bh=N8m0d9jgffml56tOWD/yiI/9bSBwutf977iNuQiC6e8=; b=SoyHeBNOgZsRwWOWd1C5+sv47F0QqNyUJSTf792/ya4vbhY6Yig86oaXeeqUnR3h1W y32hnfcuDbqYgXBIYWiYyeFJFtnC9XSuEyYcMG4AQaZRJsgR3/fr2LylliHooAe/k9Pi 30AXxmdsmZtX+ZF/Ii3Gza/8JCwxfyEDl3brPNVmZSn5KHLqSa92nXtuZs/5ADu/CpPy R08nFxbvd04YCI5C8eCHuAkp+QbLDP9Y4/jYJEFa5u4/RZ6yzeA1wUUOlUxXKFcErCo+ mOK0uPPv/auClDVvQ+iiLiFllhkO8XlQ2Yu97vp+jP2vMhWWERM5eRvS1cVpPyC7OpCc Ub6Q== X-Forwarded-Encrypted: i=1; AFNElJ8gwiWRlXzKwBA8HbJhkySrhmJ3RJSgb868AjpUk4uq0iAcss20qhdLtD8OgXI7EHAkHF/UgQw=@vger.kernel.org X-Gm-Message-State: AOJu0Yxxg4+ajluUnGF/A3EoqCtYR3/FV8UFSokXEKpmjQX5I1msQL3V WOKxXLs1RTi4QEKCMbOzh8teptmT61GqJoL/rCvNzKHfULbJwEznShc= X-Gm-Gg: AeBDieu+5GlYLAZeuoMUGqJaM4JH57hYoEaIYeZv22c4hZTFDVc+ojvGiw9Oqaqqqb8 11caQyHAzlInAdCe1uj5o2KQrmpS5Akbeg+oxdeN7D1dP5NMC7Cyvj/s+vol1L8KcnA/YF2Jf0A GyqRrBSZ8oERDNwr6vutiyUGjijomU44JK2gKwXpxpl+SnzroDpenvfhZNGRdHwN1y1e8SWH+/r LV9hmET/0B1YTlaiQeKpuKGcy9zz9BtasObZeBkS8K8lWMaElR6tJFhL/pKmrOzk+4fUGlxBE8p 7zxSKB6yJ3uuNk9Mt/14XxFNoEFlPrHVCyDRmPYsV4TcfMwZUuXYE6Svwk05cuV9/ypvS7A4L+b NVWkbaZK3LKKtQRhY/k5DuCSD1uHoh+20TwdQMIJsxAakWiWoA4JPIdOOuIDm/VRoZbfRyXzIUM aQr1+l7JXzzsIKPH5Uuot4pcVQ/gigA+d1ZP6KpZN7aR3pjBZ6haMWgceQ6E5NnoRk57wx1DEyC e+g97VojQ== X-Received: by 2002:a17:902:f98e:b0:2b2:481b:de5f with SMTP id d9443c01a7336-2b5f9e86057mr239985835ad.5.1777049562978; Fri, 24 Apr 2026 09:52:42 -0700 (PDT) Received: from localhost.localdomain ([1.226.165.54]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5fab30f29sm229362825ad.68.2026.04.24.09.52.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 24 Apr 2026 09:52:42 -0700 (PDT) From: Myeonghun Pak To: Benjamin Mugnier , Sylvain Petinot , Sakari Ailus , Mauro Carvalho Chehab Cc: Myeonghun Pak , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2] media: i2c: vd56g3: clean up subdev state on probe failure Date: Sat, 25 Apr 2026 01:52:10 +0900 Message-ID: <20260424165238.31333-1-mhun512@gmail.com> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit vd56g3_subdev_init() calls v4l2_subdev_init_finalize(), which allocates the subdev active state and requires v4l2_subdev_cleanup() to release it. If vd56g3_update_controls() fails after finalize succeeds, the probe error path currently skips v4l2_subdev_cleanup() and returns an error. The driver .remove() callback is not called after a failed probe, so the active state is leaked. Route this error through a subdev cleanup label before freeing the control handler and media entity. Fixes: 87aa97fc3157 ("media: i2c: Add driver for ST VD56G3 camera sensor") Cc: stable@vger.kernel.org Signed-off-by: Myeonghun Pak --- Changes in v2: - Use a lowercase subject summary. drivers/media/i2c/vd56g3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/vd56g3.c b/drivers/media/i2c/vd56g3.c index 157acea9e2..43f792288a 100644 --- a/drivers/media/i2c/vd56g3.c +++ b/drivers/media/i2c/vd56g3.c @@ -1427,11 +1427,14 @@ static int vd56g3_subdev_init(struct vd56g3 *sensor) v4l2_subdev_unlock_state(state); if (ret) { dev_err(sensor->dev, "Controls update failed: %d\n", ret); - goto err_ctrls; + goto err_subdev; } return 0; +err_subdev: + v4l2_subdev_cleanup(&sensor->sd); + err_ctrls: v4l2_ctrl_handler_free(sensor->sd.ctrl_handler); -- 2.50.1