Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp314300qtb; Wed, 19 Oct 2022 02:38:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qB11/SnNAItqH85eA/pjHyJ7jgWmDpuYBTBP+TvkYyy8grpi0H9aSMKceNhRIm+bi3C+X X-Received: by 2002:a05:6402:50d4:b0:45d:fe2:45 with SMTP id h20-20020a05640250d400b0045d0fe20045mr6721519edb.221.1666172336063; Wed, 19 Oct 2022 02:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172336; cv=none; d=google.com; s=arc-20160816; b=jxjwgXjJewogMMkOWAV3VI/WPkJwVAr/eJOUB7SS9YjjUrFmR/vWxfP0mKdAToejEj 0n+DDPLsLThvjT64Q6EqBBBlehlVxSOLhGUn3fu1xnxNL4V9yMSIxjcPYhSxyiDJyw8s l0vFAba0KfbI1qCVJA81FpozIB9QCHCGZ1KrAFy/Z+nOW8lKioCxgiyMv/wn9DQYvdUq GvQiRRKy1vuDIlZ8/fe2k+vtK3YaMnn69ilxr1ZSYdPUAy0cx0DSy2LuyVYIMX0eo2zF 1OZbWs8pu37KXQLqFjDt1IjaipTOKFRbVChsxw/aouwjQblGc6GBi9GoLKRSP0+/2lrI nLDw== 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=YNz7NnOxHKZUBORmijhyZdm3/Uh52RVNGTGa7VDwnkY=; b=lRD6vKaT7vRqhMnDunWjuQoys23LjPtWd5bbGGJcVvKvMkpZDBtQ6dMRWS7Vsgx/Yn akad6Hx8PayocmIAwnPyV1Y+bUr8ySUpGD7S5KkfTD0Gc43p5p9eWdw2pdGNxH+UqIVq 5uv0T3Wob8G2J7GKDEggOG5EmOIf5mvuJOLlFlGp8RdJ3CSDpBMVl8SghUVAYcsqffBz EujVLM37jjniLfZ687g3p0Zk9AbiKf8n1Lmy3UYyVTVdq9vo/U9TxgUgtlxNdikpyJkk 39yDDqAS4eKaYjV3gGQq1zcyH46km0h4TUGxYAtmFR7zeoun8A8phlaR7AWxGIocVTba GAUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ifqvi3Te; 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 u19-20020a17090617d300b00711da52c6e4si12357955eje.309.2022.10.19.02.38.17; Wed, 19 Oct 2022 02:38:56 -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=ifqvi3Te; 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 S233444AbiJSJW1 (ORCPT + 99 others); Wed, 19 Oct 2022 05:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233420AbiJSJVZ (ORCPT ); Wed, 19 Oct 2022 05:21:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6D4D3C16F; Wed, 19 Oct 2022 02:09:52 -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 F143261807; Wed, 19 Oct 2022 09:01:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12F0EC433D6; Wed, 19 Oct 2022 09:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170088; bh=9IY8itcj0UntKkJNFI/Iu3RvzWtyhrIob2EbC+YLLxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ifqvi3Te3cGp3CQx6+NZ1Oao+aiG4jhHPvNmy7U44XpeLQIZnmRkgSbuKc1Wg7AW6 IBProP9Uc5CWOe9o+CEz98Pq3P0eYcxnrzzle1AH0Ec8maYyDuVtB5a0NH7ASMLV7/ ubcu2u7QzaIF+hIk3iPE41blr57xEyU2Jkoy11I0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+bb25f85e5aa482864dc0@syzkaller.appspotmail.com, Dongliang Mu , Tommaso Merciai , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 486/862] media: airspy: fix memory leak in airspy probe Date: Wed, 19 Oct 2022 10:29:33 +0200 Message-Id: <20221019083311.448540730@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 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: Dongliang Mu [ Upstream commit 23bc5eb55f8c9607965c20d9ddcc13cb1ae59568 ] The commit ca9dc8d06ab6 ("media: airspy: respect the DMA coherency rules") moves variable buf from stack to heap, however, it only frees buf in the error handling code, missing deallocation in the success path. Fix this by freeing buf in the success path since this variable does not have any references in other code. Fixes: ca9dc8d06ab6 ("media: airspy: respect the DMA coherency rules") Reported-by: syzbot+bb25f85e5aa482864dc0@syzkaller.appspotmail.com Signed-off-by: Dongliang Mu Reviewed-by: Tommaso Merciai Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/airspy/airspy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c index 240a7cc56777..7b1c40132555 100644 --- a/drivers/media/usb/airspy/airspy.c +++ b/drivers/media/usb/airspy/airspy.c @@ -1070,6 +1070,10 @@ static int airspy_probe(struct usb_interface *intf, ret); goto err_free_controls; } + + /* Free buf if success*/ + kfree(buf); + dev_info(s->dev, "Registered as %s\n", video_device_node_name(&s->vdev)); dev_notice(s->dev, "SDR API is still slightly experimental and functionality changes may follow\n"); -- 2.35.1