From patchwork Mon Jul 30 22:51:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Hicks X-Patchwork-Id: 951314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41fZbQ3wTGz9s3N; Tue, 31 Jul 2018 08:52:50 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fkH1w-0004Af-2l; Mon, 30 Jul 2018 22:52:44 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fkH1t-00048R-Ug for kernel-team@lists.ubuntu.com; Mon, 30 Jul 2018 22:52:41 +0000 Received: from 2.general.tyhicks.us.vpn ([10.172.64.53] helo=sec.ubuntu-ci) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fkH1s-00046Y-Uf; Mon, 30 Jul 2018 22:52:41 +0000 From: Tyler Hicks To: kernel-team@lists.ubuntu.com Subject: [PATCH 9/9] sysfs: Fix regression when adding a file to an existing group Date: Mon, 30 Jul 2018 22:51:16 +0000 Message-Id: <1532991076-3672-10-git-send-email-tyhicks@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532991076-3672-1-git-send-email-tyhicks@canonical.com> References: <1532991076-3672-1-git-send-email-tyhicks@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://launchpad.net/bugs/1784501 Commit 5f81880d5204 ("sysfs, kobject: allow creating kobject belonging to arbitrary users") incorrectly changed the argument passed as the parent parameter when calling sysfs_add_file_mode_ns(). This caused some sysfs attribute files to not be added correctly to certain groups. Fixes: 5f81880d5204 ("sysfs, kobject: allow creating kobject belonging to arbitrary users") Signed-off-by: Tyler Hicks Reported-by: Heiner Kallweit Tested-by: Heiner Kallweit Signed-off-by: David S. Miller (cherry picked from commit d1753390274f7760e5b593cb657ea34f0617e559 linux-next) Signed-off-by: Tyler Hicks --- fs/sysfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index fa46216523cf..052e5ad9a4d2 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -373,7 +373,7 @@ int sysfs_add_file_to_group(struct kobject *kobj, return -ENOENT; kobject_get_ownership(kobj, &uid, &gid); - error = sysfs_add_file_mode_ns(kobj->sd, attr, false, + error = sysfs_add_file_mode_ns(parent, attr, false, attr->mode, uid, gid, NULL); kernfs_put(parent);