Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp670244pxb; Tue, 5 Apr 2022 18:06:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEqz3QKv1+2c2eECm+ChkhKA7+SdNe0aZrdN9U4UEmlZoXUM6IzZA7N3DWlE6vnRhGRbvC X-Received: by 2002:a17:906:7746:b0:6ce:a12e:489f with SMTP id o6-20020a170906774600b006cea12e489fmr5842927ejn.551.1649207180644; Tue, 05 Apr 2022 18:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649207180; cv=none; d=google.com; s=arc-20160816; b=xFrhwgsKl1FC46WT8d5HRRr20pStptlxft3BO98QztojcxiHTeY8W1uWV0wqHm7aBE mq71e8sVTEAxNLC3ERInp/i4Q3t/lLnm9OzdhExVGs6WZOnE3e38fjcjvZPF8d4qr45c H7z8fM3yi4pWYbqOKmPmNteBDyrtSoMM8TcMjpSE7EZRkvSG/5waGHBaAZhxbG81yhVb dlGNviCIPys8Ved/IW2+wUKi12dfS3X862dISeWZ4Vr21XzYM5wZI0ZEafp+0XdSRf+i yqrlQbtFbJ1tKYn7AU+46AhOkgxOry/1yjYnJl9xsTX4gnFH9NtiwITMKLmu7oal8n1a PBpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y4LdnHwiDaAVrkAe2CVkf3RRJXW/wvPMhlN9XVzHngw=; b=xiC8OcTVFEJhgeGaBQLucC/2Z1L11dp5wi3l2uML0EVKSQEHDbnuoKD9o+JIQ0rzui xZ+nRsywkQoWITheUlLX1sOtmZG0guyjOEdopc98CnC1gFxBf9cGuAZnWnhyVRpFFp6S bjUQGtW7MUKuq6Tmc+PW2f2EODR/L8MWM/xsIZTWlBk1eFyrtvKU00VmOQ3HE901s+M7 n/ysKbm3bwy86nNyFgZUgtCv5xVyoGoTi7QS2wExFL/7HPqB6A4n7WNWlrt9fVXEUfgE 88X/cgN8ey1KFWxTZRbeAGaC54Rc8h9RzzFPPPRH9tpnTsSY3D0VwRILPQdv8R96wQxl HJ8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sZQxVep+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170906140200b006e1479ad4d8si10636668ejc.353.2022.04.05.18.05.55; Tue, 05 Apr 2022 18:06:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sZQxVep+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352711AbiDELyi (ORCPT + 99 others); Tue, 5 Apr 2022 07:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244919AbiDEIwr (ORCPT ); Tue, 5 Apr 2022 04:52:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E84B824586; Tue, 5 Apr 2022 01:46:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8807B614EB; Tue, 5 Apr 2022 08:46:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96E55C385A0; Tue, 5 Apr 2022 08:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148381; bh=TdNHD+ThQdFDNYzUnyywSIQFu/8Rmrh1akcMl4pdADg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sZQxVep+7F04FN8B945OGAihhN191NAqaqjgqIc7pPqZAJbhMqgEmxvFkBahvzBQ5 X99rT5PmhbCWrPiIQ+d5ArAj0nXMXMZwzfIl7/dUnlA3A5U6+IIQUSOEGIk6sJcO7M VujKgTWVo3ZpIFWExSQtqqTe3vbiapKGRJX1orvM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Hans Verkuil , Sasha Levin Subject: [PATCH 5.16 0335/1017] media: usb: go7007: s2250-board: fix leak in probe() Date: Tue, 5 Apr 2022 09:20:48 +0200 Message-Id: <20220405070404.226332231@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 67e4550ecd6164bfbdff54c169e5bbf9ccfaf14d ] Call i2c_unregister_device(audio) on this error path. Fixes: d3b2ccd9e307 ("[media] s2250: convert to the control framework") Signed-off-by: Dan Carpenter Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/usb/go7007/s2250-board.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/go7007/s2250-board.c b/drivers/media/usb/go7007/s2250-board.c index c742cc88fac5..1fa6f10ee157 100644 --- a/drivers/media/usb/go7007/s2250-board.c +++ b/drivers/media/usb/go7007/s2250-board.c @@ -504,6 +504,7 @@ static int s2250_probe(struct i2c_client *client, u8 *data; struct go7007 *go = i2c_get_adapdata(adapter); struct go7007_usb *usb = go->hpi_context; + int err = -EIO; audio = i2c_new_dummy_device(adapter, TLV320_ADDRESS >> 1); if (IS_ERR(audio)) @@ -532,11 +533,8 @@ static int s2250_probe(struct i2c_client *client, V4L2_CID_HUE, -512, 511, 1, 0); sd->ctrl_handler = &state->hdl; if (state->hdl.error) { - int err = state->hdl.error; - - v4l2_ctrl_handler_free(&state->hdl); - kfree(state); - return err; + err = state->hdl.error; + goto fail; } state->std = V4L2_STD_NTSC; @@ -600,7 +598,7 @@ static int s2250_probe(struct i2c_client *client, i2c_unregister_device(audio); v4l2_ctrl_handler_free(&state->hdl); kfree(state); - return -EIO; + return err; } static int s2250_remove(struct i2c_client *client) -- 2.34.1