Received: by 10.213.65.68 with SMTP id h4csp927944imn; Thu, 22 Mar 2018 11:34:23 -0700 (PDT) X-Google-Smtp-Source: AG47ELs65oQ3S8d0eIaO924EeB91346KbqLHoxzrnCLI3aLah3xgvP42t+6L0nbDIFYaznG3cyMg X-Received: by 10.99.114.77 with SMTP id c13mr18577602pgn.286.1521743663107; Thu, 22 Mar 2018 11:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521743663; cv=none; d=google.com; s=arc-20160816; b=fWJmw0vvYXJ9cmg/hEC22EWpz5ODHylOEMiAlSs2TcGb2P9WVMqQ5Fs/QGPZQuKQTj Vo9QxeoaWcynT4mj7x2XuUaVGHgi2STexllZSZi6S/dYC2vbkGR4AyykYqjdamM0e0us tjFr4h3lMotg0GJKCjH1DFMn993uPA4QEp2imbCciDjZxCqhdmTgnt9Efkr3bN+kDYy5 hH1hynVwjiZV8gvrStQT3wBwFVWT+2BwsLGu38QdQX42YQAKnvKKONsI2hYG5aHaU5KV fJbnAyCQ5rtyh3HwawXbLD2LMaOkge+5tT0H++kB9DZL9nCuXmNVJAPZwrLs7vYAUaRy TtTg== 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=2t30tK5NpwCnnV3OBvN0mkZ+caYnTd8LPuqdCH88nqc=; b=sC8KQGmfgkHbdO8SYHGSm8eu8o2jBEPIHYXZOsSNVwdVq9UILgplpLisKm/spgqDdL 5dD0UgG6OKuxV34mU6MjyGL9xkZO+y33nHwFiEi+lRY3AEG60i2GICbPn5Ugm46G1yMA TFt6JFYgI69riPPGdxyWInV2b4s6Xq8UHhiES67LLLd87zfVDYW2ByMPa558zQXY2lzz DdRyeRRUf40iOpvF+XXg18IyG+Sh0C4higO4S5YVigiDDF/+RmtNcVtorM/9V3r7NR8x Rmx1rdlxJncbGkXOTFxu+9VZsL5pKVTp5BvMdyBe6jzfSZDBEm4vDySV8JbiC2tOIepZ +PBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=ik6JTBjf; 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 g3-v6si6522277plp.662.2018.03.22.11.34.08; Thu, 22 Mar 2018 11:34:23 -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=ik6JTBjf; 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 S1751835AbeCVScy (ORCPT + 99 others); Thu, 22 Mar 2018 14:32:54 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:37980 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbeCVScw (ORCPT ); Thu, 22 Mar 2018 14:32:52 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2MIKlHO183684; Thu, 22 Mar 2018 18:32:35 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=2t30tK5NpwCnnV3OBvN0mkZ+caYnTd8LPuqdCH88nqc=; b=ik6JTBjfAl6VoYLEGKhQjyFCShO4azWc77l6pKnBd3uCw1K1eJWW08msMN9TJGFAbzgd 7sF7oYzIRz6EnXwww+3/gKgnBKyNnpE9HiwxO2WsQk8clUK8lACDq2HlRUw9djshJeoh oqb5LK5TIwg9alfrvIN5bAWC7NPWV463y1cYbkDNQFiGKUTXPv/9/+DbBwtDMxr0AEb+ CH2SCPBvCnxllCiBIc6JQPPcFcKM1p6UgwXwaIb/zodqAvyAFiFZtAmaqf3YSeqr2J5b 5vjU86i+5HwtB1zFZAORUUVl0UDhTJg7OV/Qdq+SamDN3ztubP0oTYu7WUewj8J9S2IK 4w== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2gvhjmg3gg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Mar 2018 18:32:35 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w2MIWZm5014509 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Mar 2018 18:32:35 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2MIWYke012655; Thu, 22 Mar 2018 18:32:34 GMT Received: from yuvallap (/77.138.186.148) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Mar 2018 11:32:34 -0700 Date: Thu, 22 Mar 2018 20:32:26 +0200 From: Yuval Shaia To: "Gustavo A. R. Silva" Cc: Ilan Tayari , Boris Pismenny , Saeed Mahameed , Matan Barak , Leon Romanovsky , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net/mlx5/core/fpga/ipsec: Fix use-after-free Message-ID: <20180322183225.GA24009@yuvallap> References: <20180322180342.GA18505@embeddedgus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180322180342.GA18505@embeddedgus> User-Agent: Mutt/1.9.2 (2017-12-15) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8840 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=9 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=960 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803200127 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 22, 2018 at 01:03:42PM -0500, Gustavo A. R. Silva wrote: > _rule_ is being freed and then dereferenced by accessing rule->ctx > > Fix this by copying the value returned by PTR_ERR(rule->ctx) into a local > variable for its safe use after freeing _rule_ > > Addresses-Coverity-ID: 1466041 ("Read from pointer after free") > Fixes: 05564d0ae075 ("net/mlx5: Add flow-steering commands for FPGA IPSec implementation") > Signed-off-by: Gustavo A. R. Silva Prefix should not be that long, a short one as this is enough. net/mlx5: Fix use-after-free Besides that - lgtm. Reviewed-by: Yuval Shaia > --- > drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c > index 4f15685..0f5da49 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c > @@ -1061,8 +1061,9 @@ static int fpga_ipsec_fs_create_fte(struct mlx5_core_dev *dev, > > rule->ctx = mlx5_fpga_ipsec_fs_create_sa_ctx(dev, fte, is_egress); > if (IS_ERR(rule->ctx)) { > + int err = PTR_ERR(rule->ctx); > kfree(rule); > - return PTR_ERR(rule->ctx); > + return err; > } > > rule->fte = fte; > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html