mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-03 17:40:04 +00:00
[S390] Fix sysdev class file creation.
Use sysdev_class_create_file() to create create sysdev class attributes instead of sysfs_create_file(). Using sysfs_create_file() wasn't a very good idea since the show and store functions have a different amount of parameters for sysfs files and sysdev class files. In particular the pointer to the buffer is the last argument and therefore accesses to random memory regions happened. Still worked surprisingly well until we got a kernel panic. Cc: stable@kernel.org Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
250cf776f7
commit
da5aae7036
1 changed files with 9 additions and 15 deletions
|
@ -1119,9 +1119,7 @@ int __ref smp_rescan_cpus(void)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t __ref rescan_store(struct sys_device *dev,
|
static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf,
|
||||||
struct sysdev_attribute *attr,
|
|
||||||
const char *buf,
|
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -1129,12 +1127,10 @@ static ssize_t __ref rescan_store(struct sys_device *dev,
|
||||||
rc = smp_rescan_cpus();
|
rc = smp_rescan_cpus();
|
||||||
return rc ? rc : count;
|
return rc ? rc : count;
|
||||||
}
|
}
|
||||||
static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store);
|
static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store);
|
||||||
#endif /* CONFIG_HOTPLUG_CPU */
|
#endif /* CONFIG_HOTPLUG_CPU */
|
||||||
|
|
||||||
static ssize_t dispatching_show(struct sys_device *dev,
|
static ssize_t dispatching_show(struct sysdev_class *class, char *buf)
|
||||||
struct sysdev_attribute *attr,
|
|
||||||
char *buf)
|
|
||||||
{
|
{
|
||||||
ssize_t count;
|
ssize_t count;
|
||||||
|
|
||||||
|
@ -1144,9 +1140,8 @@ static ssize_t dispatching_show(struct sys_device *dev,
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t dispatching_store(struct sys_device *dev,
|
static ssize_t dispatching_store(struct sysdev_class *dev, const char *buf,
|
||||||
struct sysdev_attribute *attr,
|
size_t count)
|
||||||
const char *buf, size_t count)
|
|
||||||
{
|
{
|
||||||
int val, rc;
|
int val, rc;
|
||||||
char delim;
|
char delim;
|
||||||
|
@ -1168,7 +1163,8 @@ static ssize_t dispatching_store(struct sys_device *dev,
|
||||||
put_online_cpus();
|
put_online_cpus();
|
||||||
return rc ? rc : count;
|
return rc ? rc : count;
|
||||||
}
|
}
|
||||||
static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store);
|
static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show,
|
||||||
|
dispatching_store);
|
||||||
|
|
||||||
static int __init topology_init(void)
|
static int __init topology_init(void)
|
||||||
{
|
{
|
||||||
|
@ -1178,13 +1174,11 @@ static int __init topology_init(void)
|
||||||
register_cpu_notifier(&smp_cpu_nb);
|
register_cpu_notifier(&smp_cpu_nb);
|
||||||
|
|
||||||
#ifdef CONFIG_HOTPLUG_CPU
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
|
rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_rescan);
|
||||||
&attr_rescan.attr);
|
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
#endif
|
#endif
|
||||||
rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
|
rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_dispatching);
|
||||||
&attr_dispatching.attr);
|
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
for_each_present_cpu(cpu) {
|
for_each_present_cpu(cpu) {
|
||||||
|
|
Loading…
Reference in a new issue