Skip to content

Commit fc7f750

Browse files
Dan Carpentergregkh
authored andcommitted
staging: gdm724x: fix use after free in gdm_lte_rx()
The netif_rx_ni() function frees the skb so we can't dereference it to save the skb->len. Fixes: 61e1210 ("staging: gdm7240: adding LTE USB driver") Cc: stable <stable@vger.kernel.org> Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20220228074331.GA13685@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7e57714 commit fc7f750

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/staging/gdm724x/gdm_lte.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,15 @@ static void tx_complete(void *arg)
7676

7777
static int gdm_lte_rx(struct sk_buff *skb, struct nic *nic, int nic_type)
7878
{
79-
int ret;
79+
int ret, len;
8080

81+
len = skb->len + ETH_HLEN;
8182
ret = netif_rx_ni(skb);
8283
if (ret == NET_RX_DROP) {
8384
nic->stats.rx_dropped++;
8485
} else {
8586
nic->stats.rx_packets++;
86-
nic->stats.rx_bytes += skb->len + ETH_HLEN;
87+
nic->stats.rx_bytes += len;
8788
}
8889

8990
return 0;

0 commit comments

Comments
 (0)