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 X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D309C433DB for ; Thu, 28 Jan 2021 00:12:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C95E064DD8 for ; Thu, 28 Jan 2021 00:12:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231364AbhA1AMm (ORCPT ); Wed, 27 Jan 2021 19:12:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:51090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231616AbhA1ALj (ORCPT ); Wed, 27 Jan 2021 19:11:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D41A764DD6; Thu, 28 Jan 2021 00:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611792619; bh=pg8FEOGF1w41Q4s3Rc66aRDXuknOxLXlsy0Wg43bVCo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mRDiUgt8SVu2OzraAsr3tDOCqB5fA0jF0vgUNNleXGRODZNj5swAWrnpm0jXfiBs8 mwTJtNrss9Pdo4va6BvKfm2Aofm2j8lj//lJ+/FgPwhMhynnZaTJyAQTgCPCzvy8pG cspnoufnJLW1CFVPXDl/iYHgtHTImTyPtLmmk07G5i84k3tohMN+aBRMrlgyHqYB78 a4Q3PmKFeKRrDleEzd7v8oqhuS0Fh3XBFzl6fgIVVnv+zWh0Lny/5sGVHpW79DjWyx H3MHk7T8dWfZqJZbhpgVJPhHCm+k4+U6gy1SqtnG7ZTZ0y22JLewXrZObo6PAYav/8 BCRaRkPf4E86A== Date: Wed, 27 Jan 2021 16:10:17 -0800 From: Jakub Kicinski To: Ronak Doshi Cc: , Petr Vandrovec , "maintainer:VMWARE VMXNET3 ETHERNET DRIVER" , "David S. Miller" , open list Subject: Re: [PATCH v4 net-next] vmxnet3: Remove buf_info from device accessible structures Message-ID: <20210127161017.2d9adf4a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20210126190640.26942-1-doshir@vmware.com> References: <20210126190640.26942-1-doshir@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 Jan 2021 11:06:40 -0800 Ronak Doshi wrote: > buf_info structures in RX & TX queues are private driver data that > do not need to be visible to the device. Although there is physical > address and length in the queue descriptor that points to these > structures, their layout is not standardized, and device never looks > at them. > > So lets allocate these structures in non-DMA-able memory, and fill > physical address as all-ones and length as zero in the queue > descriptor. > > That should alleviate worries brought by Martin Radev in > https://lists.osuosl.org/pipermail/intel-wired-lan/Week-of-Mon-20210104/022829.html > that malicious vmxnet3 device could subvert SVM/TDX guarantees. > > Signed-off-by: Petr Vandrovec > Signed-off-by: Ronak Doshi Checkpatch says: WARNING: kfree(NULL) is safe and this check is probably not required #39: FILE: drivers/net/vmxnet3/vmxnet3_drv.c:455: if (tq->buf_info) { + kfree(tq->buf_info); WARNING: kfree(NULL) is safe and this check is probably not required #73: FILE: drivers/net/vmxnet3/vmxnet3_drv.c:1737: if (rq->buf_info[0]) { + kfree(rq->buf_info[0]); You can remove those ifs as well.