From patchwork Thu Jun 24 18:55:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Rausch X-Patchwork-Id: 12342977 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39CDEC49EA5 for ; Thu, 24 Jun 2021 18:55:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1231D613D3 for ; Thu, 24 Jun 2021 18:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232174AbhFXS6P (ORCPT ); Thu, 24 Jun 2021 14:58:15 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:51138 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbhFXS6O (ORCPT ); Thu, 24 Jun 2021 14:58:14 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15OItqrg023608; Thu, 24 Jun 2021 18:55:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : subject : to : message-id : date : content-type : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=UIccMQzP2yeICMmRhxpFtWRAyLmjKG9Dv3M+DwwhxJE=; b=DUQNomIiN7zRPt5ZNlJHOpL6d521/HOzJicQ1qSjQ/8I61TgL8nPMuhLWuoEupRip8un ujzlXXiB9aUdjAG7KarZInv2xzq9N1XeLyqk6h2PwDgO5buyDUcqYrgO5J8xajKYdhGo nvCkRkmN+puc8qxHORHhTr/kOEVicaEK3Gn3oN2jrn2XGC5M9G7hD0gJsQGHyX8w55hg CxDFrRlpc85ty+LBUAzp5R33fFf/u5DzBI5ThP6w7oiDiEtW0zCB9M9pGw1Oa5sh55gR kBpcJSbi9wOFaqQ/DPSh1KVm5IkuSH00C0CzwWUHBK0vCMV6u872kotjRk0d6sSNqYds nw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 39c8twas1h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Jun 2021 18:55:52 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15OItlYW056802; Thu, 24 Jun 2021 18:55:49 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2177.outbound.protection.outlook.com [104.47.55.177]) by aserp3030.oracle.com with ESMTP id 3996mgy658-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Jun 2021 18:55:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EJQQTEKQKehtlvUkxBs7GZ3e08BUufJUorfQ0sDwU+IHehuEY1QT2ZJ1ER7yzVEwcGUl6T7In0F5iQxA/qnT6Je6U13cIfuymyOs2Qul0bUM36gVspHs9rHffAKjnHbBtOG/73vtyshohgUdg3wxApqEXsNhvdr40dfz7Kd2M5sUWhpMZJ8veFCXe8rtcIuavYs0t7DJUB+Z/jIQBlI/LGfxxSt2SRmkx5yZuJvNwHVh/7zJyjs9RceRuVgOl/B8VK3aI1FgqSIxWgky4BaJ5eGtqeCSRQLGQNN1jjOG+6g7ingqNVaGHrO6zUx8r8HLIWrBQHWnU0Q0SKNasH5f7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UIccMQzP2yeICMmRhxpFtWRAyLmjKG9Dv3M+DwwhxJE=; b=PDL/y+dOuV1UOr6BiovA4qdTebKxRAPgtf7BGv1lHOXqCn7DUDQ2/01qEFZITClpOBSh21J6lUArASlLOouPBOJAIWq15F2ZpQHl+ZLPvuCIxARYvbuF2C7lvqtbDsVOXyNGme1MOwk+Y5ler5Ot2jmzxQOVgUadlxtdphOVU6cyDbEL+g8ZIagnsYKjng2atk2n8/Hq+iFhH/JF+7pRwMvXdBqLvt69uA8mSreCTw17SDnovEQ3gADEAH0xvYtakvZ2BCjyxktD0B2nuz8+sy5F6Ay24bmboCHkTtxkE273gULbV8M242hOvaS0VxEbfYLyo0xdrxxcpAJki/hQ0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UIccMQzP2yeICMmRhxpFtWRAyLmjKG9Dv3M+DwwhxJE=; b=W3sefUws6ksoG3fi5xCvNgGsq/KeYdVsf8W/AZ1L38t31v9q3aGdzD9CrYTzflPaRzhJQdMguJwol4lVVYYPhQsd4zqqvK53LLWuOSEvHOYNJ5Z1U7mnkCimyKxYm9aJe0wRQYkELeJNtZ+6uyMGKIbarSDx7BgV5xhkdtMCKeY= Authentication-Results: ziepe.ca; dkim=none (message not signed) header.d=none;ziepe.ca; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3158.namprd10.prod.outlook.com (2603:10b6:a03:15d::23) by BYAPR10MB3253.namprd10.prod.outlook.com (2603:10b6:a03:154::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Thu, 24 Jun 2021 18:55:37 +0000 Received: from BYAPR10MB3158.namprd10.prod.outlook.com ([fe80::3c6b:8429:3eb3:6559]) by BYAPR10MB3158.namprd10.prod.outlook.com ([fe80::3c6b:8429:3eb3:6559%4]) with mapi id 15.20.4242.023; Thu, 24 Jun 2021 18:55:37 +0000 From: Gerd Rausch Subject: [PATCH 1/1] RDMA/cma: Fix rdma_resolve_route memory leak To: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Doug Ledford , Jason Gunthorpe Message-ID: Date: Thu, 24 Jun 2021 11:55:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 Content-Language: en-US X-Originating-IP: [2405:ba00:8000:1021::1046] X-ClientProxiedBy: SN7PR04CA0005.namprd04.prod.outlook.com (2603:10b6:806:f2::10) To BYAPR10MB3158.namprd10.prod.outlook.com (2603:10b6:a03:15d::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ib0.gerd.us.oracle.com (2405:ba00:8000:1021::1046) by SN7PR04CA0005.namprd04.prod.outlook.com (2603:10b6:806:f2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19 via Frontend Transport; Thu, 24 Jun 2021 18:55:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f26382e6-711d-44a1-aeae-08d93741a77f X-MS-TrafficTypeDiagnostic: BYAPR10MB3253: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KjGy2xJlHf21uOvUf6YM6FS0pINaG7F0DcFx2mmZU5zeVFyVNjJPxbkd1uVq6gPdezevGzTTBZBD8N9/NQGMJEjTH4GhDw2UfxQpFWpACaA2J4bCButfCLy9JdakXCu86pC5r3cu2bHURg+bXb3fsifDhXURTx/d6LkrLEP1t5Ha8i8NTugIW3jc+M8Iv9OGU/s/eugEQ6NfE7mFSrOTlyagVLTpfCruCangb6EDOren3IzcNS89809AZ7TusGL/MtFa9uW2FZEXRudBR70nrO5Cw3ijuCxHZ2sRl2cap02oIkUCEHUi4ClPZNjLGX2695Lk7ppAuaImhFC5+CF80PDsNBI5bQMKaoKjj/WENOt9jUewEN60qG9EwBBfe8Tjb2yvU8Ac6/MXkEDeDXNXQkGEdv2ukVjD9UvzapHq/mYqGveC0KLd7tD+b+ifC4FZupcZpMjLTEursCo3E9uK1rmJhdtbnnKTil2KLX1iu3J6F/TT7qA7RVygSHy2LiSfCZuaRQSbuCjnK3TKQUdLxIcq4dwfgNHCE90FuCyUG+kV5BYSdjMSjhoM97ndoSj6u/LjqCVvbCyVHg4PUqAeoR0HYkP3k6aEv0slXzrUI8pezqQN/QWvAevnJQ2GZrN71pWm7P2n3DTGrrJgbd4T8mFBhqH46Mt6lQOy4qp3mpphFwT+tlsMo8t7S+SeO6IK X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3158.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(136003)(39860400002)(346002)(376002)(396003)(366004)(66556008)(316002)(66476007)(8676002)(186003)(16526019)(8936002)(44832011)(110136005)(38100700002)(66946007)(36756003)(7696005)(52116002)(86362001)(478600001)(2906002)(5660300002)(4744005)(6486002)(6666004)(83380400001)(31696002)(2616005)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?windows-1252?q?Xk68ug6JuqtT6kttBc6kS?= =?windows-1252?q?YkrpQcvYwn2ktEr4CEtJdo3XZO8/4tVuor04+zs+ZsXQa3HyqpZzk+WPdx?= =?windows-1252?q?sHP1mwHeFNwsDKyg54luCh6SzI+zg+0wY1fRrnNX/BRSR9hXxQAKGi4OU+?= =?windows-1252?q?VU0O+icvRugxWrv0AZtX55IdwhISD9ugDXJpcT2LyfFSlQrGLHYQy7Xdkg?= =?windows-1252?q?fx67s5Cj4hnhUHjiHPD0nkaRJN34djNvlZ99J6AB8NbQec1U+zLAoeSA1D?= =?windows-1252?q?tmP1ipG9L2jxvSf9H72XedM1ndaI2nClkws+NlHQgeUwZFsN4RjAZ4PS6D?= =?windows-1252?q?Wn0yUHGUXSE8gTCTJx1YfxvpjVeaq4K74BKt7gP7ENZ9ooi1NNe2Pc6BW6?= =?windows-1252?q?7M+r3YDkgch7U7Dh2hh4hJRpe7C31Jr4RUddAhXIQBauPi04PQw0PxTAZx?= =?windows-1252?q?OaNsPjvBRHVaWKDG2V+aUJIN1tkdY7pZo/sk0sTKyTjajgdPy6E97BIVuz?= =?windows-1252?q?3a3LJ23iUG+yxXiVEU2RfclQuczrCeK4EhSBFPRQ7SBpdD9AWPUXBl+rhD?= =?windows-1252?q?WY+PZEIjslanUjzyrXMgKxDWwfIcbnyBYhShQULBK1boV3XuZaffdk8pZW?= =?windows-1252?q?WC4WrAfZYvy8IUTUizNqxolQtU7soqI2vmDK87n221zr1gHPtRNEurrXJ3?= =?windows-1252?q?XFLedcQtXXlxxWqZSpDD7B8pIC552rxfqzdcmIe/dklOWk3NVjVq83aBWe?= =?windows-1252?q?g2AEpcYlEnivqio2e4dDaSrY7QquDckD0Mj0gRLLFc6QBWtHGV1MWDpVa6?= =?windows-1252?q?RExK3k0ofdqudfqekh9ql2wZJ+ArH2NKqg6VVjaWqXh6kDkR15z6C3iyIn?= =?windows-1252?q?/l5PdklvG+Q+XCyEyQv14snBnlS0M73cFlDXKUVJdk7ozoJRAgn6hV/bHI?= =?windows-1252?q?GTyJrvEBBsdlY0k99Jl/9fhUY7NaYYldanE4ewZTRdMKn78KAaP14IqPNO?= =?windows-1252?q?hwUjHGIUAZ+dRtnrQ8nYqtP8tkixDtTD3Dw2lFblCuw22/7lY8P8VlFMGp?= =?windows-1252?q?nbtCyoqLlnybAxyAxXlYUHOwYQtwoaQ1FXd87IqJSMyfQuVi0r5Mndi8Xm?= =?windows-1252?q?iwTo0tmB9oF/PDpmIsnsDRZTsleXFwe3K985tFBJDEL4DMaZ/usEkbxyQl?= =?windows-1252?q?Xm6M0krTiXE8W18nogGKHw47g0G1N6//KYUCqX5QOINLhwohbCEn22BDTK?= =?windows-1252?q?hpAp+Lxys43zfRpCjd+PuqxvTWiIe3CMrX2J1O8LVH/yEIqaIjIX6ovssg?= =?windows-1252?q?lprEGlHMdFSGAaBVFIaxKjnosrFOSbISEE5ChVofWyWLtdX64h0TPAAhn+?= =?windows-1252?q?Q+ge0WGn3TX2OkNRdQUAmUloFi8Lj7L8rdLjzsC+5/saJB1QZC/x6XvR6p?= =?windows-1252?q?W5bN9u6i1UDForRxxcVhl4ih86EMYaog=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f26382e6-711d-44a1-aeae-08d93741a77f X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2021 18:55:37.3499 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bKDEXaFVs5+4mo1wm+cZ5+LQlkZCfG51QzxBiU4gaUq4IzNwLQYn1M6pCDA8ezKLLr/zSzLvG5th3cxTmhlkUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3253 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10025 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106240104 X-Proofpoint-ORIG-GUID: Fpik3jeji1AkRibb3aTMMQOmCibuW_Sc X-Proofpoint-GUID: Fpik3jeji1AkRibb3aTMMQOmCibuW_Sc Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Fix a memory leak when "rmda_resolve_route" is called more than once on the same "rdma_cm_id". Signed-off-by: Gerd Rausch --- drivers/infiniband/core/cma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index ab148a696c0c..4a76d5b4163e 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -2819,7 +2819,8 @@ static int cma_resolve_ib_route(struct rdma_id_private *id_priv, cma_init_resolve_route_work(work, id_priv); - route->path_rec = kmalloc(sizeof *route->path_rec, GFP_KERNEL); + if (!route->path_rec) + route->path_rec = kmalloc(sizeof *route->path_rec, GFP_KERNEL); if (!route->path_rec) { ret = -ENOMEM; goto err1;