From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 72014C433F5 for ; Fri, 10 Dec 2021 07:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:CC:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=14lDlJb/jyf3JCePprbPRZ/K1e9wgMXi1Cg+MO2lYmI=; b=jzFcvqlDN4nb4aErcZs4LIptgr DCCfqqhzKus1f4kJ1+mVxyOdu0NMXc6uuY6wETBM/yeThK+/+zf7Hh3usb08tETXA4acxN5KnTdc/ IF0HHGCSeXQbIyL64PR7XhfD5SX6g+nlPSz0KojXoQNeJ73Rdr6sEEA7vaS/q33WwThIrhkkVxMXq G4eVHBwxk1AIBcE5rLZiNv2rPcVgITfHM9JvVTO15qqdoUXrOFld/pxwuK27E3W3UbPjTK5oUJU62 6zzTPjyRMxOgqiFEplxp6ht0eYBwyI/6gqCLCYQ5zS5Er4dLHKqJmWx+QYdUPNH+hPBuWAAdCu7dy egxZBUnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvaVp-0014mH-Fw; Fri, 10 Dec 2021 07:40:13 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvaVk-0014kd-Kh for linux-arm-kernel@lists.infradead.org; Fri, 10 Dec 2021 07:40:10 +0000 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BA1aYmq012128; Fri, 10 Dec 2021 08:39:51 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=y8fXV96zWdDMZeLFEEa1AkerZm20bgHfV165wlhhHdQ=; b=3vx+nwIFetFFP8jvuCz0gkpk4l9X4p8XBaUZVtFjiQQJc47k/00AzqDvgswjHDMin+Nh zRRSmAzhCaqF3ogT7Vzpod1ybIg1ka92RX38FjAoNUjmY7o0LjLGpXrRi+DuRIzPrGy3 xtCnPUcJa5ycU4GPCKuSZ7QtIrdtjo4NA77FvS7Fak3sjrZ6BGHKsXeSxUrJk82tygJ6 XTdZZpyD6dutg4j1C1Wjnh9luEmkxGr/Bm47hXJ9craxjyYzDtkzhu5KkUSuaM7Cbe5x m1y3pDEAigteKYYJD6RSR7en8kCQPatGstcliAYaKuiedYxDrtfMoArDz/aknuK94ibV 8A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3cuf7sw5bw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Dec 2021 08:39:51 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3C02010002A; Fri, 10 Dec 2021 08:39:50 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2102821CA77; Fri, 10 Dec 2021 08:39:50 +0100 (CET) Received: from lmecxl0573.lme.st.com (10.75.127.51) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Fri, 10 Dec 2021 08:39:49 +0100 Subject: Re: [PATCH] media: c8sectpfe: fix double free in configure_channels() To: Dan Carpenter , Peter Griffin CC: Mauro Carvalho Chehab , , , References: <20211208073544.GA22020@kili> From: Patrice CHOTARD Message-ID: Date: Fri, 10 Dec 2021 08:39:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211208073544.GA22020@kili> Content-Language: en-US X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG1NODE2.st.com (10.75.127.2) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-10_02,2021-12-08_01,2021-12-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211209_234009_055739_20FC892D X-CRM114-Status: GOOD ( 21.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Dan On 12/8/21 8:35 AM, Dan Carpenter wrote: > The configure_channels() function has a double free because > configure_memdma_and_inputblock() calls free_input_block() and then > it's called again in the error handling code. > > Fixes: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support") > Signed-off-by: Dan Carpenter > --- > drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c > index e1f520903248..7bb1384e4bad 100644 > --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c > +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c > @@ -925,7 +925,6 @@ static int c8sectpfe_remove(struct platform_device *pdev) > static int configure_channels(struct c8sectpfei *fei) > { > int index = 0, ret; > - struct channel_info *tsin; > struct device_node *child, *np = fei->dev->of_node; > > /* iterate round each tsin and configure memdma descriptor and IB hw */ > @@ -943,10 +942,9 @@ static int configure_channels(struct c8sectpfei *fei) > return 0; > > err_unmap: > - for (index = 0; index < fei->tsin_count; index++) { > - tsin = fei->channel_data[index]; > - free_input_block(fei, tsin); > - } > + while (--index >= 0) > + free_input_block(fei, fei->channel_data[index]); > + > return ret; > } > > Reviewed-by: Patrice Chotard Thanks Patrice _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel