I have the following code:
static struct kobj_attribute my_attribute =__ATTR(my_node, 0444, my_show_fn, my_store_fn);
...
kobject_init(&my_module->kobj, &ktype_my_module);
ret = kobject_add(&my_module->kobj, kernel_kobj, "%s", "my_module");
...
ret = sysfs_create_file(&my_module->kobj, &my_attribute.attr);
This creates a /sys/kernel/my_module/my_node node
, owned by root with 0444 permissions.
How can I make a non-root user own this node, from within the kernel code?