lkml.org 
[lkml]   [2018]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL for 4.9 007/219] staging: wilc1000: add check for kmalloc allocation failure.
    Date
    From: Colin Ian King <colin.king@canonical.com>

    [ Upstream commit 6cc0c259d034c6ab48f4e12f505213988e73d380 ]

    Add a sanity check that wid.val has been allocated, fixes a null
    pointer deference on stamac when calling ether_add_copy.

    Detected by CoverityScan, CID#1369537 ("Dereference null return value")

    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    ---
    drivers/staging/wilc1000/host_interface.c | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
    index 6ab7443eabde..6326375b76ab 100644
    --- a/drivers/staging/wilc1000/host_interface.c
    +++ b/drivers/staging/wilc1000/host_interface.c
    @@ -1930,6 +1930,8 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif,
    wid.type = WID_STR;
    wid.size = ETH_ALEN;
    wid.val = kmalloc(wid.size, GFP_KERNEL);
    + if (!wid.val)
    + return -ENOMEM;

    stamac = wid.val;
    memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN);
    --
    2.14.1
    \
     
     \ /
      Last update: 2018-03-03 23:31    [W:4.063 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site