Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp854275pxk; Thu, 17 Sep 2020 19:10:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKDwrxKUnd5JkV2MYrmaAafOt3oY52dEQq0ndQsx+0uZU1a65huYDMFVnLhemW447LCz73 X-Received: by 2002:a17:906:4902:: with SMTP id b2mr33041703ejq.208.1600395027841; Thu, 17 Sep 2020 19:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600395027; cv=none; d=google.com; s=arc-20160816; b=PgfcGIdKEZMUh9J883EO+VECQHZGSebt7xEvCd9ODG22H1pVWvQ2VKMQVgM731y59+ IBe9flzR+ctJov/IO3q0mRMqOAOLB+IPKqLJIMIUMJ0iR3ah8A8touVq0e6nM/6wWNcn pFJAli+/WpqugxqK3aJRxBZiQ0oF3xxZqkDEvOsvPV2KDQmoclfk+s4oRjNFMhKKRvgv uQhdM792CYoahY6W7MdmmIZpQClO7O4IPe/xfVoj8UlfYCSCH4rt6c0yoRUb3H0LjPgO pc2epFycU3ybLk5LmBvWVcRIf+YurHQ0hoVZhUedeQaC9OLiBYm/MwaeKdG7DGhrduLO P76Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vbOycBz32jt1y+swwY12B11d4AYqWKqDjAV2yn0CqEc=; b=BoXUZRBAMnBPMBfBHMzu10+LxaQT1iFI4Ne588FkwVvS0EzB5/Knfc8U17pBdnhcWe iljnRTo9clLeY1Sbg9mxXxXr/eSlqBdiQwKyTXQpglGyGO9UyQNh0kEI3xRvxCyBhkmv f5XaxDoVmN2caCndJdFFdVYuvTWZpNixrMuj9y2hOEIJpTnbmMSc29AR9vp8bbgg4Xpa 5yDmbvQmU1UTduYgO2Ftr+ofsytKts34ifeGb9M8bwROQI4gzn219zX/LbPa5X61E/NV sCFXdRBBQsZmyUzLt7nWJC9WLwEe3E3AKe+pfNjY0ltuAcRa2C9H/TayPoYaA0GYx/4b 9p5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LVdUDEtS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz3si1184072ejc.81.2020.09.17.19.10.03; Thu, 17 Sep 2020 19:10:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LVdUDEtS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726792AbgIRCGQ (ORCPT + 99 others); Thu, 17 Sep 2020 22:06:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:55350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726921AbgIRCGM (ORCPT ); Thu, 17 Sep 2020 22:06:12 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1212A23998; Fri, 18 Sep 2020 02:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394771; bh=fZZCEGFydofpvNrC2u+zqeNMdJdbpepgmYn/1pa37/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LVdUDEtSM50RDFwsP/08zozcPnSFCt/xWTCGSziWy42KpkV9/gPjifdJzqzIq3s9Q R959cH3b/kv/NfECNiMZDP82nTHW8uq6Q57UCEQ3kflpK7cm+k8Qkxee75kbzppzX1 QfzRhAWk7FyT2CNv1aWwmfxeVJC1jeSOzZOURGII= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ivan Safonov , Greg Kroah-Hartman , Sasha Levin , devel@driverdev.osuosl.org Subject: [PATCH AUTOSEL 5.4 246/330] staging:r8188eu: avoid skb_clone for amsdu to msdu conversion Date: Thu, 17 Sep 2020 21:59:46 -0400 Message-Id: <20200918020110.2063155-246-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ivan Safonov [ Upstream commit 628cbd971a927abe6388d44320e351c337b331e4 ] skb clones use same data buffer, so tail of one skb is corrupted by beginning of next skb. Signed-off-by: Ivan Safonov Link: https://lore.kernel.org/r/20200423191404.12028-1-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8188eu/core/rtw_recv.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index d4278361e0028..a036ef104198e 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -1525,21 +1525,14 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) /* Allocate new skb for releasing to upper layer */ sub_skb = dev_alloc_skb(nSubframe_Length + 12); - if (sub_skb) { - skb_reserve(sub_skb, 12); - skb_put_data(sub_skb, pdata, nSubframe_Length); - } else { - sub_skb = skb_clone(prframe->pkt, GFP_ATOMIC); - if (sub_skb) { - sub_skb->data = pdata; - sub_skb->len = nSubframe_Length; - skb_set_tail_pointer(sub_skb, nSubframe_Length); - } else { - DBG_88E("skb_clone() Fail!!! , nr_subframes=%d\n", nr_subframes); - break; - } + if (!sub_skb) { + DBG_88E("dev_alloc_skb() Fail!!! , nr_subframes=%d\n", nr_subframes); + break; } + skb_reserve(sub_skb, 12); + skb_put_data(sub_skb, pdata, nSubframe_Length); + subframes[nr_subframes++] = sub_skb; if (nr_subframes >= MAX_SUBFRAME_COUNT) { -- 2.25.1