Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp4160586pxp; Tue, 15 Mar 2022 14:04:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbMIN+2Q8XkWxoD3HXpTVVdjI2R7s/XG7t+3ioFiW2OjQ0ZsMKZDXtoD3euC9M+2zgTPP6 X-Received: by 2002:a63:5119:0:b0:37f:8077:ae15 with SMTP id f25-20020a635119000000b0037f8077ae15mr26236753pgb.11.1647378277612; Tue, 15 Mar 2022 14:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647378277; cv=none; d=google.com; s=arc-20160816; b=iEUiG/ptU/sTdXZeGkpZZsk8oXKotauXz7kAZHvkDUm/CYjCUhO7CDYbvBmqr0EkkC MEgeFzGgu8GXtdchFHY7c1k0evZkpOzx2IIsF62pfVX5oceeQdJPgJLZXaV45pGRtoeU DyxNrlVPON3lgr2Wym2Lrwjtkh750EZdggYTGVOa19EJW8/rTeq6Dd23IR3O1m/FSOfQ KMH+/eKiXo9AST74PeGSpWwdr7Xv2cXqhXOk90z9GYhPxeR50eB5CT5YBElLoy1WNxUD fW+HlFO8PL6druviTU+hcQpAb7DZKzWOm0ABOmkRy1hL31CFDIQuBRQGP+7q0KG3xb/P HGnA== 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=rsjEv0im/g5oAEL6sfGTKxXBnl82JUWTBM5v+w8JLVo=; b=xdmW0TWih2IES1WU2Lg2WZ+T8n+0taGxweK2HyIIOG1u1NVbIy/aitmYiKwVNyDtQr 5pyXeM7tCwG8RG+8JFFBPL4V18MW0on/t5b+mu1Qgm2YvZcmXQSrotm14tUvxva+Dw3J +MMdCJCbCERyLS5ut2RYxXuPjDvW5K19x6dV39Nr6bFdajZZsOhByc0ktlZJFTFyzqif ushdUtPlldNKzF9rOKbtmT/tZsujHS3sztEd23ZLZSn0kPMhMqfMxGxZmaAb2GGK7eEg Ctxzb7L89or8es96XilahmEpXeb5PY8chLyL5fdjIrrAlCtli+c5Kq/LrqyEzJVzDhGO O9Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j8QTR6Rt; 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 d8-20020a170902cec800b00151cae42dc1si20773062plg.417.2022.03.15.14.03.57; Tue, 15 Mar 2022 14:04:37 -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=j8QTR6Rt; 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 S242671AbiCNMTX (ORCPT + 99 others); Mon, 14 Mar 2022 08:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234660AbiCNML1 (ORCPT ); Mon, 14 Mar 2022 08:11:27 -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 D6C4D33A25; Mon, 14 Mar 2022 05:10:16 -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 73849B80DF4; Mon, 14 Mar 2022 12:10:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B860C340EC; Mon, 14 Mar 2022 12:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259814; bh=2z3sHLbs3i+JwZqjq1YXDQcvL9PzzebynVKwSZ/U2TA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j8QTR6RtSyylUSR4/8nH/al6vGu2ya0gPuYhrIFRJyV0a5Fy7PTm2nM/NgBbVjado FYTxasUo6lA1nLhDsIEiten0DSvWuWSzM50LcEfx/MKYSEksS94iRY7LTya4DYrE/b aBzumQ8jspIGUM1bi+lO9CLtNwVLIoozWSsc0/20= 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.15 078/110] staging: gdm724x: fix use after free in gdm_lte_rx() Date: Mon, 14 Mar 2022 12:54:20 +0100 Message-Id: <20220314112745.209940174@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112743.029192918@linuxfoundation.org> References: <20220314112743.029192918@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(-) --- 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;