[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131122024506.GB3874@dhcp-16-126.nay.redhat.com>
Date: Fri, 22 Nov 2013 10:45:06 +0800
From: Dave Young <dyoung@...hat.com>
To: Greg KH <greg@...ah.com>
Cc: linux-kernel@...r.kernel.org, linux-efi@...r.kernel.org,
x86@...nel.org, mjg59@...f.ucam.org, hpa@...or.com,
James.Bottomley@...senPartnership.com, vgoyal@...hat.com,
ebiederm@...ssion.com, horms@...ge.net.au,
kexec@...ts.infradead.org, bp@...en8.de, matt@...sole-pimps.org,
toshi.kani@...com
Subject: Re: [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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists