From patchwork Wed Feb 13 17:07:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 10810421 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6132F13B5 for ; Wed, 13 Feb 2019 17:07:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A47B2E17C for ; Wed, 13 Feb 2019 17:07:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E5D42E3FC; Wed, 13 Feb 2019 17:07:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D48FF2E17C for ; Wed, 13 Feb 2019 17:07:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733155AbfBMRHO (ORCPT ); Wed, 13 Feb 2019 12:07:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:45510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731096AbfBMRHO (ORCPT ); Wed, 13 Feb 2019 12:07:14 -0500 Received: from localhost (unknown [77.138.135.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7CB64222CE; Wed, 13 Feb 2019 17:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550077633; bh=2UF84U+p1f2Fxe/4rfca0TTCMRlRyGxjrNh2OZLwLqE=; h=From:To:Cc:Subject:Date:From; b=Nz6z/gAaI3FQLZ1us4xefFiGU7UfaLaZam6PfEXhTegZlwTmKnTLvTIVV5Q2faW+d tOjYJfX9djzL/OlH5RE+jFFhBwrcZtLFE7NL9BMX4DbtOgQrQ0SoSz+fRxCUNljbUd 3rtEhQgmWJ8yX9sV6DP7zhlPedEUMuKA7mdi7x1M= From: Leon Romanovsky To: Doug Ledford , Jason Gunthorpe Cc: Leon Romanovsky , RDMA mailing list , Dan Carpenter Subject: [PATCH rdma-next] RDMA/uverbs: Don't do double free of allocated PD Date: Wed, 13 Feb 2019 19:07:05 +0200 Message-Id: <20190213170705.18702-1-leon@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Leon Romanovsky There is no need to call kfree(pd) because ib_dealloc_pd() internally frees PD. Fixes: 21a428a019c9 ("RDMA: Handle PD allocations by IB/core") Reported-by: Dan Carpenter Signed-off-by: Leon Romanovsky --- drivers/infiniband/core/uverbs_cmd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 4f70b34dc3fa..5425e0e534e2 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -440,6 +440,7 @@ static int ib_uverbs_alloc_pd(struct uverbs_attr_bundle *attrs) err_copy: ib_dealloc_pd(pd); + pd = NULL; err_alloc: kfree(pd); err: