Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4483335ybx; Mon, 4 Nov 2019 14:10:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzXf2pXglOi+u1FzRMhRFkH8ruquyxmyJXScMfCNfsaEluRBUEDcaToHFEWzPpa3lpUmZcM X-Received: by 2002:a50:f284:: with SMTP id f4mr17624057edm.126.1572905451509; Mon, 04 Nov 2019 14:10:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572905451; cv=none; d=google.com; s=arc-20160816; b=uVU1y4lbvl9T6Gh72x9kpWTRNPjI2frcONJA3DaNXjY8LbLN6h9apnHWp+e1irCp0b lropwTRJZUaHOCzGTK8OV8W4o3n+YYd6RngyQ0QIcylMtCHKYLag7bXd38z/lFRTviD2 DnbacNJuSpR7QQgGWfqFbRCQ2iD+d44vZPecLGnLWD9K+Mff4/U1vJySYL0BqVeznIc6 7KT3mxdte9T5tbDXtOpcnn9AqAj7avr3NYEREhbPNY7LBAzjuRA/xgyRmxCMc4cd+aUh 9qI6jUKYHOkblS6cDDnCLg/dQwKAgSG/0hwEI3j/Lz/gfvOR17tMdo2sYCwaouRDIyud 2XCw== 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=/wvD2z4NP8cxovih7u+iq0nze9V20n1zo5DTh7p2yP4=; b=iI8rA7uZX4mKJFlkvEAmx+7xvc7Zmnuujkc7yc+jaYvgWY0QKpzO1ukI8vBK8sk1bM cgZnFG3CQWN+Lo4a1MyhyD4a4noqD7ZtUMmcyD0b4B+ctPGdi4oFM9ZAshfFM98gL8KW 3NJMO9kQ73TYZ60a7oanxnL3X0HcX61lj6C5ZTmyefhnYuETGxzEptFkwjMoxblKoaXn o8eJzpevp9KamkZOOk3iIKasnpDpOs9JGc2NFenMnIhJig66oCpxsVebbaxK46P5eRpg ARlsU7CNzXnZtJYOcphkdRuXB5qQo348968DW4MLh+Ne1qIUbxDCrB5CYm5R4nx2hQ3D IAkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oUwjBCH6; 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 ay3si80697ejb.408.2019.11.04.14.10.28; Mon, 04 Nov 2019 14:10:51 -0800 (PST) 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=oUwjBCH6; 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 S2389706AbfKDWKA (ORCPT + 99 others); Mon, 4 Nov 2019 17:10:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:43102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387458AbfKDWJ4 (ORCPT ); Mon, 4 Nov 2019 17:09:56 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (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 25A4E205C9; Mon, 4 Nov 2019 22:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572905395; bh=H86na4SwTHD42al8jI4omt8W7BwlKnekQUgfHXUlBbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oUwjBCH62r0R7VGir0w/jXWNCi++GL7oRYHhY+Vrh9PfEcZUq/jvZIhnSe/TuAKxo Rr0XVWg8tlFIAyi6wCpYT0gusL7J69zbiinMA9gUWQxbLMqEkM9KU5jbRTV6PcOafy 1huo47QnVmm8Gz0oGS8y5MA73H5zHtsf7D2e4BLk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Larry Finger , Kalle Valo Subject: [PATCH 5.3 130/163] rtlwifi: rtl_pci: Fix problem of too small skb->len Date: Mon, 4 Nov 2019 22:45:20 +0100 Message-Id: <20191104212149.737476048@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212140.046021995@linuxfoundation.org> References: <20191104212140.046021995@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: Larry Finger commit b43f4a169f220e459edf3ea8f8cd3ec4ae7fa82d upstream. In commit 8020919a9b99 ("mac80211: Properly handle SKB with radiotap only"), buffers whose length is too short cause a WARN_ON(1) to be executed. This change exposed a fault in rtlwifi drivers, which is fixed by regarding packets with skb->len <= FCS_LEN as though they are in error and dropping them. The test is now annotated as likely. Cc: Stable # v5.0+ Signed-off-by: Larry Finger Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/realtek/rtlwifi/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/wireless/realtek/rtlwifi/pci.c +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c @@ -822,7 +822,7 @@ static void _rtl_pci_rx_interrupt(struct hdr = rtl_get_hdr(skb); fc = rtl_get_fc(skb); - if (!stats.crc && !stats.hwerror) { + if (!stats.crc && !stats.hwerror && (skb->len > FCS_LEN)) { memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); @@ -859,6 +859,7 @@ static void _rtl_pci_rx_interrupt(struct _rtl_pci_rx_to_mac80211(hw, skb, rx_status); } } else { + /* drop packets with errors or those too short */ dev_kfree_skb_any(skb); } new_trx_end: