Received: by 10.213.65.68 with SMTP id h4csp432856imn; Tue, 13 Mar 2018 08:54:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELsQkSj+HpFH39f8b14aRTW3vvHOLCIDMA6rsdvuw39YeD6vpsXxrJUgQQHLYye1kvmEuwzM X-Received: by 10.101.67.137 with SMTP id m9mr840260pgp.301.1520956469064; Tue, 13 Mar 2018 08:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520956469; cv=none; d=google.com; s=arc-20160816; b=vU7TbMnSq8AQPwF4qrwr+jh5iS1CzSTfAVJo+I1gqrVFioOuCHnrIv1R0BGHHGxFEy h8FXaU8murIKLpN9XJaKixqNGTT6izzIoiSkK9x1f/huRRWo4YatS8rhtsCJiAzzKWoX /MIJPxN9iqopZfgKwrY/D7XqMliwtsxmBB4Pjm3c9o2LBPq8AgoC0ejs/yOmxOtrPlyI zIM8fK45kSZR1wPR+d0unTF7SDcYWo3bh+DTlSIiR9qhNOIY/puwthSJfwiWB9y6ZICm eWN4ahd4EyVq5e0LkXKFvvs3e+COvrsnBsESjidvBEfBft/kg8BD7iYTEHYxgCmpQQ0o +P8w== 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=/Q74BKxKpEMCw6sciqwseBX0VmuKGEG1JsAJx1fZjus=; b=buvlSnK4RS46Cw7X7tcF2+zmFfA16nd7uBAGITF/OEWD/S10/A/CjqgjomqrYrQs7Y R30Vt2IlkjaV4MLocX8FMTyAS7W+YzBDgGgIq92zUyah5/O8vjAtYIYTPl3nwwz84cw6 F4q+UXwJVIJ3TFEbaZBrna7QEolfGf2BN9+ldFH51mmykbK0xx/e8GTf2hdrzY/PaccP IJJMO3YNRfJtMPvh2xt8FwnOh99cesHBTsKs07wfAbM19B31S0e5bYnu9XnGZn6X+FE6 xqz+qd4scgh+QYwMP69FT2RM+s9ZxAU8v+4sGNmKnsiPTjd2AAW3OK/xZuj8hwL/Zx+W M9rQ== 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 i71si272969pgc.718.2018.03.13.08.54.14; Tue, 13 Mar 2018 08:54:29 -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 S934649AbeCMPwZ (ORCPT + 99 others); Tue, 13 Mar 2018 11:52:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35366 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934747AbeCMPjd (ORCPT ); Tue, 13 Mar 2018 11:39:33 -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 A2990F2D; Tue, 13 Mar 2018 15:39:32 +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.14 091/140] IB/core: Fix missing RDMA cgroups release in case of failure to register device Date: Tue, 13 Mar 2018 16:24:54 +0100 Message-Id: <20180313152504.242468275@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@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.14-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);