From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C203F26B2B8; Tue, 8 Apr 2025 12:13:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744114383; cv=none; b=OPB+SsLkiAnceAPaLCuSzbvGxLf/BrpTmET49wOw1SKiid9cmNH7UEJiEMefh8QbCVRDBM7iWeoP3YIAvTjClFen8XYDUo6Td6MQvB9IlMNjhe6e9exE8zyRDDEPYigpdiUVBYCfq9IR2YpdkqjK5g/89MjZfYwlatCRdS+JXoA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744114383; c=relaxed/simple; bh=yPhiNtv2VfhyHK6NYP2FnMCxlvecMhI9cfa/IKSLkzg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ok+LMxNXHBVtKPjKhjsb1oH65Bt+IEr3wLwXFGrGmvqjWVJAQZduN/b15pDur7RMe2Zei7VvPghBGbEXjsNOZaS6O17Wph5Qc9H+szJgW+4tKypDOcEB2ei0cna7i28dkIG0BJ8UqGyrKjZ/IVMbcx5J5Q/lM4I25cJeEkZrWKI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=myQL6hQu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="myQL6hQu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50C29C4CEE7; Tue, 8 Apr 2025 12:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744114383; bh=yPhiNtv2VfhyHK6NYP2FnMCxlvecMhI9cfa/IKSLkzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=myQL6hQu0LUosQWdnMrghpmOL6N3ajPWQfDSA/0gRYnAadn7MeuMU5kFgS4Aki0D4 y+8aZSCVPbAbUw+j5i3vCo24WbZzUzY0aiDb8bg8SyjTIP65uQCmibTb1wKlziurXp iqQ5upBsF/1V0GJ11yxyWZNKKyF5RkrNbnlH+JDQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joe Hattori , Michael Tretter , Sebastian Fricke , Hans Verkuil , Sasha Levin Subject: [PATCH 6.13 046/499] media: platform: allgro-dvt: unregister v4l2_device on the error path Date: Tue, 8 Apr 2025 12:44:18 +0200 Message-ID: <20250408104852.391397435@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104851.256868745@linuxfoundation.org> References: <20250408104851.256868745@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Joe Hattori [ Upstream commit c2b96a6818159fba8a3bcc38262da9e77f9b3ec7 ] In allegro_probe(), the v4l2 device is not unregistered in the error path, which results in a memory leak. Fix it by calling v4l2_device_unregister() before returning error. Fixes: d74d4e2359ec ("media: allegro: move driver out of staging") Signed-off-by: Joe Hattori Reviewed-by: Michael Tretter Signed-off-by: Sebastian Fricke Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/platform/allegro-dvt/allegro-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/media/platform/allegro-dvt/allegro-core.c index e491399afcc98..eb03df0d86527 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -3912,6 +3912,7 @@ static int allegro_probe(struct platform_device *pdev) if (ret < 0) { v4l2_err(&dev->v4l2_dev, "failed to request firmware: %d\n", ret); + v4l2_device_unregister(&dev->v4l2_dev); return ret; } -- 2.39.5