lkml.org 
[lkml]   [2021]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 2/3] zram: fix deadlock with sysfs attribute usage and module removal
On Fri,  2 Jul 2021 17:19:57 -0700 Luis Chamberlain <mcgrof@kernel.org> wrote:

> +#define MODULE_DEVICE_ATTR_FUNC_STORE(_name) \
> +static ssize_t module_ ## _name ## _store(struct device *dev, \
> + struct device_attribute *attr, \
> + const char *buf, size_t len) \
> +{ \
> + ssize_t __ret; \
> + if (!try_module_get(THIS_MODULE)) \
> + return -ENODEV; \
> + __ret = _name ## _store(dev, attr, buf, len); \
> + module_put(THIS_MODULE); \
> + return __ret; \
> +}

I assume that Greg's comments on try_module_get() are applicable here
also.

\
 
 \ /
  Last update: 2021-07-10 21:29    [W:1.208 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site