diff options
author | Chris Wright <chrisw@sous-sol.org> | 2010-05-12 21:28:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-21 12:37:31 -0400 |
commit | 2c3c8bea608866d8bd9dcf92657d57fdcac011c5 (patch) | |
tree | f509b958d0a65c46c831dbdd447a81e706dd995a /arch | |
parent | 68d75ed4b84a0806ecd4bc14da4759713b23a532 (diff) |
sysfs: add struct file* to bin_attr callbacks
This allows bin_attr->read,write,mmap callbacks to check file specific data
(such as inode owner) as part of any privilege validation.
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/pci-sysfs.c | 8 | ||||
-rw-r--r-- | arch/mips/txx9/generic/setup.c | 4 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mv64x60_pci.c | 4 | ||||
-rw-r--r-- | arch/s390/kernel/ipl.c | 14 |
4 files changed, 17 insertions, 13 deletions
diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c index d979e7c7bc4b..a5fffc882c72 100644 --- a/arch/alpha/kernel/pci-sysfs.c +++ b/arch/alpha/kernel/pci-sysfs.c | |||
@@ -53,6 +53,7 @@ static int __pci_mmap_fits(struct pci_dev *pdev, int num, | |||
53 | 53 | ||
54 | /** | 54 | /** |
55 | * pci_mmap_resource - map a PCI resource into user memory space | 55 | * pci_mmap_resource - map a PCI resource into user memory space |
56 | * @filp: open sysfs file | ||
56 | * @kobj: kobject for mapping | 57 | * @kobj: kobject for mapping |
57 | * @attr: struct bin_attribute for the file being mapped | 58 | * @attr: struct bin_attribute for the file being mapped |
58 | * @vma: struct vm_area_struct passed into the mmap | 59 | * @vma: struct vm_area_struct passed into the mmap |
@@ -60,7 +61,8 @@ static int __pci_mmap_fits(struct pci_dev *pdev, int num, | |||
60 | * | 61 | * |
61 | * Use the bus mapping routines to map a PCI resource into userspace. | 62 | * Use the bus mapping routines to map a PCI resource into userspace. |
62 | */ | 63 | */ |
63 | static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, | 64 | static int pci_mmap_resource(struct file *filp, struct kobject *kobj, |
65 | struct bin_attribute *attr, | ||
64 | struct vm_area_struct *vma, int sparse) | 66 | struct vm_area_struct *vma, int sparse) |
65 | { | 67 | { |
66 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, | 68 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, |
@@ -89,14 +91,14 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, | |||
89 | return hose_mmap_page_range(pdev->sysdata, vma, mmap_type, sparse); | 91 | return hose_mmap_page_range(pdev->sysdata, vma, mmap_type, sparse); |
90 | } | 92 | } |
91 | 93 | ||
92 | static int pci_mmap_resource_sparse(struct kobject *kobj, | 94 | static int pci_mmap_resource_sparse(struct file *filp, struct kobject *kobj, |
93 | struct bin_attribute *attr, | 95 | struct bin_attribute *attr, |
94 | struct vm_area_struct *vma) | 96 | struct vm_area_struct *vma) |
95 | { | 97 | { |
96 | return pci_mmap_resource(kobj, attr, vma, 1); | 98 | return pci_mmap_resource(kobj, attr, vma, 1); |
97 | } | 99 | } |
98 | 100 | ||
99 | static int pci_mmap_resource_dense(struct kobject *kobj, | 101 | static int pci_mmap_resource_dense(struct file *filp, struct kobject *kobj, |
100 | struct bin_attribute *attr, | 102 | struct bin_attribute *attr, |
101 | struct vm_area_struct *vma) | 103 | struct vm_area_struct *vma) |
102 | { | 104 | { |
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index adc69291f9e2..575d219b8001 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c | |||
@@ -905,7 +905,7 @@ struct txx9_sramc_sysdev { | |||
905 | void __iomem *base; | 905 | void __iomem *base; |
906 | }; | 906 | }; |
907 | 907 | ||
908 | static ssize_t txx9_sram_read(struct kobject *kobj, | 908 | static ssize_t txx9_sram_read(struct file *filp, struct kobject *kobj, |
909 | struct bin_attribute *bin_attr, | 909 | struct bin_attribute *bin_attr, |
910 | char *buf, loff_t pos, size_t size) | 910 | char *buf, loff_t pos, size_t size) |
911 | { | 911 | { |
@@ -920,7 +920,7 @@ static ssize_t txx9_sram_read(struct kobject *kobj, | |||
920 | return size; | 920 | return size; |
921 | } | 921 | } |
922 | 922 | ||
923 | static ssize_t txx9_sram_write(struct kobject *kobj, | 923 | static ssize_t txx9_sram_write(struct file *filp, struct kobject *kobj, |
924 | struct bin_attribute *bin_attr, | 924 | struct bin_attribute *bin_attr, |
925 | char *buf, loff_t pos, size_t size) | 925 | char *buf, loff_t pos, size_t size) |
926 | { | 926 | { |
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c index 1456015a22d8..198f288570cc 100644 --- a/arch/powerpc/sysdev/mv64x60_pci.c +++ b/arch/powerpc/sysdev/mv64x60_pci.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #define MV64X60_VAL_LEN_MAX 11 | 24 | #define MV64X60_VAL_LEN_MAX 11 |
25 | #define MV64X60_PCICFG_CPCI_HOTSWAP 0x68 | 25 | #define MV64X60_PCICFG_CPCI_HOTSWAP 0x68 |
26 | 26 | ||
27 | static ssize_t mv64x60_hs_reg_read(struct kobject *kobj, | 27 | static ssize_t mv64x60_hs_reg_read(struct file *filp, struct kobject *kobj, |
28 | struct bin_attribute *attr, char *buf, | 28 | struct bin_attribute *attr, char *buf, |
29 | loff_t off, size_t count) | 29 | loff_t off, size_t count) |
30 | { | 30 | { |
@@ -45,7 +45,7 @@ static ssize_t mv64x60_hs_reg_read(struct kobject *kobj, | |||
45 | return sprintf(buf, "0x%08x\n", v); | 45 | return sprintf(buf, "0x%08x\n", v); |
46 | } | 46 | } |
47 | 47 | ||
48 | static ssize_t mv64x60_hs_reg_write(struct kobject *kobj, | 48 | static ssize_t mv64x60_hs_reg_write(struct file *filp, struct kobject *kobj, |
49 | struct bin_attribute *attr, char *buf, | 49 | struct bin_attribute *attr, char *buf, |
50 | loff_t off, size_t count) | 50 | loff_t off, size_t count) |
51 | { | 51 | { |
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 72c8b0d070c8..a689070be287 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -403,8 +403,9 @@ static ssize_t sys_ipl_device_show(struct kobject *kobj, | |||
403 | static struct kobj_attribute sys_ipl_device_attr = | 403 | static struct kobj_attribute sys_ipl_device_attr = |
404 | __ATTR(device, S_IRUGO, sys_ipl_device_show, NULL); | 404 | __ATTR(device, S_IRUGO, sys_ipl_device_show, NULL); |
405 | 405 | ||
406 | static ssize_t ipl_parameter_read(struct kobject *kobj, struct bin_attribute *attr, | 406 | static ssize_t ipl_parameter_read(struct file *filp, struct kobject *kobj, |
407 | char *buf, loff_t off, size_t count) | 407 | struct bin_attribute *attr, char *buf, |
408 | loff_t off, size_t count) | ||
408 | { | 409 | { |
409 | return memory_read_from_buffer(buf, count, &off, IPL_PARMBLOCK_START, | 410 | return memory_read_from_buffer(buf, count, &off, IPL_PARMBLOCK_START, |
410 | IPL_PARMBLOCK_SIZE); | 411 | IPL_PARMBLOCK_SIZE); |
@@ -419,8 +420,9 @@ static struct bin_attribute ipl_parameter_attr = { | |||
419 | .read = &ipl_parameter_read, | 420 | .read = &ipl_parameter_read, |
420 | }; | 421 | }; |
421 | 422 | ||
422 | static ssize_t ipl_scp_data_read(struct kobject *kobj, struct bin_attribute *attr, | 423 | static ssize_t ipl_scp_data_read(struct file *filp, struct kobject *kobj, |
423 | char *buf, loff_t off, size_t count) | 424 | struct bin_attribute *attr, char *buf, |
425 | loff_t off, size_t count) | ||
424 | { | 426 | { |
425 | unsigned int size = IPL_PARMBLOCK_START->ipl_info.fcp.scp_data_len; | 427 | unsigned int size = IPL_PARMBLOCK_START->ipl_info.fcp.scp_data_len; |
426 | void *scp_data = &IPL_PARMBLOCK_START->ipl_info.fcp.scp_data; | 428 | void *scp_data = &IPL_PARMBLOCK_START->ipl_info.fcp.scp_data; |
@@ -694,7 +696,7 @@ static struct kobj_attribute sys_reipl_ccw_vmparm_attr = | |||
694 | 696 | ||
695 | /* FCP reipl device attributes */ | 697 | /* FCP reipl device attributes */ |
696 | 698 | ||
697 | static ssize_t reipl_fcp_scpdata_read(struct kobject *kobj, | 699 | static ssize_t reipl_fcp_scpdata_read(struct file *filp, struct kobject *kobj, |
698 | struct bin_attribute *attr, | 700 | struct bin_attribute *attr, |
699 | char *buf, loff_t off, size_t count) | 701 | char *buf, loff_t off, size_t count) |
700 | { | 702 | { |
@@ -704,7 +706,7 @@ static ssize_t reipl_fcp_scpdata_read(struct kobject *kobj, | |||
704 | return memory_read_from_buffer(buf, count, &off, scp_data, size); | 706 | return memory_read_from_buffer(buf, count, &off, scp_data, size); |
705 | } | 707 | } |
706 | 708 | ||
707 | static ssize_t reipl_fcp_scpdata_write(struct kobject *kobj, | 709 | static ssize_t reipl_fcp_scpdata_write(struct file *filp, struct kobject *kobj, |
708 | struct bin_attribute *attr, | 710 | struct bin_attribute *attr, |
709 | char *buf, loff_t off, size_t count) | 711 | char *buf, loff_t off, size_t count) |
710 | { | 712 | { |