[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210712231644.eeaql22odowieomb@garbanzo>
Date: Mon, 12 Jul 2021 16:17:15 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: minchan@...nel.org, gregkh@...uxfoundation.org, jeyu@...nel.org,
ngupta@...are.org, sergey.senozhatsky.work@...il.com,
rafael@...nel.org, axboe@...nel.dk, tj@...nel.org, mbenes@...e.com,
jpoimboe@...hat.com, tglx@...utronix.de, keescook@...omium.org,
jikos@...nel.org, rostedt@...dmis.org, peterz@...radead.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 2/3] zram: fix deadlock with sysfs attribute usage and
module removal
On Sat, Jul 10, 2021 at 12:28:51PM -0700, Andrew Morton wrote:
> On Fri, 2 Jul 2021 17:19:57 -0700 Luis Chamberlain <mcgrof@...nel.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.
While we wait for Greg for an alternative, patch #1 is still fine.
Luis
Powered by blists - more mailing lists