From 185b8e246f4651850cad12aaa5d2c50946b7dcdb Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Wed, 16 Apr 2003 00:11:22 -0700 Subject: sysfs: Rewrite binary file handling. From Matthew Wilcox. - Remove sysfs_bin_buffer. It's a security hole. - Remove checks for permissions; the VFS does that. - Validate offset & count at the top level. - Allow lower levels to return less data than was asked for. - Allocate buffer at open & free it at close, not on each read/write. --- include/linux/sysfs.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'include/linux') diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 3e9565e2abe1..d639e18caa91 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -16,18 +16,11 @@ struct attribute { mode_t mode; }; -struct sysfs_bin_buffer { - u8 * data; - size_t size; - size_t count; - loff_t offset; -}; - struct bin_attribute { struct attribute attr; size_t size; - ssize_t (*read)(struct kobject *, struct sysfs_bin_buffer *); - ssize_t (*write)(struct kobject *, struct sysfs_bin_buffer *); + ssize_t (*read)(struct kobject *, char *, loff_t, size_t); + ssize_t (*write)(struct kobject *, char *, loff_t, size_t); }; struct sysfs_ops { -- cgit v1.2.3