Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp472134ybt; Fri, 19 Jun 2020 06:20:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnKQxA26USBdlDzmUXPOTCcVqoXBIkTTvQ7uP1fR4Hp5qD6z/Y0kp1Ha9MMO/Fo0Xt7HiO X-Received: by 2002:a17:906:830c:: with SMTP id j12mr3796115ejx.330.1592572838465; Fri, 19 Jun 2020 06:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592572838; cv=none; d=google.com; s=arc-20160816; b=bO40WbjtejzTOP1cJmxnIjaJZLvmmBEIw24PSkTf3RttsEPd+/Tz+5pq0eR6A+19s1 VCRwKUxGrBxXyszPi2BFMP6JqMhaofajIzJBErlGZoxUnr3mltXL7hcI70UGODVD5j3t Ip1lEfg1pzxy720GTtDy8pC1y/K1f0rqnGN6NuF3rk0tKveTEEp082Pq2XrphaD5JiCL pNePy3JQtOylkJ8Dz4c7i/njsl+M3XzE+kvNaSrahNLUGY0dJ/JnQwz232Vbu1O9ktMi n/4B/2D63S8NDplfIiDUqHxvCZKYii6H/ppl4KIyc/2/oEQcfGlDSio3t6ew/6p7eV7/ vJ4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5wOjmdghDgCr0CVW/w+ANaHsM9R02N+bI2f+Qakkg04=; b=dUdGFryIUJQp0c72zESa9evZ+joZlNGMERJMkL2r3BJuTKGHdZAg/LmUgVeVxov/PH 4TqNeo8njYNr4s2jvCIXOYCFammdTkPPPI+0/RD8l4vPRHzshyPylwPEVDuik8qqV6s5 flO9XwoyEfCFIajUseNNE++BmzeIkT7+kBstYc0Fx/baP935QuprOIrM2kwIDz5jc7Ak p2dXXz1DSoBJpSRdvCp1AkFHIFdLx1q2NvhDGJeIa0Fvbyrx2c2otSviBVkHzHwJ6u+a WggV2ny90WewABKeGivMON9NZi0od2PhCoyvfkCoD40iOfgc9Y0NTvcxLc2TH3NwZXHb cWiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=AdMIDDOm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw15si3538301ejb.583.2020.06.19.06.20.15; Fri, 19 Jun 2020 06:20:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=AdMIDDOm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732259AbgFSNRR (ORCPT + 99 others); Fri, 19 Jun 2020 09:17:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725806AbgFSNRK (ORCPT ); Fri, 19 Jun 2020 09:17:10 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA56C0613EE for ; Fri, 19 Jun 2020 06:17:09 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id n24so10193253ejd.0 for ; Fri, 19 Jun 2020 06:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5wOjmdghDgCr0CVW/w+ANaHsM9R02N+bI2f+Qakkg04=; b=AdMIDDOm48JzlgAbMfmdT7CMIHIeIBvHJyz7mPGtN6zJk4LwqgxpN/hZGdVo0VASAt Lyw5m3PubCEZ+10hrq5KRfJX+fVs3MMW8GT4hHjcTe00VvX7WXAvB/G5cJfB+LXHAIGd 3122mSxKPYSxh37gtVhMYpuVAfPn6lcGEM2sgOE9gdVa0zSKXwwbwypwKkFYGd38UjIL fg4a0/oV1LuvsP4jJwib7V3BXTCwIsOP2GvedZQw10ii3DEtcC/andJeIqgYz9O+nbah mqJ0BBHzsja5eM9n1nypxvL8hTTxM4/cJRLCCvUeVE8VfFnEJ5rnD/4xpsZXAptDK1aI W0Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5wOjmdghDgCr0CVW/w+ANaHsM9R02N+bI2f+Qakkg04=; b=VN0AJtr14sJYfxtARxgkhpm8o4DTsVOr9gpmk5sFsj88ARQ3M+BbhQ9EWTiSRtwoY2 2QL4Vu3meunyp13Jvqm1SUlNRScyWq1l+Zfs6Y9q3T3FqCrHaWJgYdxcCrWZh+29vAIo 0tSzAeMKcHJb2NH3V1PwFoFj7f4kJ1pombIhfL3V/62+n3Pp3DbrZLqi5AC/y+yyRvF5 bG4/CWtps6DGBl0rO7ZuTVeuMRX4cpvau0GX1PC8d1/CzNhTNfnWrHFsyJ9dxwluatGQ v+ynQ9p0tvmQr9Ajfry40m51wSa79pseMT10l1Q//jVwx0bdeafvsZdywT4lAznGBN+V Z3/w== X-Gm-Message-State: AOAM532EnwlttH9dtvA9t4e5yfzpszgT5YuFcuCberoGNKLR22akb27l u9KOwIF7s/bUqoxj/GJw4dqpKsTw8baAyC9U+kAr+A== X-Received: by 2002:a17:906:fc13:: with SMTP id ov19mr3575299ejb.212.1592572627815; Fri, 19 Jun 2020 06:17:07 -0700 (PDT) MIME-Version: 1.0 References: <20200619131017.pr7eoca2bzdtlbk4@debian.debian-2> In-Reply-To: <20200619131017.pr7eoca2bzdtlbk4@debian.debian-2> From: Jinpu Wang Date: Fri, 19 Jun 2020 15:16:57 +0200 Message-ID: Subject: Re: [PATCH -next] RDMA/rtrs: fix potential resources leaks To: Bo YU Cc: Danil Kipnis , ledford@redhat.com, Jason Gunthorpe , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Bo, On Fri, Jun 19, 2020 at 3:10 PM Bo YU wrote: > > Dev is returned from allocation function kzalloc but it does not > free it in out_err path. If allocation failed, kzalloc return NULL, nothing to free. > > Detected by CoverityScan, CID# 1464569: (Resource leak) > > Fixes: c0894b3ea69d3("RDMA/rtrs: core: lib functions shared between client and server modules") > Signed-off-by: Bo YU > --- > drivers/infiniband/ulp/rtrs/rtrs.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c > index ff1093d6e4bc..03bdab92fa49 100644 > --- a/drivers/infiniband/ulp/rtrs/rtrs.c > +++ b/drivers/infiniband/ulp/rtrs/rtrs.c > @@ -607,6 +607,7 @@ rtrs_ib_dev_find_or_add(struct ib_device *ib_dev, > else > kfree(dev); > out_err: > + kfree(dev); > return NULL; > } > EXPORT_SYMBOL(rtrs_ib_dev_find_or_add); > -- > 2.11.0 >