Received: by 10.213.65.68 with SMTP id h4csp467541imn; Tue, 13 Mar 2018 09:59:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELvTeQQFLfU9kJ8UyR0OjxsV/8NFeURUU0jJ6kGjTst0nhi1gahublWZ5HjXicP4nsHAqPYU X-Received: by 10.98.138.217 with SMTP id o86mr1287134pfk.128.1520960395423; Tue, 13 Mar 2018 09:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520960395; cv=none; d=google.com; s=arc-20160816; b=klUXAClTsFf4rt6OPfnMDxrTgLd5YoHWkJWdWa7EjDKJda3mzHZ0dxKWlxUKI6SKlj zgUxmvHWsVf6HCaOMHQmCimPlLp4rwFWf2ahNwZ8N+W8XeW8eJB25bkpVLAqcq8gCFTr ZQ8PLY7zg1mJDsVVMgR1w3+gIdldD0VBuDqAI88CLhOG2iyM3wOeq5pCJuc+gsEUUct1 LsMP2fNZPyAhfHQ4KVVwn85Yhw/gRCWWy1Levwqyz8F0t+qWFIcWWiZUcNdUue4YfaaL Kh0pXbXql56RP6eiPeYVXbTMPY2xfxPdRxMvVdwMmux+7BuOSWTIMKXMVgJxOF798Hba AJdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=mBDAp4u4oSE4um1fTMC4+dfNLYeLKMMIZRuI7IoFOFg=; b=J/WYVkACgNOQraAngFbB2hiwhpY9la30YANiDqtSnJFScj6MZr2mGHuCHA9wuzefX3 KBikJyS6vJqtZofGy1mPNnHyYYLLfvseX8BJoyX1n/4G3jkMhS5sJMZDXWSLRskXJFJI TaYImZhulJAXAF/6Liq27DWmtcuAwtiqTThVsmKK04ow0AHMtnaZoMSxYGfLT/cDfCVx W9K5fBoAfklyQFvGrMgsO+xLvVF8LzXWVQ18yXLoKANPAq3nW9neAPmO+khSI8rtgfKY M+U43qFOxd1T6vPWuMokQoqpDF/0W+1kNflipGmM7vDZ/JgZuiuYhckDEjcUWSOWGWrY 5SQg== ARC-Authentication-Results: i=1; mx.google.com; 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 b3si257000pga.503.2018.03.13.09.59.40; Tue, 13 Mar 2018 09:59: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; 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 S933143AbeCMPaC (ORCPT + 99 others); Tue, 13 Mar 2018 11:30:02 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58608 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752378AbeCMP37 (ORCPT ); Tue, 13 Mar 2018 11:29:59 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7A396FFB; Tue, 13 Mar 2018 15:29:58 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Jurgens , Parav Pandit , Leon Romanovsky , Jason Gunthorpe Subject: [PATCH 4.15 055/146] IB/core: Fix missing RDMA cgroups release in case of failure to register device Date: Tue, 13 Mar 2018 16:23:42 +0100 Message-Id: <20180313152324.885207547@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152320.439085687@linuxfoundation.org> References: <20180313152320.439085687@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Parav Pandit commit 2fb4f4eadd180a50112618dd9c5fef7fc50d4f08 upstream. During IB device registration process, if query_device() fails or if ib_core fails to registers sysfs entries, rdma cgroup cleanup is skipped. Cc: # v4.2+ Fixes: 4be3a4fa51f4 ("IB/core: Fix kernel crash during fail to initialize device") Reviewed-by: Daniel Jurgens Signed-off-by: Parav Pandit Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -534,14 +534,14 @@ int ib_register_device(struct ib_device ret = device->query_device(device, &device->attrs, &uhw); if (ret) { pr_warn("Couldn't query the device attributes\n"); - goto cache_cleanup; + goto cg_cleanup; } ret = ib_device_register_sysfs(device, port_callback); if (ret) { pr_warn("Couldn't register device %s with driver model\n", device->name); - goto cache_cleanup; + goto cg_cleanup; } device->reg_state = IB_DEV_REGISTERED; @@ -557,6 +557,8 @@ int ib_register_device(struct ib_device mutex_unlock(&device_mutex); return 0; +cg_cleanup: + ib_device_unregister_rdmacg(device); cache_cleanup: ib_cache_cleanup_one(device); ib_cache_release_one(device);