lkml.org 
[lkml]   [2021]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.4 066/162] smackfs: use __GFP_NOFAIL for smk_cipso_doi()
    Date
    From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>

    [ Upstream commit f91488ee15bd3cac467e2d6a361fc2d34d1052ae ]

    syzbot is reporting kernel panic at smk_cipso_doi() due to memory
    allocation fault injection [1]. The reason for need to use panic() was
    not explained. But since no fix was proposed for 18 months, for now
    let's use __GFP_NOFAIL for utilizing syzbot resource on other bugs.

    Link: https://syzkaller.appspot.com/bug?extid=89731ccb6fec15ce1c22 [1]
    Reported-by: syzbot <syzbot+89731ccb6fec15ce1c22@syzkaller.appspotmail.com>
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    security/smack/smackfs.c | 4 +---
    1 file changed, 1 insertion(+), 3 deletions(-)

    diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
    index 845ed464fb8cd..40c8b2b8a4722 100644
    --- a/security/smack/smackfs.c
    +++ b/security/smack/smackfs.c
    @@ -721,9 +721,7 @@ static void smk_cipso_doi(void)
    printk(KERN_WARNING "%s:%d remove rc = %d\n",
    __func__, __LINE__, rc);

    - doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL);
    - if (doip == NULL)
    - panic("smack: Failed to initialize cipso DOI.\n");
    + doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL | __GFP_NOFAIL);
    doip->map.std = NULL;
    doip->doi = smk_cipso_doi_value;
    doip->type = CIPSO_V4_MAP_PASS;
    --
    2.33.0


    \
     
     \ /
      Last update: 2021-11-24 13:04    [W:5.033 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site