Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1384457lqj; Mon, 3 Jun 2024 22:37:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXxWwQPfw4gicoMZZN9e+4hIzxsTx+JmT1bWGX/fNzxphY9K6GejvSWh/QPAXCkCiQgbnLAXz0tBMNoKTQ0xuDuZ77TvlAC1UxaFG4lgQ== X-Google-Smtp-Source: AGHT+IEn4nY18c4kQSHBu1aY20R+a4hg0LFEK4GBWQXbE9Ti49mydq8+p5A3/ux6Lcwsv7kpmor7 X-Received: by 2002:a05:6214:4347:b0:6af:232a:1910 with SMTP id 6a1803df08f44-6af232a1c06mr114385766d6.7.1717479422180; Mon, 03 Jun 2024 22:37:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717479422; cv=pass; d=google.com; s=arc-20160816; b=V2RHprVw0B+aTFwoL32w+MkWUBWHkyVtkDHCf0DhOZ8L91UzRnYsWrtW/Ay/24rRfQ IMTDtK2a/UuB7qpPCj4r4ngSsTEFIWxgjMm3H481edIzptl3WCCACTGv7VFQqxAfKBIr +A5feUEEzXyuVv082wPGMtwuUvMar/L2cUkWL5myS8zfisiYvVbJ/qtoruZENW4t7019 Xkqf2KNzwyIWRycCEnY9jmCwj3L59ltif/p5aEP8foni9RjH/gKxiN6QupEU00RfaZs4 nUz8YTrzqbl8XVFrCYdpH/TaRNn3/tLw6zW7w1Wm8hNQhMSuCn0TViZSpfNrc3ctyt2U omVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature:dkim-filter; bh=eG1FDBv4R7lC9lHB6vwHEI8Q/I2FDjn+gY+OQPTwEx4=; fh=Oh7ISTCnTTAwBTFe2MGd4+/TilShj52te/ioKdU9yfo=; b=UTSmIAj92ZA+0q1fQwN0yqE7pnNnzKiI8iqXGsl7y3uKqtJVxLx+v9G7rP7VaCyIPI jmkLGoDGf9O3v7k/Sh0Ae91VQcpFQQe1HMFfU9jBUjtzWDsXkriIRWWG9dnJmLRwrLqO PikAe3TePE02+ddP6y7py1wJLHXFK/IOZ0HfL7Co8ytLzhhVC5z7ZAyjcHdfT2JnDr2p n8xyBxD1J6hABYU/izo4yDJHJ7w/KJGH6BeU6Lx0UJAL3DRJvuTXt9P+z7eUySxJ9WFt gP3qa4VUJiCcoL1nEL247yrRw25+IPTLwf2JARxHHgZnfB0zNCSb7pFZM7CvPGPuCQb4 nDVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="bK8/7ODJ"; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-200064-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200064-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4a733b84si1569536d6.38.2024.06.03.22.37.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 22:37:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200064-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="bK8/7ODJ"; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-200064-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200064-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E1AA71C22CDC for ; Tue, 4 Jun 2024 05:37:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FB3913E3F2; Tue, 4 Jun 2024 05:36:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="bK8/7ODJ" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A39113D2AB; Tue, 4 Jun 2024 05:36:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717479410; cv=none; b=pRkccZA/97kEIwUi7Sr9IY7E/TYKeye2oPw3M0pqfavlQZykYkVsyZu4aMxTSl5gGAxu+etGOpz5yZ5df/jhB7DfGnO5IqRjJCTzI+0GpHaDi3gg0Hq7wXYmtwzi94DhVUQxfUh6agn76Jd5g3BgtAhAF+GVvMDPEibShlJZxlw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717479410; c=relaxed/simple; bh=jXpqd3FK/H/WNfQ5ni71NMR/LyQjoR0FbNVZYK5g1pw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=II3WYOVDhkK+vDac/zno5K8erOT9nLyXLGXQebkz6p6u+i9BvhRs5CFmFsq0YUf1pEMRGZBE5YojB3orW38pvqnU6pQrXCeusl8G3I7QuBLJ3v9AXB9mCOqalcnnDBAeegpvcr0DUik0aX8ZKx2181G3u6l3UUjyRs3XQ/Jy+1s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=bK8/7ODJ; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: by linux.microsoft.com (Postfix, from userid 1134) id CFE3120681E8; Mon, 3 Jun 2024 22:36:48 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CFE3120681E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1717479408; bh=eG1FDBv4R7lC9lHB6vwHEI8Q/I2FDjn+gY+OQPTwEx4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bK8/7ODJAyp/AdqWEbg21wvN62rRE4DCYtKwZozOr0P9Y7uzei0iX0fVAX9g//0NR VNc8ZRp9gSDvEKQ1oAQiiSzO2Vy/SlCwo9znaQU1bmGC7ZL2kP6UJxktgZ684D/qsC Rv5rkF60/Dcq+Sa+B3rnqI5ulPNZ9o8+yBAhSQnk= Date: Mon, 3 Jun 2024 22:36:48 -0700 From: Shradha Gupta To: Leon Romanovsky Cc: linux-hardening@vger.kernel.org, netdev@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Colin Ian King , Ahmed Zaki , Pavan Chebbi , Souradeep Chakrabarti , Konstantin Taranov , Kees Cook , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Dexuan Cui , Wei Liu , Haiyang Zhang , "K. Y. Srinivasan" , Jason Gunthorpe , Long Li , Shradha Gupta Subject: Re: [PATCH net-next v3] net: mana: Allow variable size indirection table Message-ID: <20240604053648.GA14220@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1717169861-15825-1-git-send-email-shradhagupta@linux.microsoft.com> <20240603084122.GK3884@unreal> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240603084122.GK3884@unreal> User-Agent: Mutt/1.5.21 (2010-09-15) On Mon, Jun 03, 2024 at 11:41:22AM +0300, Leon Romanovsky wrote: > On Fri, May 31, 2024 at 08:37:41AM -0700, Shradha Gupta wrote: > > Allow variable size indirection table allocation in MANA instead > > of using a constant value MANA_INDIRECT_TABLE_SIZE. > > The size is now derived from the MANA_QUERY_VPORT_CONFIG and the > > indirection table is allocated dynamically. > > > > Signed-off-by: Shradha Gupta > > Reviewed-by: Dexuan Cui > > Reviewed-by: Haiyang Zhang > > --- > > Changes in v3: > > * Fixed the memory leak(save_table) in mana_set_rxfh() > > > > Changes in v2: > > * Rebased to latest net-next tree > > * Rearranged cleanup code in mana_probe_port to avoid extra operations > > --- > > drivers/infiniband/hw/mana/qp.c | 10 +-- > > drivers/net/ethernet/microsoft/mana/mana_en.c | 68 ++++++++++++++++--- > > .../ethernet/microsoft/mana/mana_ethtool.c | 27 +++++--- > > include/net/mana/gdma.h | 4 +- > > include/net/mana/mana.h | 9 +-- > > 5 files changed, 89 insertions(+), 29 deletions(-) > > <...> > > > +free_indir: > > + apc->indir_table_sz = 0; > > + kfree(apc->indir_table); > > + apc->indir_table = NULL; > > + kfree(apc->rxobj_table); > > + apc->rxobj_table = NULL; > > reset_apc: > > kfree(apc->rxqs); > > apc->rxqs = NULL; > > @@ -2897,6 +2936,7 @@ void mana_remove(struct gdma_dev *gd, bool suspending) > > { > > <...> > > > @@ -2931,6 +2972,11 @@ void mana_remove(struct gdma_dev *gd, bool suspending) > > } > > > > unregister_netdevice(ndev); > > + apc->indir_table_sz = 0; > > + kfree(apc->indir_table); > > + apc->indir_table = NULL; > > + kfree(apc->rxobj_table); > > + apc->rxobj_table = NULL; > > Why do you need to NULLify here? Will apc is going to be accessible > after call to mana_remove? or port probe failure? Right, they won't be accessed. This is just for the sake of completeness and to prevent double free in case there are code bug in other place. Regards, Shradha. > > Thanks