lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 13 Jun 2022 23:33:16 +0800
From:   liqiong <liqiong@...china.com>
To:     Casey Schaufler <casey@...aufler-ca.com>,
        James Morris <jmorris@...ei.org>,
        "Serge E . Hallyn" <serge@...lyn.com>
Cc:     linux-security-module@...r.kernel.org,
        linux-kernel@...r.kernel.org, yuzhe@...china.com,
        renyu@...china.com
Subject: Re: [PATCH] smackfs: check for allocation failure of kmalloc()



在 2022年06月13日 22:53, Casey Schaufler 写道:
> On 6/12/2022 11:22 PM, Li Qiong wrote:
>> As the possible failure of the kmalloc(), it should be better
>> to check it and print a warning message.
>
> The allocation is done with __GFP_NOFAIL, which assures
> it will not fail.

Thanks,  my mistake.
Drop this patch.



>
>>
>> Signed-off-by: Li Qiong <liqiong@...china.com>
>> ---
>>   security/smack/smackfs.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
>> index 4b58526450d4..0d11ba3cb4cd 100644
>> --- a/security/smack/smackfs.c
>> +++ b/security/smack/smackfs.c
>> @@ -695,6 +695,11 @@ static void smk_cipso_doi(void)
>>                  __func__, __LINE__, rc);
>>         doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL | __GFP_NOFAIL);
>> +    if (unlikely(!doip)) {
>> +        printk(KERN_WARNING "%s:%d failed to allocate a memory for doip\n",
>> +               __func__, __LINE__);
>> +        return;
>> +    }
>>       doip->map.std = NULL;
>>       doip->doi = smk_cipso_doi_value;
>>       doip->type = CIPSO_V4_MAP_PASS;

Powered by blists - more mailing lists