* [PATCH] libkmod-module: fix return code in error path
@ 2015-06-13 21:45 Lucas De Marchi
2015-06-14 10:55 ` David Herrmann
0 siblings, 1 reply; 3+ messages in thread
From: Lucas De Marchi @ 2015-06-13 21:45 UTC (permalink / raw)
To: linux-modules
Cc: Daniel Mack, David Herrmann, Lennart Poettering, Kay Sievers,
Lucas De Marchi
From: Lucas De Marchi <lucas.demarchi@intel.com>
ENOSYS is the wrong errno to return when we don't find a module in
kmod_module_insert_module(). Why is it there in the first place? This
goes back to kmod v1 when we couldn't load modules by names, but we
should give a path instead.
708624a ("ELF: initial support for modinfo and strip of modversions and
vermagic.") changed that so we do a lazy-search by the module path in
this function. Later f304afe ("Change error message to reflect
reality") fixed the log message but the return coded remained the same.
---
CC'ing here people from systemd who were bitten by this bug in kmod:
https://github.com/systemd/systemd/pull/166
I'm not sure about changing the return code since it was returning ENOSYS since
v1 :-/. However maybe the best thing to do is just treat it as a bug and let
the patch to be backported by distros that want it. Thoughts?
libkmod/libkmod-module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 366308f..50b2ff9 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -830,7 +830,7 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
path = kmod_module_get_path(mod);
if (path == NULL) {
ERR(mod->ctx, "could not find module by name='%s'\n", mod->name);
- return -ENOSYS;
+ return -ENOENT;
}
mod->file = kmod_file_open(mod->ctx, path);
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] libkmod-module: fix return code in error path
2015-06-13 21:45 [PATCH] libkmod-module: fix return code in error path Lucas De Marchi
@ 2015-06-14 10:55 ` David Herrmann
2015-06-18 4:36 ` Lucas De Marchi
0 siblings, 1 reply; 3+ messages in thread
From: David Herrmann @ 2015-06-14 10:55 UTC (permalink / raw)
To: Lucas De Marchi
Cc: linux-modules, Daniel Mack, David Herrmann, Lennart Poettering,
Kay Sievers, Lucas De Marchi
Hi
On Sat, Jun 13, 2015 at 11:45 PM, Lucas De Marchi
<lucas.de.marchi@gmail.com> wrote:
> From: Lucas De Marchi <lucas.demarchi@intel.com>
>
> ENOSYS is the wrong errno to return when we don't find a module in
> kmod_module_insert_module(). Why is it there in the first place? This
> goes back to kmod v1 when we couldn't load modules by names, but we
> should give a path instead.
>
> 708624a ("ELF: initial support for modinfo and strip of modversions and
> vermagic.") changed that so we do a lazy-search by the module path in
> this function. Later f304afe ("Change error message to reflect
> reality") fixed the log message but the return coded remained the same.
> ---
>
> CC'ing here people from systemd who were bitten by this bug in kmod:
> https://github.com/systemd/systemd/pull/166
>
> I'm not sure about changing the return code since it was returning ENOSYS since
> v1 :-/. However maybe the best thing to do is just treat it as a bug and let
> the patch to be backported by distros that want it. Thoughts?
Looks all good to me. Treating this as a bugfix is probably the best
thing to do. I'll revert the systemd patch once this is pushed.
Thanks
David
>
> libkmod/libkmod-module.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
> index 366308f..50b2ff9 100644
> --- a/libkmod/libkmod-module.c
> +++ b/libkmod/libkmod-module.c
> @@ -830,7 +830,7 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
> path = kmod_module_get_path(mod);
> if (path == NULL) {
> ERR(mod->ctx, "could not find module by name='%s'\n", mod->name);
> - return -ENOSYS;
> + return -ENOENT;
> }
>
> mod->file = kmod_file_open(mod->ctx, path);
> --
> 2.4.3
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libkmod-module: fix return code in error path
2015-06-14 10:55 ` David Herrmann
@ 2015-06-18 4:36 ` Lucas De Marchi
0 siblings, 0 replies; 3+ messages in thread
From: Lucas De Marchi @ 2015-06-18 4:36 UTC (permalink / raw)
To: David Herrmann
Cc: linux-modules, Daniel Mack, David Herrmann, Lennart Poettering,
Kay Sievers, Lucas De Marchi
On Sun, Jun 14, 2015 at 7:55 AM, David Herrmann <dh.herrmann@gmail.com> wrote:
> Hi
>
> On Sat, Jun 13, 2015 at 11:45 PM, Lucas De Marchi
> <lucas.de.marchi@gmail.com> wrote:
>> From: Lucas De Marchi <lucas.demarchi@intel.com>
>>
>> ENOSYS is the wrong errno to return when we don't find a module in
>> kmod_module_insert_module(). Why is it there in the first place? This
>> goes back to kmod v1 when we couldn't load modules by names, but we
>> should give a path instead.
>>
>> 708624a ("ELF: initial support for modinfo and strip of modversions and
>> vermagic.") changed that so we do a lazy-search by the module path in
>> this function. Later f304afe ("Change error message to reflect
>> reality") fixed the log message but the return coded remained the same.
>> ---
>>
>> CC'ing here people from systemd who were bitten by this bug in kmod:
>> https://github.com/systemd/systemd/pull/166
>>
>> I'm not sure about changing the return code since it was returning ENOSYS since
>> v1 :-/. However maybe the best thing to do is just treat it as a bug and let
>> the patch to be backported by distros that want it. Thoughts?
>
> Looks all good to me. Treating this as a bugfix is probably the best
> thing to do. I'll revert the systemd patch once this is pushed.
Applied. The next release will take a while but I do recommend all
distros to cherry-pick this patch.
thanks.
--
Lucas De Marchi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-18 4:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-13 21:45 [PATCH] libkmod-module: fix return code in error path Lucas De Marchi
2015-06-14 10:55 ` David Herrmann
2015-06-18 4:36 ` Lucas De Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).