public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	Kay Sievers <kay.sievers@vrfy.org>,
	Matt Domsch <Matt_Domsch@dell.com>,
	Matt Tolentino <matthew.e.tolentino@intel.com>
Subject: [PATCH 38/54] efivars: remove new_var and del_var files from sysfs
Date: Fri,  2 Nov 2007 16:59:16 -0700	[thread overview]
Message-ID: <1194047972-9850-38-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20071102235758.GA9803@kroah.com>

WTF?  Passing binary structures into a sysfs file, expecting it to be in
the correct format/endianness?  That's just wrong on so many levels.

So, these files are deleted.  If you want to add them back, please do so
in configfs, or in debugfs.  Or use text strings, which is what sysfs is
only for.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Cc: Matt Tolentino <matthew.e.tolentino@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/firmware/efivars.c |  149 --------------------------------------------
 1 files changed, 0 insertions(+), 149 deletions(-)

diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 06ecdb9..65cddb7 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -143,13 +143,6 @@ struct efivar_attribute efivar_attr_##_name = { \
 	.store = _store, \
 };
 
-#define VAR_SUBSYS_ATTR(_name, _mode, _show, _store) \
-struct subsys_attribute var_subsys_attr_##_name = { \
-	.attr = {.name = __stringify(_name), .mode = _mode}, \
-	.show = _show, \
-	.store = _store, \
-};
-
 #define to_efivar_attr(_attr) container_of(_attr, struct efivar_attribute, attr)
 #define to_efivar_entry(obj)  container_of(obj, struct efivar_entry, kobj)
 
@@ -408,144 +401,12 @@ static struct kobj_type efivar_ktype = {
 	.default_attrs = def_attrs,
 };
 
-static ssize_t
-dummy(struct kset *kset, char *buf)
-{
-	return -ENODEV;
-}
-
 static inline void
 efivar_unregister(struct efivar_entry *var)
 {
 	kobject_unregister(&var->kobj);
 }
 
-
-static ssize_t
-efivar_create(struct kset *kset, const char *buf, size_t count)
-{
-	struct efi_variable *new_var = (struct efi_variable *)buf;
-	struct efivar_entry *search_efivar, *n;
-	unsigned long strsize1, strsize2;
-	efi_status_t status = EFI_NOT_FOUND;
-	int found = 0;
-
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-
-	spin_lock(&efivars_lock);
-
-	/*
-	 * Does this variable already exist?
-	 */
-	list_for_each_entry_safe(search_efivar, n, &efivar_list, list) {
-		strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
-		strsize2 = utf8_strsize(new_var->VariableName, 1024);
-		if (strsize1 == strsize2 &&
-			!memcmp(&(search_efivar->var.VariableName),
-				new_var->VariableName, strsize1) &&
-			!efi_guidcmp(search_efivar->var.VendorGuid,
-				new_var->VendorGuid)) {
-			found = 1;
-			break;
-		}
-	}
-	if (found) {
-		spin_unlock(&efivars_lock);
-		return -EINVAL;
-	}
-
-	/* now *really* create the variable via EFI */
-	status = efi.set_variable(new_var->VariableName,
-			&new_var->VendorGuid,
-			new_var->Attributes,
-			new_var->DataSize,
-			new_var->Data);
-
-	if (status != EFI_SUCCESS) {
-		printk(KERN_WARNING "efivars: set_variable() failed: status=%lx\n",
-			status);
-		spin_unlock(&efivars_lock);
-		return -EIO;
-	}
-	spin_unlock(&efivars_lock);
-
-	/* Create the entry in sysfs.  Locking is not required here */
-	status = efivar_create_sysfs_entry(utf8_strsize(new_var->VariableName,
-			1024), new_var->VariableName, &new_var->VendorGuid);
-	if (status) {
-		printk(KERN_WARNING "efivars: variable created, but sysfs entry wasn't.\n");
-	}
-	return count;
-}
-
-static ssize_t
-efivar_delete(struct kset *kset, const char *buf, size_t count)
-{
-	struct efi_variable *del_var = (struct efi_variable *)buf;
-	struct efivar_entry *search_efivar, *n;
-	unsigned long strsize1, strsize2;
-	efi_status_t status = EFI_NOT_FOUND;
-	int found = 0;
-
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-
-	spin_lock(&efivars_lock);
-
-	/*
-	 * Does this variable already exist?
-	 */
-	list_for_each_entry_safe(search_efivar, n, &efivar_list, list) {
-		strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
-		strsize2 = utf8_strsize(del_var->VariableName, 1024);
-		if (strsize1 == strsize2 &&
-			!memcmp(&(search_efivar->var.VariableName),
-				del_var->VariableName, strsize1) &&
-			!efi_guidcmp(search_efivar->var.VendorGuid,
-				del_var->VendorGuid)) {
-			found = 1;
-			break;
-		}
-	}
-	if (!found) {
-		spin_unlock(&efivars_lock);
-		return -EINVAL;
-	}
-	/* force the Attributes/DataSize to 0 to ensure deletion */
-	del_var->Attributes = 0;
-	del_var->DataSize = 0;
-
-	status = efi.set_variable(del_var->VariableName,
-			&del_var->VendorGuid,
-			del_var->Attributes,
-			del_var->DataSize,
-			del_var->Data);
-
-	if (status != EFI_SUCCESS) {
-		printk(KERN_WARNING "efivars: set_variable() failed: status=%lx\n",
-			status);
-		spin_unlock(&efivars_lock);
-		return -EIO;
-	}
-	list_del(&search_efivar->list);
-	/* We need to release this lock before unregistering. */
-	spin_unlock(&efivars_lock);
-	efivar_unregister(search_efivar);
-
-	/* It's dead Jim.... */
-	return count;
-}
-
-static VAR_SUBSYS_ATTR(new_var, 0200, dummy, efivar_create);
-static VAR_SUBSYS_ATTR(del_var, 0200, dummy, efivar_delete);
-
-static struct subsys_attribute *var_subsys_attrs[] = {
-	&var_subsys_attr_new_var,
-	&var_subsys_attr_del_var,
-	NULL,
-};
-
 /*
  * Let's not leave out systab information that snuck into
  * the efivars driver
@@ -724,16 +585,6 @@ efivars_init(void)
 		}
 	} while (status != EFI_NOT_FOUND);
 
-	/*
-	 * Now add attributes to allow creation of new vars
-	 * and deletion of existing ones...
-	 */
-
-	for (i = 0; (attr = var_subsys_attrs[i]) && !error; i++) {
-		if (attr->show && attr->store)
-			error = subsys_create_file(&vars_subsys, attr);
-	}
-
 	/* Don't forget the systab entry */
 
 	for (i = 0; (attr = efi_subsys_attrs[i]) && !error; i++) {
-- 
1.5.3.4


  parent reply	other threads:[~2007-11-03  0:12 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-02 23:57 [RFC] kobject and kset core changes and cleanups Greg KH
2007-11-02 23:58 ` [PATCH 01/54] ecryptfs: clean up attribute mess Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 02/54] KOBJECT: remove struct kobj_type from struct kset Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 03/54] KOBJECT: remove kobj_set_kset_s as no one is using it anymore Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 04/54] kset: add kset_create_and_register function Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 05/54] kset: convert fuse to use kset_create Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 06/54] kset: convert securityfs " Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 07/54] kset: convert debugfs " Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 08/54] kset: convert configfs " Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 09/54] kset: convert ecryptfs " Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 10/54] kset: convert main fs kset " Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 11/54] kset: convert gfs2 " Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 12/54] kset: convert gfs2 dlm " Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 13/54] kset: convert " Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 14/54] kset: convert pci hotplug to use kset_create_and_register Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 15/54] kset: remove decl_subsys_name Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 16/54] kset: convert kernel_subsys to use kset_create Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 17/54] kset: convert drivers/base/bus.c kset_create_and_register Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 18/54] kset: convert drivers/base/class.c kset_create_and_register Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 19/54] kset: convert drivers/base/firmware.c kset_create_and_register Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 20/54] kset: convert /sys/devices to use kset_create Greg Kroah-Hartman
2007-11-02 23:58 ` [PATCH 21/54] kset: convert /sys/hypervisor " Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 22/54] kset: convert /sys/devices/system " Greg Kroah-Hartman
2007-11-05 18:11   ` Cornelia Huck
2007-11-05 18:58     ` Greg KH
2007-11-05 19:11       ` Cornelia Huck
2007-11-05 20:03         ` Greg KH
2007-11-13 23:14           ` Andrew Morton
2007-11-14  0:01             ` Andrew Morton
2007-11-14  0:35               ` Greg KH
2007-11-14  7:35                 ` Andrew Morton
2007-11-02 23:59 ` [PATCH 23/54] kset: convert slub " Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 24/54] kset: move /sys/slab to /sys/kernel/slab Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 25/54] kset: convert /sys/module to use kset_create Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 26/54] kset: convert /sys/power " Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 27/54] kset: convert s390 hypervisor kset " Greg Kroah-Hartman
2007-11-05 13:18   ` Cornelia Huck
2007-11-05 17:06     ` Greg KH
2007-11-02 23:59 ` [PATCH 28/54] kset: convert struct bus_device->devices " Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 29/54] kset: convert struct bus_device->drivers " Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 30/54] driver core: remove owner field from struct bus_type Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 31/54] driver core: add way to get to bus kset Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 32/54] driver core: add way to get to bus device klist Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 33/54] driver core: remove fields from struct bus_type Greg Kroah-Hartman
2007-11-05 10:33   ` Cornelia Huck
2007-11-05 17:00     ` Greg KH
2007-11-02 23:59 ` [PATCH 34/54] Driver Core: add kobj_attribute handling Greg Kroah-Hartman
2007-11-05 12:42   ` Cornelia Huck
2007-11-05 16:23     ` Kay Sievers
2007-11-05 17:11       ` Greg KH
2007-11-05 17:25         ` Kay Sievers
2007-11-05 17:43           ` Cornelia Huck
2007-11-05 18:07             ` Kay Sievers
2007-11-05 18:17               ` Cornelia Huck
2007-11-05 18:39                 ` Kay Sievers
2007-11-05 18:46                   ` Greg KH
2007-11-05 18:59                   ` Cornelia Huck
2007-11-05 20:01                     ` Greg KH
2007-11-02 23:59 ` [PATCH 35/54] Driver Core: switch all dynamic ksets to kobj_sysfs_ops Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 36/54] fix struct user_info export's sysfs interaction Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 37/54] ecryptfs: remove version_str file from sysfs Greg Kroah-Hartman
2007-11-02 23:59 ` Greg Kroah-Hartman [this message]
2007-11-16 15:01   ` [PATCH 38/54] efivars: remove new_var and del_var files " Matt Domsch
2007-11-27  5:47     ` Greg KH
2007-11-02 23:59 ` [PATCH 39/54] kobject: convert efivars to kobj_attr interface Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 40/54] firmware: export firmware_kset so that people can use that instead of the braindead firmware_register interface Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 41/54] kset: convert efivars to use kset_create for the efi subsystem Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 42/54] kset: convert efivars to use kset_create for the vars sub-subsystem Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 43/54] kobject: convert arm/mach-omap1/pm.c to kobj_attr interface Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 44/54] kobject: convert pseries/power.c " Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 45/54] kobject: convert s390 ipl.c " Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 46/54] kset: convert s390 ipl.c to use kset_create Greg Kroah-Hartman
2007-11-05 10:27   ` Cornelia Huck
2007-11-05 17:05     ` Greg KH
2007-11-02 23:59 ` [PATCH 47/54] kobject: convert parisc/pdc_stable to kobj_attr interface Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 48/54] kset: convert parisc/pdc_stable.c to use kset_create Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 49/54] Driver Core: kill subsys_attribute and default sysfs ops Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 50/54] kset: convert edd to use kset_create Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 51/54] kset: convert acpi " Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 52/54] firmware: remove firmware_(un)register() Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 53/54] kset: convert ocfs2 to use kset_create Greg Kroah-Hartman
2007-11-02 23:59 ` [PATCH 54/54] kset: remove decl_subsys macro Greg Kroah-Hartman
2007-11-06  6:25 ` [RFC] kobject and kset core changes and cleanups Andrew Morton
2007-11-06  7:11 ` Andrew Morton
2007-11-06  8:14   ` Stephane Eranian
2007-11-06 21:15     ` Greg KH
2007-11-06 21:33       ` Stephane Eranian
2007-11-06  8:04 ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1194047972-9850-38-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=Matt_Domsch@dell.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.e.tolentino@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox