Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1065944ybl; Wed, 14 Aug 2019 10:09:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1zmaEB4wieuIK+SLmxXeSSr1hVhtvLf1lMxxXEEWz7EDLOQux3H4fwgT+HzQsyvScsRic X-Received: by 2002:a17:902:f46:: with SMTP id 64mr385645ply.235.1565802565289; Wed, 14 Aug 2019 10:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802565; cv=none; d=google.com; s=arc-20160816; b=QbYDn2arxDJY2CpZj2FdBWrT1tZd7RyCMdA6VOKiIiNul2CtbKUky2hSOkuocUKxwx Iv0BmkiPXxDxTpV9B+zcJuunoqsdP7tM+i6LpEXtNLeTH32oL4m9v2JRkdal+ECIiB3c lLQYRR2dI3E7NxFGle7/4v4h55wCjgUdP7ey2r08/fGBrqXTG91rUKpboqHdaauHc8vr KGnjbc27EK1PwDvX3OVx0wUq2kaoj5Tt6gJgZjwOLo3qoQNcmEwpSlU8P6yCi+84arSg 0OoAV0gAzwofF/OggqtAEAr7gY8I6X1f2DYf0C3vqoSFtgDyPAxZPn2rhHcrrZjRlJr3 D7JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JzHFfwQTZKSStQzWDfio/0nPaCZAk1HX879gjyYc0ys=; b=HJQuO3ncpyrZMNfy5OwfuXV05Z0Gun/lZjawnSwyhdX/Lo7eDbDwhAtWZFuuCuS2SF eGj5hhnNdk+kdtQdxftetWRBUUONDbc/MvKq+M4DmSwp11aBf7VPBr1QlFwrkKKz2TAS PrPqoQcaBwY8O+uKZ+qdeV/KulcdEF4BVsxvC4nQFRZkfnDPom1NPbZABjJW0Drr7veR ioaV5XgH6vm4/AEywU1DNwEk1b3f/aVUl0Kv0SKKN5w4K4XEi6to3GMAcSIcMUf7Uhmx 3gW5PLGxYXsOpcCP7b6OxghjnZmMKf4SNn8o9Ordeq+2H4cb+daDME+fOBYcjd+sEBHx rFhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S4Gn9HED; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si171639pgp.320.2019.08.14.10.09.09; Wed, 14 Aug 2019 10:09:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S4Gn9HED; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730048AbfHNRID (ORCPT + 99 others); Wed, 14 Aug 2019 13:08:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:57798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730035AbfHNRIB (ORCPT ); Wed, 14 Aug 2019 13:08:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA5EB214DA; Wed, 14 Aug 2019 17:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802480; bh=YFlaAVjmdVZ9XdNhwVjIZnJ4nRFc81vzqueGiTczBeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S4Gn9HEDOeFYRH+99yE/5QU+uGleMDnr6Sjr41EWny70wrU0A/MElvM9MgeIluGBs oTurU3IAhVG+2PxAzzeK3sCuOcqiZ4VWm1t7PIj3p3G0HH1exDDZFGB+27qfQ0dWEM Yupjj3tOIHZDIbh685zv5M9MxzPXmJIS59m4XpIo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emmanuel Grumbach , Johannes Berg Subject: [PATCH 5.2 142/144] iwlwifi: mvm: fix a use-after-free bug in iwl_mvm_tx_tso_segment Date: Wed, 14 Aug 2019 19:01:38 +0200 Message-Id: <20190814165805.908186196@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Emmanuel Grumbach commit 71b256f8f7a5c09810d2c3ed6165629c2cc0a652 upstream. Accessing the hdr of an skb that was consumed already isn't a good idea. First ask if the skb is a QoS packet, then keep that data on stack, and then consume the skb. This was spotted by KASAN. Cc: stable@vger.kernel.org Fixes: 08f7d8b69aaf ("iwlwifi: mvm: bring back mvm GSO code") Signed-off-by: Emmanuel Grumbach Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -831,6 +831,7 @@ iwl_mvm_tx_tso_segment(struct sk_buff *s unsigned int tcp_payload_len; unsigned int mss = skb_shinfo(skb)->gso_size; bool ipv4 = (skb->protocol == htons(ETH_P_IP)); + bool qos = ieee80211_is_data_qos(hdr->frame_control); u16 ip_base_id = ipv4 ? ntohs(ip_hdr(skb)->id) : 0; skb_shinfo(skb)->gso_size = num_subframes * mss; @@ -864,7 +865,7 @@ iwl_mvm_tx_tso_segment(struct sk_buff *s if (tcp_payload_len > mss) { skb_shinfo(tmp)->gso_size = mss; } else { - if (ieee80211_is_data_qos(hdr->frame_control)) { + if (qos) { u8 *qc; if (ipv4)