lkml.org 
[lkml]   [2013]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 9/9 v3] x86: export x86 boot_params to sysfs
On 11/21/13 at 08:45am, Greg KH wrote:
> > +static struct kobj_attribute boot_params_version_attr =
> > + __ATTR(version, S_IRUGO, boot_params_version_show, NULL);
>
> __ATTR_RO() please.

Will do

>
> > +static struct kobj_attribute type_attr =
> > + __ATTR(type, S_IRUGO, setup_data_type_show, NULL);
>
> __ATTR_RO() here too.

Will do

[snip]
> > +
> > + ret = get_setup_data_size(nr, &size);
> > + if (ret)
> > + goto out_kobj;
> > +
> > + data_attr.size = size;
> > + ret = sysfs_create_bin_file(kobj, &data_attr);
> > + if (ret)
> > + goto out_file;
> > + *kobjp = kobj;
>
> You just raced with userspace (creating and announcing the kobject and
> then, afterward, at some later point in time, created the sysfs files.
> Please use the groups option to create the files properly before
> announcing the kobject to userspace.

Will do

[snip]
> > + goto out_boot_params_kobj;
> > + ret = sysfs_create_bin_file(boot_params_kobj,
> > + &boot_params_data_attr);
> > + if (ret)
> > + goto out_create_file;
> > +
> > + ret = create_setup_data_nodes(boot_params_kobj);
> > + if (ret)
> > + goto out_create_bin;
> > +
> > + return 0;
>
> Same race condition here as well. Use a groups structure please.
>

Will use group attributes

Thanks for review
Dave


\
 
 \ /
  Last update: 2013-11-22 04:41    [W:0.143 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site