Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3080913rwe; Mon, 29 Aug 2022 05:37:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR47sKMbTXavBzWg7FoTNoEEHBj59PAXS1hPiNmYi+H1P4WTDZqmi74losNH5fvbtG9KMfDU X-Received: by 2002:a17:903:2102:b0:174:4d5f:8abf with SMTP id o2-20020a170903210200b001744d5f8abfmr13472789ple.11.1661776662008; Mon, 29 Aug 2022 05:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661776662; cv=none; d=google.com; s=arc-20160816; b=JpVOQmUQR98HQoYUQ0o9Z9r1SzulTQ9v2cClV4Lw+XFyOywHzT4vE2SCg4ZVhkx2qM dnfWvJU2IxOd/+82G67wK2dFoOVP477SCBn06nCvqYPUez0FAatCDAwvCo28D/ScuiEy a+o1GBST+04c2LS9h6XKzkot96LmyLNvhJt/KzObCwZrm5TQikvxokJMnyrmefkcJ/Hv rrmd1OCjY5dYV6nPCv1qyCqE8oTXbubJ7K6A95xPFvaRGtRpIqL5+vGglh9AJ64pCddv MqMZP5XSZWD+7n4Jkgd0H0i+2i4x0uJAUyMt5SbVQSX1aTd6dv259YbI/J/NEvjTjNUB sz7A== 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=pJWVlGBgUhHDJA8nojmnRFJfXYFomTEyX1Eeggisvqw=; b=gZtKCNuQaw14Qdi13LPwX4kxEJGKvsLVkfWTZnMZCrxZ4V0zfzR6tGuF2PK+0yMDcj SfEbfF4SuQm1CmT0Sm/f4iRD7fbxvlxocXM4R9W5AYtK9AdPGk/opNwI32wL6inmJkGI g+/OtfFwtOtBJhpVsfoMHjU04lJRIsVBN/Vnsrt7Gbta94uBUtje7lByZBOad3txgSeI TvKAf35rOWn086XCxiFP2+HcYZSXt9ALjEqsnYMFYh8KTHWK4aMusRfMQ6/JPlQ/DXxm kYTsiBy+YIrZVT7fVZPe5fv9weab8It8xvktb5ncb/vbsGMLzSfBPUwpwqczEjrEDiW+ qVaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LAiOr5YG; 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 q7-20020a170902b10700b001713c1ffb4esi8766885plr.322.2022.08.29.05.37.30; Mon, 29 Aug 2022 05:37:41 -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=LAiOr5YG; 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 S229638AbiH2L7N (ORCPT + 99 others); Mon, 29 Aug 2022 07:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbiH2L6n (ORCPT ); Mon, 29 Aug 2022 07:58:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C21D295E4E; Mon, 29 Aug 2022 04:43:34 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 67B7E61211; Mon, 29 Aug 2022 11:16:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62A24C433D6; Mon, 29 Aug 2022 11:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771771; bh=O8q1De+bzMCYeAwIjgcjjJwFQrRcxH44Kc2fs3jgwtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LAiOr5YGSUXJvFMFFzsoqiFUHwzg+tPESg179ln0+tHmSspZVqItT2Bm5J2tX+k/h y+yS5r1EiTcJqxN3tv1/urp2F7/YK91n6E6mlZW0jB3TnkdYNz0mI0Z7681rSDhPJe qVJHakjcBggBi4bPKrCqI+byvNmF9PeaHq2KyIX8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aleksander Jan Bajkowski , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 093/158] net: lantiq_xrx200: restore buffer if memory allocation failed Date: Mon, 29 Aug 2022 12:59:03 +0200 Message-Id: <20220829105812.960262913@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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: Aleksander Jan Bajkowski [ Upstream commit c9c3b1775f80fa21f5bff874027d2ccb10f5d90c ] In a situation where memory allocation fails, an invalid buffer address is stored. When this descriptor is used again, the system panics in the build_skb() function when accessing memory. Fixes: 7ea6cd16f159 ("lantiq: net: fix duplicated skb in rx descriptor ring") Signed-off-by: Aleksander Jan Bajkowski Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/lantiq_xrx200.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c index 25adce7f0c7c0..57f27cc7724e7 100644 --- a/drivers/net/ethernet/lantiq_xrx200.c +++ b/drivers/net/ethernet/lantiq_xrx200.c @@ -193,6 +193,7 @@ static int xrx200_alloc_buf(struct xrx200_chan *ch, void *(*alloc)(unsigned int ch->rx_buff[ch->dma.desc] = alloc(priv->rx_skb_size); if (!ch->rx_buff[ch->dma.desc]) { + ch->rx_buff[ch->dma.desc] = buf; ret = -ENOMEM; goto skip; } -- 2.35.1