Re: [rttest] WARNING: at drivers/base/core.c:569 device_create_file()

From: Greg Kroah-Hartman
Date: Mon Mar 18 2013 - 11:25:27 EST


On Mon, Mar 18, 2013 at 09:52:34PM +0800, Fengguang Wu wrote:
> Greetings,
>
> I got the below dmesg and the first bad commit is

Adding the owners of the kernel/rtmutext-tester.c file.

>
> commit 8f46baaa7ec6cd0851794020b31958e64679dd26
> Author: Felipe Balbi <balbi@xxxxxx>
> Date: Wed Feb 20 10:31:42 2013 +0200
>
> base: core: WARN() about bogus permissions on device attributes
>
> Whenever a struct device_attribute is registered
> with mismatched permissions - read permission without
> a show routine or write permission without store
> routine - we will issue a big warning so we catch
> those early enough.
>
> Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> Judging from the dmesg, CC the rttest developers for possible fixes.
>
> [ 11.581068] bus: 'rttest': add device rttest0
> [ 11.581813] ------------[ cut here ]------------
> [ 11.582568] WARNING: at /c/kernel-tests/src/linux/drivers/base/core.c:569 device_create_file+0x5a/0xa0()
> [ 11.584035] Write permission without 'store'
> [ 11.584793] Pid: 1, comm: swapper/0 Not tainted 3.9.0-rc2-next-20130318 #21
> [ 11.585902] Call Trace:
> [ 11.586318] [<8102d888>] warn_slowpath_common+0x68/0xa0
> [ 11.587146] [<8151b77a>] ? device_create_file+0x5a/0xa0
> [ 11.587982] [<8151b77a>] ? device_create_file+0x5a/0xa0
> [ 11.588820] [<8102d91e>] warn_slowpath_fmt+0x2e/0x30
> [ 11.589618] [<8151b77a>] device_create_file+0x5a/0xa0
> [ 11.590523] [<81081faa>] init_rttest+0xaa/0x150

Turns out that the sysfs attributes this function (init_rttest()) is
creating, isn't correct. The "command" file is mode 0600, yet has no
read function, and the "status" file is the same mode, with no write
function. These should be fixed, which is what the patch from Felipe is
pointing out.

Don't shoot the messenger :)

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/