lkml.org 
[lkml]   [2019]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 4.14 007/130] staging: rtl8188eu: fix possible null dereference
    Date
    From: Connor Kuehl <connor.kuehl@canonical.com>

    [ Upstream commit 228241944a48113470d3c3b46c88ba7fbe0a274b ]

    Inside a nested 'else' block at the beginning of this function is a
    call that assigns 'psta' to the return value of 'rtw_get_stainfo()'.
    If 'rtw_get_stainfo()' returns NULL and the flow of control reaches
    the 'else if' where 'psta' is dereferenced, then we will dereference
    a NULL pointer.

    Fix this by checking if 'psta' is not NULL before reading its
    'psta->qos_option' data member.

    Addresses-Coverity: ("Dereference null return value")

    Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
    Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
    Link: https://lore.kernel.org/r/20190926150317.5894-1-connor.kuehl@canonical.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
    index 904b988ecc4ee..7c895af1ba31c 100644
    --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
    +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
    @@ -805,7 +805,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr
    memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN);
    memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);

    - if (psta->qos_option)
    + if (psta && psta->qos_option)
    qos_option = true;
    } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
    check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
    @@ -813,7 +813,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr
    memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
    memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN);

    - if (psta->qos_option)
    + if (psta && psta->qos_option)
    qos_option = true;
    } else {
    RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("fw_state:%x is not allowed to xmit frame\n", get_fwstate(pmlmepriv)));
    --
    2.20.1
    \
     
     \ /
      Last update: 2019-12-10 23:14    [W:4.432 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site