Thread (12 messages) 12 messages, 3 authors, 2021-07-27

Re: [PATCH v6 2/3] zram: fix deadlock with sysfs attribute usage and module removal

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2021-07-11 05:00:47
Also in: lkml

On Sat, Jul 10, 2021 at 12:28:51PM -0700, Andrew Morton wrote:
On Fri,  2 Jul 2021 17:19:57 -0700 Luis Chamberlain [off-list ref] wrote:
quoted
+#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.
Yes, this is still broken code and does not do what it says it does,
please do not merge it.

Again, almost anything that does try_module_get(THIS_MODULE) is broken,
this code included.  I'll write more in a week or so when I get a chance
to get to this series in my reviews...

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help