Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp20203ybp; Thu, 3 Oct 2019 09:35:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzc9ZOsEwd3s0pdH4+NIYmRpsceDs+o2+Zu0ywbVzapoWfLgVYmT4Wb6Je7j7kIuFt8Q9oW X-Received: by 2002:a05:6402:128c:: with SMTP id w12mr10478426edv.158.1570120555128; Thu, 03 Oct 2019 09:35:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570120555; cv=none; d=google.com; s=arc-20160816; b=LqW2pTjc7vYZzID7gPYa9sQkb2G5LXiwU0DDag5chJFg/9hfW/NgFuMnAw6JeeuQ6W qxAPKfFIxCfIKCbFgOee0WDUoJwqvRlVp8YX4iLVoItjc4+7F48yirqsPikKjlp4jJhn 4CWQHrYs4PpSleK+G0PeX4G0YUXDMD9moxV+2AK7FDpSx9X6MIaxPztZTcyizhW2iQg+ LmNqHfQqCvcIpRbCEApfgFUahY0y/boMQvjNM1FPLc89dG/KjkDjwRthmeAaFl0dkjWz C9sbAfPpqC6BHLpocbThFAk59AJwJdzHQZbs8+l3iT75QgvSi7C4HJNZ3EPpbymMSIs2 uU4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7W71y6X3gSb2fnVb9qp2CBCwxye5hZc/emFAgblf7i8=; b=kOckV+Mi9hJpVnfxn4rt5BH9I0SRg8CKyY45h9xO2AlZTPmJTILbQLX7qrwFlMRaD9 uvliLQXEVp7S3iuqKTuUvh4FsSMqfEsjoJbzChrG0cxY3TId5PUBoAlhTTNS0/fpHUGh 9lXCXKj7JBGZ7CA2vRB5OYczwUDZmuRFny9ZHYqd8/KRuPAqEhiEJhpJ2SMPNvDwYPni nGBOrIq/gogQhpOmCR2CVni8JnfO99uG5S6sUOIBT3K3o38SeDlyUDgfl3GbcuAdvQUN I/XF5RgxHfhBqJr+BVWSmylcaO4SwYVTnN+5FWneVaUeraVtR/LWBGhBvrWO+Mywu1bj Suig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i17LURVD; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m39si1889265edc.243.2019.10.03.09.35.30; Thu, 03 Oct 2019 09:35:55 -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=@kernel.org header.s=default header.b=i17LURVD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404103AbfJCQd6 (ORCPT + 99 others); Thu, 3 Oct 2019 12:33:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:42152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391473AbfJCQd4 (ORCPT ); Thu, 3 Oct 2019 12:33:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 F3C8B2086A; Thu, 3 Oct 2019 16:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120435; bh=WaXkzYUQZiX+6yr6ucA7h70yZZ/D3f1BdAj3GtAl+L8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i17LURVD6np+kbg4gs+2A5LcfigoIDbbqryLzhjv571dRaYv5Wvdm6W/DnKWRRNWb 3QFMhZto06QZqJkoT+pg4dQAHxdOAHGpSiCdCZ9LBsLjg2+A95R6uzU4bhxXHyVF0J E/3o0KcoOGVH5PUoNunZ1UQ10BnmTlfloLnk0wXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Danit Goldberg , Jason Gunthorpe Subject: [PATCH 5.2 221/313] IB/mlx5: Free mpi in mp_slave mode Date: Thu, 3 Oct 2019 17:53:19 +0200 Message-Id: <20191003154554.800537477@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Danit Goldberg commit 5d44adebbb7e785939df3db36ac360f5e8b73e44 upstream. ib_add_slave_port() allocates a multiport struct but never frees it. Don't leak memory, free the allocated mpi struct during driver unload. Cc: Fixes: 32f69e4be269 ("{net, IB}/mlx5: Manage port association for multiport RoCE") Link: https://lore.kernel.org/r/20190916064818.19823-3-leon@kernel.org Signed-off-by: Danit Goldberg Reviewed-by: Jason Gunthorpe Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/mlx5/main.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -6829,6 +6829,7 @@ static void mlx5_ib_remove(struct mlx5_c mlx5_ib_unbind_slave_port(mpi->ibdev, mpi); list_del(&mpi->list); mutex_unlock(&mlx5_ib_multiport_mutex); + kfree(mpi); return; }