Skip to contentSkip to conversation

fs/read_write: Do not export __kernel_write() to the entire world

PATCH Superseded Andy Shevchenko 1 participant 2 messages Jun 4 VFS

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/read_write: Do not export __kernel_write() to the entire world

Since we have EXPORT_SYMBOL_FOR_MODULES(), we may narrow the __kernel_write() export to the only which really needs it. With that being done, update the respective comment.

---
 fs/read_write.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/read_write.c +2 -3
index 1e5444f4dab3..1f50f5d015ec 100644
@@ -641,13 +641,12 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t
 	return __kernel_write_iter(file, &iter, pos);
 }
 /*
- * This "EXPORT_SYMBOL_GPL()" is more of a "EXPORT_SYMBOL_DONTUSE()",
- * but autofs is one of the few internal kernel users that actually
+ * autofs is one of the few internal kernel users that actually
  * wants this _and_ can be built as a module. So we need to export
  * this symbol for autofs, even though it really isn't appropriate
  * for any other kernel modules.
  */
-EXPORT_SYMBOL_GPL(__kernel_write);
+EXPORT_SYMBOL_GPL_FOR_MODULES(__kernel_write, "autofs");
 
 ssize_t kernel_write(struct file *file, const void *buf, size_t count,
 			    loff_t *pos)
Signature · 1 line
2.50.1
#1 lore raw

On Thu, Jun 04, 2026 at 11:28:21AM +0200, Andy Shevchenko wrote:

...

fs/read_write.c ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t · line 649

Quoted 2 lines
fs/read_write.c +1 -1
-EXPORT_SYMBOL_GPL(__kernel_write);
+EXPORT_SYMBOL_GPL_FOR_MODULES(__kernel_write, "autofs");

Sorry, The GPL here was removed in a somewhat recent kernels. This won't build on the current. I will send a v2.

Signature · 2 lines
With Best Regards,
Andy Shevchenko