Re: [PATCH] block: partition: initialize percpuref before sending out KOBJ_ADD

2016-03-30 Thread Ming Lei
On Thu, Mar 31, 2016 at 1:43 AM, Christoph Hellwig wrote: >> + if (err) { >> + if (flags & ADDPART_FLAG_WHOLEDISK) >> + goto out_remove_file; >> + goto out_del; >> + } > > I'd rather have that if around the actual device_remove_file at the > labe

Re: [PATCH] block: partition: initialize percpuref before sending out KOBJ_ADD

2016-03-30 Thread Christoph Hellwig
> + if (err) { > + if (flags & ADDPART_FLAG_WHOLEDISK) > + goto out_remove_file; > + goto out_del; > + } I'd rather have that if around the actual device_remove_file at the label, and jump to out_remove_file unconditionally. Otherwise this looks

[PATCH] block: partition: initialize percpuref before sending out KOBJ_ADD

2016-03-29 Thread Ming Lei
The initialization of partition's percpu_ref should have been done before sending out KOBJ_ADD uevent, which may cause userspace to read partition table. So the uninitialized percpu_ref may be accessed in data path. This patch fixes this issue reported by Naveen. Reported-by: Naveen Kaje Tested-