• Yan-Hsuan Chuang's avatar
    rtw88: fix beaconing mode rsvd_page memory violation issue · c3594559
    Yan-Hsuan Chuang authored
    When downloading the reserved page, the first page always contains
    a beacon for the firmware to reference. For non-beaconing modes such
    as station mode, also put a blank skb with length=1.
    
    And for the beaconing modes, driver will get a real beacon with a
    length approximate to the page size. But as the beacon is always put
    at the first page, it does not need a tx_desc, because the TX path
    will generate one when TXing the reserved page to the hardware. So we
    could allocate a buffer with a size smaller than the reserved page,
    when using memcpy() to copy the content of reserved page to the buffer,
    the over-sized reserved page will violate the kernel memory.
    
    To fix it, add the tx_desc before memcpy() the reserved packets to
    the buffer, then we can get SKBs with correct length when counting
    the pages in total. And for page 0, count the extra tx_desc_sz that
    the TX path will generate. This way, the first beacon that allocated
    without tx_desc can be counted with the extra tx_desc_sz to get
    actual pages it requires.
    
    Fixes: e3037485 ("rtw88: new Realtek 802.11ac driver")
    Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
    Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
    c3594559
fw.c 24 KB