Re: [PATCH] klogd core

From: Andrea Morandi <andrea_at_crcc.it>
Date: Fri, 04 Jul 2008 16:35:11 +0200

Hi all,

This is the same bug I pointed out on April 2008 (see mailing-list
archive for reference).

Here is the problem:

IF (KSYMS == NULL) => FCLOSE(KSYMS)

And here is the code:

        if ( ksyms == NULL )
        {
                if ( errno == ENOENT )
                        Syslog(LOG_INFO, "No module symbols loaded - "
                               "kernel modules not enabled.\n");
                else
                        Syslog(LOG_ERR, "Error loading kernel symbols " \
                               "- %s\n", strerror(errno));
                fclose(ksyms);
                return(0);
        }

It's useless to test if ksyms is NULL as the code is executed ONLY if it
IS NULL.
The patch provided by Mr. Young is correct, it 's enough to remove
fclose line.

regards,
Andrea

Martin Schulze wrote:
> Sean Young wrote:
>
>> With /proc/kallsyms disabled in the kernel, klogd crashes. fclose(NULL) is
>> executed.
>>
>
> Hmbf! Do you know since which version?
>
>
>> --- ksym_mod.c.orig 2008-07-04 14:43:39.000000000 +0100
>> +++ ksym_mod.c 2008-07-04 14:43:48.000000000 +0100
>> @@ -189,7 +189,6 @@
>> else
>> Syslog(LOG_ERR, "Error loading kernel symbols " \
>> "- %s\n", strerror(errno));
>> - fclose(ksyms);
>> return(0);
>> }
>>
>
> It would be better to test if ksyms is NULL (or not resp.).
>
> Regards,
>
> Joey
>
>
Received on Fri Jul 04 2008 - 16:35:11 CEST

This archive was generated by hypermail 2.2.0 : Fri Jul 04 2008 - 16:35:42 CEST