Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp466008ybt; Fri, 19 Jun 2020 06:13:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznNA60EBeb5c6ZgQltEBNR4Fi3SBlukuFGJwRn6cXwtzdz+h9JXULGSdzICVN7mBN7v/A1 X-Received: by 2002:a05:6402:1d82:: with SMTP id dk2mr3164281edb.75.1592572391631; Fri, 19 Jun 2020 06:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592572391; cv=none; d=google.com; s=arc-20160816; b=KNy67cJVMsNpITcBGWuWnPtVLuPhiRpYqCa7klA9S42zHAWVVXrPcLRm4Hgc96iqYQ /0yF6AXIdZ7v0hLxG1ew07yrpj1tIjgrpj2uL2e1Aqt5D3mSw1RnoaEZo9m6rNDYtwGn mgtoxCNWKKRyY7haaPFKpkJgp8ESubjulqavQjOtTE5r1d6Z6j5V9rU0pzLy2lMlKXA+ 9+Z5A8yjxsckkw1AhxNAHN2XTWbSLZo6bXFYQNrMFNiCWK3YWooRzA2bacG+N+2UV7H0 lFzrmsW0d5mPYNjBHA1n+4AuFoon6xR9z5Pd7JitkOKnT/adjVWb8gMoRfYfSvKqeSJF Q7+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=Mpz+FtahIGVbaWCXUqlKnR3T+YHk6o26tu6s0yCqAdA=; b=CcgUwBwGsibuSfJURZUZWok4Jgz5jKQoFIwjNQ3bqnuvAyHMHO/XY/4lJQY3z1Pukk Uvyt/VeZHHe6osYJIh2huhwcYK7TkudUaMICq+8JRfDgOSHwk0QqOaLVqmctaOWBHDpy NJU8vHM4CFBoQpMGX0Jg8wI+rxVEbBwC+Zty50eNBj24w3vdYxsYTsLezDJJblVCvYa7 76tx48RmecBwKLl/gncwarwKUVxp+0vqOAiDFvDmvMjAGuLvTO9Qo8z3p8hfeDNlzASM AmIgewsOCyP0eWxuMWfbjhjbT7FKirK3lDqOSxWJaeqVaZDenaTavn82uk3ebXZU4KeI nfnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UuiTQ484; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b24si3895385edx.176.2020.06.19.06.12.48; Fri, 19 Jun 2020 06:13:11 -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=@gmail.com header.s=20161025 header.b=UuiTQ484; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729513AbgFSNKd (ORCPT + 99 others); Fri, 19 Jun 2020 09:10:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbgFSNKb (ORCPT ); Fri, 19 Jun 2020 09:10:31 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32D87C06174E; Fri, 19 Jun 2020 06:10:30 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id i4so4278799pjd.0; Fri, 19 Jun 2020 06:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=Mpz+FtahIGVbaWCXUqlKnR3T+YHk6o26tu6s0yCqAdA=; b=UuiTQ484P8miKGDp4jn4oAJ5OMcCW4IFNTRppv0vZIjCXuc2+8bDL7tLuuCvveGwNm JXtBsUY4wpCH5bGp4xB6z4jvD51GCFNtg1Irx8cAC4rVmWv8VgKRXSvqS7Sgo31GzoN+ B0rDHgMGhkqFrjPRtouQ7JBLdIqxeHJSO7mtBLBSpPzXnq+7/eo2Imt/DcDnhJWg4Uqn LGWuZXfRQYpwciONKdtgXCd45ic4eF1ys0JKtiZCXuvIm6z4AW4NWDCvE/toaQtHnqo6 4OwkGCYIUK2arabhNxZIA3tMDmWciRINV6mUpvGdXLn24rzmTAoD6I12zFVp2mWnRP5o x1HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=Mpz+FtahIGVbaWCXUqlKnR3T+YHk6o26tu6s0yCqAdA=; b=UeUwqHfKlN2IwgW39QJWajOzHEoi33EcPGKZKk9UMoh2tiFMn8i5+DmWYribBs/zZ3 V+Ns6lfIpJQ8qymPbzLoktWnmewnq2IrVhfdJ7UU7Spd0fmDjDa4geVvnNcWuFFDsPsI AgA0XPbAfom1LC9YVYlLKX4HlkQmV4NSjzfsyhUQ/jPnZtvhBNSiY9nIr5Y8B8cRJq+B AQsAB9DKsLrjlUJYZL4dJ919dZZOEpN9H3/oP70cIa49csa5UbkPqTCdnoyCrAc7PhUQ 5WYbPXI2+qAYPGNrzMKZNyjGe4dAsKq3gaad2ig8u77ZCaAxnYIVzmn1dFpCXfdoyO6f 7FUQ== X-Gm-Message-State: AOAM532qWnwcfxw/Cvs6T3e0OXkLqXeDrGRTmHR1xPooacVM61N7Cxeh majhILR3UBHTXpFxtmrLLTRLN0ycHnU= X-Received: by 2002:a17:90a:e60c:: with SMTP id j12mr3524233pjy.185.1592572229826; Fri, 19 Jun 2020 06:10:29 -0700 (PDT) Received: from debian.debian-2 ([154.223.71.34]) by smtp.gmail.com with ESMTPSA id w18sm6062762pfq.121.2020.06.19.06.10.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jun 2020 06:10:28 -0700 (PDT) Date: Fri, 19 Jun 2020 21:10:23 +0800 From: Bo YU To: danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, ledford@redhat.com, jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, tsu.yubo@gmail.com Subject: [PATCH -next] RDMA/rtrs: fix potential resources leaks Message-ID: <20200619131017.pr7eoca2bzdtlbk4@debian.debian-2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dev is returned from allocation function kzalloc but it does not free it in out_err path. 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