From patchwork Thu Jan 31 00:25:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 10789439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED58791E for ; Thu, 31 Jan 2019 00:25:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DC632F2CA for ; Thu, 31 Jan 2019 00:25:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01F3B2F50C; Thu, 31 Jan 2019 00:25:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87D6830543 for ; Thu, 31 Jan 2019 00:25:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727784AbfAaAZH (ORCPT ); Wed, 30 Jan 2019 19:25:07 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:44662 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726455AbfAaAZG (ORCPT ); Wed, 30 Jan 2019 19:25:06 -0500 Received: by mail-ed1-f68.google.com with SMTP id y56so1146374edd.11 for ; Wed, 30 Jan 2019 16:25:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mrpDYX/PRqS0L2g8V2tZdMYib91aazMaxACMXUeBxZ8=; b=Q98bUTHT0Vbxa4uMbGMe0q1jTxpE67/CUZXIC50pPD2y2Y+3PsnVX+pSHXy/UqyFzr R2mv4KIz0R9TuTZQkGjjRUI4AzePsLNBLeeIDOVVpWwrC5x5cqz8TAkmuaDZvd9DiHcb sYvy3xvvZ/v3/Uv7OzHatdT2xs5oDWYcvaBfjcwvhgKvANlDOgYepYDWeIjV0+cmKW0t kXO8DYFIF2PqDj31F46FiY8pGIDph1ngWCxxx0X5DH/6UbKoCBMCi/Kh6SfXwdXq5d6e rWkwtNaUcVYGlNtC0CCb9PKbeQpkbeAMa0wQ2pKow5tIYl4yZKmfxd2hkgVJt+f3Nx53 Hq0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mrpDYX/PRqS0L2g8V2tZdMYib91aazMaxACMXUeBxZ8=; b=nJSbFBaI7rzCaOg5OuOGRMxcR/p5t6SXh7NGFQ0wrx3rnqhRtm0gkY9f7VDbC96Rgt 9NBUz8HLDYGEBwtNEgXLuuzRdWfLMr6iOHX59wYMXseax9Mb+EeO27Rhjq60YORK9TdQ NTeo7PhayhEwBXb9izzeH9JgPf9SrZQWT0HaJjp4/5WlA9kN2g76SaMKjNSyN38horg8 TW9iXiI3K2CDtrWly5TxeHoGu88QQPPWFO1U1tfXa4tujyXcGuH4O/MeEY0XNpTx1bKH bd+60fEPa3hTt59MaVmfjut/pUIdrUGIuIbb0ZAXhyHBM1kj9XP5B0gE1ZPCPKsqqPJ0 OeRQ== X-Gm-Message-State: AJcUukex89xswQMZAW03CakhkzOkxvd8dzMaI+CIAk8SvjaDOBs9kuis tL6LzjhONkqbfjc0eMeDSdNb0w== X-Google-Smtp-Source: ALg8bN4rbjU5a/b0T9JAd4Tq5w9UmN7AYcAtc6Xa7BsWtRiP1/8ZPHQeW8lUlBiP8tNvjybhRl85rQ== X-Received: by 2002:a50:bdc8:: with SMTP id z8mr31684093edh.46.1548894304783; Wed, 30 Jan 2019 16:25:04 -0800 (PST) Received: from localhost.localdomain (84-199-88-155.iFiber.telenet-ops.be. [84.199.88.155]) by smtp.gmail.com with ESMTPSA id j31sm879432eda.46.2019.01.30.16.25.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jan 2019 16:25:04 -0800 (PST) From: Christian Brauner To: gregkh@linuxfoundation.org, tkjos@android.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: arve@android.com, maco@android.com, joel@joelfernandes.org, tkjos@google.com, Christian Brauner Subject: [PATCH v1] binderfs: remove separate device_initcall() Date: Thu, 31 Jan 2019 01:25:02 +0100 Message-Id: <20190131002502.14525-1-christian@brauner.io> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Patchwork-Bot: notify Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP binderfs should not have a separate device_initcall(). When a kernel is compiled with CONFIG_ANDROID_BINDERFS register the filesystem alongside CONFIG_ANDROID_IPC. This use-case is especially sensible when users specify CONFIG_ANDROID_IPC=y, CONFIG_ANDROID_BINDERFS=y and ANDROID_BINDER_DEVICES="". When CONFIG_ANDROID_BINDERFS=n then this always succeeds so there's no regression potential for legacy workloads. Signed-off-by: Christian Brauner Acked-by: Todd Kjos --- /* Changelog */ - ensure that device_name is set to NULL so kfree() doesn't freak out --- drivers/android/binder.c | 7 ++++++- drivers/android/binder_internal.h | 9 +++++++++ drivers/android/binderfs.c | 4 +--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 57cf259de600..4d2b2ad1ee0e 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -5854,9 +5854,10 @@ static int __init init_binder_device(const char *name) static int __init binder_init(void) { int ret; - char *device_name, *device_names, *device_tmp; + char *device_name, *device_tmp; struct binder_device *device; struct hlist_node *tmp; + char *device_names = NULL; ret = binder_alloc_shrinker_init(); if (ret) @@ -5917,6 +5918,10 @@ static int __init binder_init(void) } } + ret = init_binderfs(); + if (ret) + goto err_init_binder_device_failed; + return ret; err_init_binder_device_failed: diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index 7fb97f503ef2..045b3e42d98b 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -46,4 +46,13 @@ static inline bool is_binderfs_device(const struct inode *inode) } #endif +#ifdef CONFIG_ANDROID_BINDERFS +extern int __init init_binderfs(void); +#else +static inline int __init init_binderfs(void) +{ + return 0; +} +#endif + #endif /* _LINUX_BINDER_INTERNAL_H */ diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index 7a550104a722..e773f45d19d9 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -550,7 +550,7 @@ static struct file_system_type binder_fs_type = { .fs_flags = FS_USERNS_MOUNT, }; -static int __init init_binderfs(void) +int __init init_binderfs(void) { int ret; @@ -568,5 +568,3 @@ static int __init init_binderfs(void) return ret; } - -device_initcall(init_binderfs);