lkml.org 
[lkml]   [2021]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/3] zram: fix deadlock with sysfs attribute usage and driver removal
On Tue, Jun 22, 2021 at 09:41:23AM +0200, Greg KH wrote:
> On Mon, Jun 21, 2021 at 04:36:34PM -0700, Luis Chamberlain wrote:
> > + ssize_t __ret; \
> > + if (!try_module_get(THIS_MODULE)) \
>
> try_module_get(THIS_MODULE) is always racy and probably does not do what
> you want it to do. You always want to get/put module references from
> code that is NOT the code calling these functions.

In this case, we want it to trump module removal if it succeeds. That's all.

> > + return -ENODEV; \
> > + __ret = _name ## _store(dev, attr, buf, len); \
> > + module_put(THIS_MODULE); \
>
> This too is going to be racy.
>
> While fun to poke at, I still think this is pointless.

If you have a better idea, which does not "DOS" module removal, please
let me know!

Luis

\
 
 \ /
  Last update: 2021-06-22 17:27    [W:0.170 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site