Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp486814rdb; Thu, 30 Nov 2023 09:46:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMdV67g9UVvT4NbB63zdZskzZH+2Wr0nSFEuO7pm/8ge8jM9OiAqdGqnbWpaJNwg49kZRh X-Received: by 2002:a05:6a00:1d0d:b0:6cd:faa6:fc4b with SMTP id a13-20020a056a001d0d00b006cdfaa6fc4bmr285210pfx.33.1701366376819; Thu, 30 Nov 2023 09:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701366376; cv=none; d=google.com; s=arc-20160816; b=Ua9JGNWjbqC6uxfBpSJT2dYouqugyzswQYCdChQNNALpsapsI8kXkese2Qndr56cHd xazbwlJ+wzUenXdE1gXlvBOTsjwXjUTXUoUEMzuL7DrufZ24UBgq1bzGEkrVZnQlXF89 Y9Rdl0mEvD+Rbhea/8ORycjTdteniK1Yqrvf0ppoVAV0GlYw9JH0xXZdt74hD837SWg5 wm4EROGUZzkq6p2190dRp7r1qYcJtMJrVmE2t31wUUoKCoPjMx1etkh9CdMN45EzGKCr hryn2Cz0wU/P1JviUAa/2EvzHrcObJnjst3IDAGmkWlktHwYEW8vaDJR6jQJ7M5dzKJX 6bVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BKXATqXY/bLQgl4RWvriupCDzMQ06Goru1Fp+VKk9SM=; fh=0Tr2lZ2USWdfKL6egp+cTcvqCitjTsq/gJWv9KilxSk=; b=ZKq//glFeRaSXfvz6LiMXF3EOqBSXN4BA35q9SiDLrVvUztXezDAUFr6F1SlC6L3Ll hYG8Li8At8nYDYgbw376H1AOR9dbDpIZmtKFaxun4DmCbckyrzSUDJEoM5vpE3ZgYrBh ozm4tME0l+eDROFDcy5kVSPzvhIxUlkkOFdqZaK7S83Rfef3+QxdrdVNRkxSCxhrrvKh 0I2t+5wbuADwp80DxrSUcwnDAGfa64jac0OfnjoK7XdaAGb9ukcHMTRv72JpqYmEoUnS 2jUJcEyGzxZ423h1lnCE/UC6JvuR2RDDjwQJdpvHpno2VLI2An3NAPD8QeEPDVI5CwG+ wouw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="GGjc5wG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id bj10-20020a056a02018a00b005be1f24c815si1850204pgb.502.2023.11.30.09.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 09:46:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="GGjc5wG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id A83BC802459A; Thu, 30 Nov 2023 09:46:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231330AbjK3Rpi (ORCPT + 99 others); Thu, 30 Nov 2023 12:45:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbjK3Rph (ORCPT ); Thu, 30 Nov 2023 12:45:37 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 626E2131 for ; Thu, 30 Nov 2023 09:45:44 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46670C433C8; Thu, 30 Nov 2023 17:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701366344; bh=Z0rdqtHB/1WMoBlhdId/h4N42zIR/AZb8/VyMLb5Q5Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GGjc5wG/kkTHxD/lxA7nYlI8B/lqCH7zV4eRtVsh+EZtg3ogSB5inawWs3OHhDYhW yKe/VZ1Lar5bpOXWgf4pgrDHCRCjha8UzuB69T/FCn1SbCKVMShSWv7UeyfoOf6Uer 2DYmS0ZvlO9ezGxBnK98vfZaq/oOPcHz9uoH/0zU9MosKFjWVptF+laAxnbwUkRd/w kDeNv9N7XmIrTe0TcwpS3TohkaiD3vQ/mIvskFWjc6NFui194Kpeo+gHUHfr4MnSmY x0W0/fWd3oARFwsT76pDle5EEBnX90e+XDgqNodb5t25+/VBuJ1aPP5t1ngdAQaG3b gNwqNbGobVc/g== Date: Thu, 30 Nov 2023 17:45:38 +0000 From: Simon Horman To: Dinghao Liu Cc: Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Zhengchao Shao , Rahul Rameshbabu , Aya Levin , Tariq Toukan , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [v2] net/mlx5e: fix a potential double-free in fs_udp_create_groups Message-ID: <20231130174538.GK32077@kernel.org> References: <20231128094055.5561-1-dinghao.liu@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231128094055.5561-1-dinghao.liu@zju.edu.cn> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 30 Nov 2023 09:46:02 -0800 (PST) On Tue, Nov 28, 2023 at 05:40:53PM +0800, Dinghao Liu wrote: > When kcalloc() for ft->g succeeds but kvzalloc() for in fails, > fs_udp_create_groups() will free ft->g. However, its caller > fs_udp_create_table() will free ft->g again through calling > mlx5e_destroy_flow_table(), which will lead to a double-free. > Fix this by setting ft->g to NULL in fs_udp_create_groups(). > > Fixes: 1c80bd684388 ("net/mlx5e: Introduce Flow Steering UDP API") > Signed-off-by: Dinghao Liu > --- > > Changelog: > > v2: Setting ft->g to NULL instead of removing the kfree(). Reviewed-by: Simon Horman