Re: [PATCH] Prevent crash on missing sysfs attribute group

From: Greg KH
Date: Tue Apr 03 2012 - 19:26:18 EST


On Tue, Apr 03, 2012 at 04:22:46PM -0700, Eric W. Biederman wrote:
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:
>
> > On Tue, 2012-04-03 at 00:50 -0700, Eric W. Biederman wrote:
> >>
> >> So I am asking that since perf is built in a way that actively makes
> >> debugging these kinds of problems hard that you please add additional
> >> debugging code to perf_pmu_register or some other better location so
> >> that simply registering something buggy with perf will show the bug.
> >>
> >>
> > Is there a convenient helper function that we can use that validates the
> > attribute_group structure? We could use such a function to do the
> > validation at a point where we still know where it came from.
>
> There isn't but I was just thinking before you sent this that we could
> really use one.

Let me look into this some more, the driver core really should be
protecting you from doing something like this here, sysfs shouldn't be
getting involved (not to say that the patch is incorrect, it isn't, I'll
queue it up, but that something more looks to be needed to keep from
hitting that problem in the first place.)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/