Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3280416pxp; Mon, 14 Mar 2022 15:21:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9uTt2Lp5f3XHRFrkgxXnN1QJu6sPy6wSmp7sCL6phAgSFejAsw+mfRF6cmEHP5Uswq89r X-Received: by 2002:a17:906:974e:b0:6bb:4f90:a6ae with SMTP id o14-20020a170906974e00b006bb4f90a6aemr21113012ejy.452.1647296500357; Mon, 14 Mar 2022 15:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647296500; cv=none; d=google.com; s=arc-20160816; b=hqRExPH1AhQkVaQWo6T3F2em6LeIsAm4iJewit6dvVh644RjxNv/2vPb4BzxLKogc8 YHQdtxZPexCMIb9I+kcFLGJDgVtruBKq/eqQVfFz2haffZ8/trWmQUnKQFm3M+eqyR5y YTitOdWn00zBpGS+uwOjqb/vhtOXJh+7N6RsXyI5KcWd5TtJTM39P6Br3DWqXx8H2xT6 VLxg1UFC7+a84As4yxGGzj9rsQ+xp9huCjTsqKyrMYMnraM/mfqTveTdhVTMeruNOtj/ E1z3Lp5TXMCLSk72v+G8jk7eCYZWuUeNMFX28q5yLjHCYO/y/PkZcCHn8verRa1tA2wU Iftg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bCfQiTJgiexAm9gMdhkm0u2ZWVB6kNDaktQk01Av3UQ=; b=jgvob9aHlqy6cMe1inCVjic5fKRR1i7XgXjg/eCDANZhW9PVsYb0aoXKnPwuUUz9PD QBrFrXSwNZbM2IvAJq6ge+QcmBfs7jjVuFY8+JKF9stXm0CDJtUIXmFtLJf1SNOm4Yc8 x/j3aRDLxpqekSEwZ+FDQkzlWsQWsWODHv1Pq+veiMA8syDLb0qep1InznZxeAm9/Buc KDfD8z5s7JC6ZRoAkcSyaU1TkWurBYHtPHhmDfW9TOSH/HX3JskC3TLvwjBQri/1nqSB pngYG3C43rXQaAv/Esho7pmHsv1Fpm943vwTETvtTC7oTMn54Cy6G58lYVLs0wdRhwWO gRZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JuRALm8q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17-20020a056402351100b004162a3bc958si1355670edd.272.2022.03.14.15.21.15; Mon, 14 Mar 2022 15:21:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JuRALm8q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244418AbiCNMcF (ORCPT + 99 others); Mon, 14 Mar 2022 08:32:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243799AbiCNMVQ (ORCPT ); Mon, 14 Mar 2022 08:21:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0B7049F83; Mon, 14 Mar 2022 05:17:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9949BB80DC0; Mon, 14 Mar 2022 12:17:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB94EC340E9; Mon, 14 Mar 2022 12:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647260221; bh=iPLPLA7IMxm/yNnObmx+1b1e4pzUaWU5IeYMucuip24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JuRALm8qa02uSeevSnA1S/bx+wUYcpjnlVyx8zZzHW2s7S+v4f/22b9oU4fMAaAb/ uEqKljCrTA+AAiCmRrQ07UjUPt7aUNLU0IKJXVWRgMLqaPwWR/tr5T4PJjvA/uNfqy pLuSRKnw0PGuznGYMplz3fKQGR0FDth0azbxelww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter Subject: [PATCH 5.16 090/121] staging: gdm724x: fix use after free in gdm_lte_rx() Date: Mon, 14 Mar 2022 12:54:33 +0100 Message-Id: <20220314112746.629986870@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112744.120491875@linuxfoundation.org> References: <20220314112744.120491875@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter commit fc7f750dc9d102c1ed7bbe4591f991e770c99033 upstream. The netif_rx_ni() function frees the skb so we can't dereference it to save the skb->len. Fixes: 61e121047645 ("staging: gdm7240: adding LTE USB driver") Cc: stable Reported-by: kernel test robot Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20220228074331.GA13685@kili Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_lte.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index 493ed4821515..0d8d8fed283d 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -76,14 +76,15 @@ static void tx_complete(void *arg) static int gdm_lte_rx(struct sk_buff *skb, struct nic *nic, int nic_type) { - int ret; + int ret, len; + len = skb->len + ETH_HLEN; ret = netif_rx_ni(skb); if (ret == NET_RX_DROP) { nic->stats.rx_dropped++; } else { nic->stats.rx_packets++; - nic->stats.rx_bytes += skb->len + ETH_HLEN; + nic->stats.rx_bytes += len; } return 0; -- 2.35.1