From patchwork Fri Aug 14 13:21:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 7015001 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CA030C05AC for ; Fri, 14 Aug 2015 13:22:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0941D207E2 for ; Fri, 14 Aug 2015 13:22:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 054E8207DF for ; Fri, 14 Aug 2015 13:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753903AbbHNNVw (ORCPT ); Fri, 14 Aug 2015 09:21:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50839 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751856AbbHNNVv (ORCPT ); Fri, 14 Aug 2015 09:21:51 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 94D5C262E; Fri, 14 Aug 2015 13:21:50 +0000 (UTC) Received: from belphegor.brq.redhat.com. (dhcp-0-123.brq.redhat.com [10.34.0.123]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7EDLkdn028762 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Fri, 14 Aug 2015 09:21:48 -0400 From: Lubomir Rintel To: Greg Kroah-Hartman Cc: Daniel Mack , David Herrmann , Djalal Harouni , linux-kernel@vger.kernel.org, "Eric W. Biederman" , linux-fsdevel@vger.kernel.org, Lubomir Rintel Subject: [PATCH] kdbus: create /sys/fs/kdbus with sysfs_create_mount_point() Date: Fri, 14 Aug 2015 15:21:43 +0200 Message-Id: <1439558503-1749-1-git-send-email-lkundrak@v3.sk> In-Reply-To: <877fozw4bo.fsf@x220.int.ebiederm.org> References: <877fozw4bo.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since 0cbee99269 user-namespace pull, if a kdbusfs is mounted on a location that's not created with sysfs_create_mount_point the user namespaces are not allowed to mount their sysfs instances. Signed-off-by: Lubomir Rintel --- Applies on top of char-misc/kdbus a36324913. ipc/kdbus/main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ipc/kdbus/main.c b/ipc/kdbus/main.c index 1ad4dc8..c2117ea 100644 --- a/ipc/kdbus/main.c +++ b/ipc/kdbus/main.c @@ -75,16 +75,13 @@ * 'ยป struct kdbus_ep *ep (owned) */ -/* kdbus mount-point /sys/fs/kdbus */ -static struct kobject *kdbus_dir; - static int __init kdbus_init(void) { int ret; - kdbus_dir = kobject_create_and_add(KBUILD_MODNAME, fs_kobj); - if (!kdbus_dir) - return -ENOMEM; + ret = sysfs_create_mount_point(fs_kobj, KBUILD_MODNAME); + if (ret) + return ret; ret = kdbus_fs_init(); if (ret < 0) { @@ -96,14 +93,14 @@ static int __init kdbus_init(void) return 0; exit_dir: - kobject_put(kdbus_dir); + sysfs_remove_mount_point(fs_kobj, KBUILD_MODNAME); return ret; } static void __exit kdbus_exit(void) { kdbus_fs_exit(); - kobject_put(kdbus_dir); + sysfs_remove_mount_point(fs_kobj, KBUILD_MODNAME); ida_destroy(&kdbus_node_ida); }