Am Montag, 20. Oktober 2025, 19:53:40 CEST schrieb Josh Poimboeuf:
> Commit 6717e8f91db7 ("kbuild: Remove 'kmod_' prefix from
> __KBUILD_MODNAME") inadvertently broke module alias generation for
> modules which rely on MODULE_DEVICE_TABLE().
> 
> It removed the "kmod_" prefix from __KBUILD_MODNAME, which caused
> MODULE_DEVICE_TABLE() to generate a symbol name which no longer matched
> the format expected by handle_moddevtable() in scripts/mod/file2alias.c.
> 
> As a result, modpost failed to find the device tables, leading to
> missing module aliases.
> 
> Fix this by explicitly adding the "kmod_" string within the
> MODULE_DEVICE_TABLE() macro itself, restoring the symbol name to the
> format expected by file2alias.c.
> 
> Fixes: 6717e8f91db7 ("kbuild: Remove 'kmod_' prefix from __KBUILD_MODNAME")
> Reported-by: Alexander Stein <[email protected]>
> Reported-by: Marek Szyprowski <[email protected]>
> Reported-by: Mark Brown <[email protected]>
> Reported-by: Cosmin Tanislav <[email protected]>
> Signed-off-by: Josh Poimboeuf <[email protected]>

Tested-by: Alexander Stein <[email protected]>

Thanks!

> ---
>  include/linux/module.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/module.h b/include/linux/module.h
> index e135cc79aceea..d80c3ea574726 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -251,10 +251,11 @@ struct module_kobject 
> *lookup_or_create_module_kobject(const char *name);
>   */
>  #define __mod_device_table(type, name)       \
>       __PASTE(__mod_device_table__,   \
> +     __PASTE(kmod_,                  \
>       __PASTE(__KBUILD_MODNAME,       \
>       __PASTE(__,                     \
>       __PASTE(type,                   \
> -     __PASTE(__, name)))))
> +     __PASTE(__, name))))))
>  
>  /* Creates an alias so file2alias.c can find device table. */
>  #define MODULE_DEVICE_TABLE(type, name)                                      
> \
> 


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



Reply via email to