Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3558219pxb; Mon, 24 Jan 2022 12:11:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwbSZggfFmjEnv6WgrCaFDycmecdJnHMBjHPDkvVdttuWIRET1UTH7Zg9bzeCEX2kFLyJw X-Received: by 2002:a17:903:1207:b0:14a:83bd:394d with SMTP id l7-20020a170903120700b0014a83bd394dmr15380935plh.102.1643055066521; Mon, 24 Jan 2022 12:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055066; cv=none; d=google.com; s=arc-20160816; b=nN1lzEwxSEJItWiAjpn0F79vQ/NNhAaCCrbW7Zj/xhcvVx83lJhdxb/82LMabdFB+1 3+pnbU6qzMo7slE0ni45sqTzjvFrr5JY0pSkoFYk/q5bxbCH2QaI1viXyUzHmAEkqk2W VqzyKEvMXsCW9RyB6kziGfID8VcuzHv0Y3TZB69YYQTr81I3fGcxpI1AwiagEBp7erQe dA+VHTq+bVff7MxkhY0UVx2kRAQ7ULgtt5A73G3GY8AL5R+5et//nPf8XNdad8p6ChiP uVAaq8PLBaDoZvbPQ5iAae7n4I9I3Xa4yED8Up+HmRXj5AR8V9q4iUPchB/XIz+jccpb Wvpw== 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=z1wLVlHzqBXPKarPvas0QdsVQX1jS3QmJunGLE2xTSY=; b=PTH8kTDXNN52/Kv5Y8eBXQ5U0zc/jcYRVOr0VS2AZQ527mLf6XBhZ8HlA0MipICNn8 fzjal8bLbsEzsu6Q9hTBvOiPbTBV72otyN2gEIx2pZ8ZQtOAVRkFqkEgyoaV9f+gV1JG BgTlgP7az6i3YPQRToRjOv0vveAX+Apf0SRGparF8SAcLXuxYAWXW1FmWUcgezWG1SxU pjMzrd59+Hmm4mdA5EgDecbyiksKGM6jx1oCVOc9Z8bYmha3AaalbjbihR2ZJjmddVfF Q1DCpt7tCytzgW6rx1AcXthaJZYYEKPhp/4ZKew4TpekRa0JrpkH7Yn1dGfQNV3X8pEh f1Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XX3C2T7X; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lp8si307511pjb.152.2022.01.24.12.10.54; Mon, 24 Jan 2022 12:11:06 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=XX3C2T7X; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234834AbiAXTNl (ORCPT + 99 others); Mon, 24 Jan 2022 14:13:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346206AbiAXTFN (ORCPT ); Mon, 24 Jan 2022 14:05:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53251C06176D; Mon, 24 Jan 2022 11:00:00 -0800 (PST) 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 1BAB2B8119D; Mon, 24 Jan 2022 18:59:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C9E8C340E5; Mon, 24 Jan 2022 18:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050797; bh=ytqGsn8MmYRAVpbzLdd12cjfjLBCERwhbxRlqhLvZ30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XX3C2T7XakFqsaq1EPmfggB3fyQtqbJUCGOMfzccuIDnU3f6S2FjixYLj2O1vhYlE 6/ZeFuAyLGuLrUpvSH9N/q+9J0eiskDGKZQvb0gdONs6KNIcJb95v2ZMpEMH0H5dkM J0gcln9gk9qEI9lihg6TG5DVnFliujEc7cDCU8E4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brendan Dolan-Gavitt , Zekun Shen , Kalle Valo , Sasha Levin Subject: [PATCH 4.9 082/157] mwifiex: Fix skb_over_panic in mwifiex_usb_recv() Date: Mon, 24 Jan 2022 19:42:52 +0100 Message-Id: <20220124183935.385431507@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183932.787526760@linuxfoundation.org> References: <20220124183932.787526760@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zekun Shen [ Upstream commit 04d80663f67ccef893061b49ec8a42ff7045ae84 ] Currently, with an unknown recv_type, mwifiex_usb_recv just return -1 without restoring the skb. Next time mwifiex_usb_rx_complete is invoked with the same skb, calling skb_put causes skb_over_panic. The bug is triggerable with a compromised/malfunctioning usb device. After applying the patch, skb_over_panic no longer shows up with the same input. Attached is the panic report from fuzzing. skbuff: skb_over_panic: text:000000003bf1b5fa len:2048 put:4 head:00000000dd6a115b data:000000000a9445d8 tail:0x844 end:0x840 dev: kernel BUG at net/core/skbuff.c:109! invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 0 PID: 198 Comm: in:imklog Not tainted 5.6.0 #60 RIP: 0010:skb_panic+0x15f/0x161 Call Trace: ? mwifiex_usb_rx_complete+0x26b/0xfcd [mwifiex_usb] skb_put.cold+0x24/0x24 mwifiex_usb_rx_complete+0x26b/0xfcd [mwifiex_usb] __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __hrtimer_run_queues+0x316/0x740 ? __usb_hcd_giveback_urb+0x380/0x380 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 irq_exit+0x114/0x140 smp_apic_timer_interrupt+0xde/0x380 apic_timer_interrupt+0xf/0x20 Reported-by: Brendan Dolan-Gavitt Signed-off-by: Zekun Shen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YX4CqjfRcTa6bVL+@Zekuns-MBP-16.fios-router.home Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/mwifiex/usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index 2c4225e57c396..3a26add665ca0 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -132,7 +132,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, default: mwifiex_dbg(adapter, ERROR, "unknown recv_type %#x\n", recv_type); - return -1; + ret = -1; + goto exit_restore_skb; } break; case MWIFIEX_USB_EP_DATA: -- 2.34.1