Received: by 10.192.165.148 with SMTP id m20csp1211688imm; Thu, 10 May 2018 07:19:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoVQB4Fvlb7LUIPH1OPR6iYvD/lvGZd3KJcHiuKV11sE84HoNshPcRYWReuuDGwy54PsZO9 X-Received: by 2002:a62:a21e:: with SMTP id m30-v6mr1575208pff.251.1525961967090; Thu, 10 May 2018 07:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525961967; cv=none; d=google.com; s=arc-20160816; b=IOgt9jhnXi0iz6QOY53nz4uwMhpV68UJc24uBnE7Q50A67bCfProegc3/po22ERXE7 o0y8XruMt6piEn05fxEXuEEKCuLdtIRFEvi7TyRMSUbs8cYF+qie0wSyj6JOuwBvalD2 Ey2nJliX7hAYiAUBrBUWlX1QjP6N/BPMlTzqGki4z1PXn5OU7u/JzggGnCMM3filyA6h DjkLqGSqC+tys/AjrIdBamr2qWOt+qKtC49j2iMB0QVS6HcOHLLCwo0uw4QkWWgsJwZM csW3galHNz+sDJHBS9TCuUidAQaRgRkgmW+mV7xuyCUJqydJuZLyojugXkyhsdyNb1Yc SfZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=CAYkz+Un+gvAmoW8PlInO+Mt4FBOXOSZkcn9zNRAWmI=; b=qzdcWGnmTcPcYTXCrZcc8ieKnkMIIsKOLL/LBOqCA1+LMYh+K2uj8Yb27LiBCnUU9Z VJdWVg4ZE+1FxTyQC3Kdts47mg2UzlQhO0k1DskO/Dtle0P8aTiya/Yzz67N+9gfXMP2 iHJhhQWHSMzg6LTCbXMo4ca8KjiYhmF1HxWjgrbaWkCWJELkqWHsCIqPWNorY4kmjYYb gB7+t44/wTyp0mzuRIa9QYeccppdom0qzG78oWrPsGhiYdG8Y1MQO//Em+/78gTYS50M dzJ6IOHiCitmh8XQthIvl5cyFRqRrBSWwZgixUzyhUyJAh4n32C083hAVyC/enfneK77 1Uuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=O0Yhir6n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l12-v6si842369plc.545.2018.05.10.07.19.12; Thu, 10 May 2018 07:19:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=O0Yhir6n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965487AbeEJOTB (ORCPT + 99 others); Thu, 10 May 2018 10:19:01 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:38384 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934609AbeEJOS6 (ORCPT ); Thu, 10 May 2018 10:18:58 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4AECWb8010451; Thu, 10 May 2018 14:18:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=CAYkz+Un+gvAmoW8PlInO+Mt4FBOXOSZkcn9zNRAWmI=; b=O0Yhir6nKPXz4XdFACIIeRmrdtj/uR8vdPn3OX9VQfz4lCP5T7nMyd0rlSYNc5jRVkHw IVvBVo5TTF+LR+6qz0f5k/cgsyahvfcTyjY5qcPj8uZ9QnN9UrWD35cRLPwwZmRflqGP vX0ug5U4uMilKKLA+KjWazgGZiVFYa+KaS4RVFqcMzHpwdRWyzVVMVJTg5PHVV7KOYzW c2p1TnPEX/vxBwNN9fphSrdPVdlVuTvQJegnaefK5DvKmDR4yuZIYiVgmOE0UDz4xB1G /HPP8lCKAqj6TFyu0jUD/R/a9Yx6BEaH9VfsBBE8o1juPUyS4IfkuvW0PiglChi9lQ1D NQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2hv6kpbtt3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 May 2018 14:18:52 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w4AEIqGe032706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 May 2018 14:18:52 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w4AEIom0024755; Thu, 10 May 2018 14:18:50 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 10 May 2018 07:18:49 -0700 Date: Thu, 10 May 2018 17:18:36 +0300 From: Dan Carpenter To: Yuval Shaia Cc: Christophe JAILLET , davem@davemloft.net, tariqt@mellanox.com, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] net/mlx4_en: Fix an error handling path in 'mlx4_en_init_netdev()' Message-ID: <20180510141836.2qlm676j4675buti@mwanda> References: <20180510070226.19575-1-christophe.jaillet@wanadoo.fr> <20180510133808.GA10943@lap1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180510133808.GA10943@lap1> User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8888 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=316 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805100136 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 10, 2018 at 04:38:08PM +0300, Yuval Shaia wrote: > On Thu, May 10, 2018 at 09:02:26AM +0200, Christophe JAILLET wrote: > > If an error occurs, 'mlx4_en_destroy_netdev()' is called. > > It then calls 'mlx4_en_free_resources()' which does the needed resources > > cleanup. > > > > So, doing some explicit kfree in the error handling path would lead to > > some double kfree. > > Patch make sense but what's bothering me is that mlx4_en_free_resources > loops on the entire array, assuming !priv->tx_ring[t] means entry is > allocated but the existing code does not assume that, see [1]. So i looked > to see where tx_ring array is zeroed and didn't find it. > > Am i missing something here. > It's zeroed twice. alloc_etherdev_mqs() allocates zeroed memory and then we do a memset(priv, 0, sizeof(struct mlx4_en_priv)); regards, dan carpenter