Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp630929pxb; Tue, 2 Feb 2021 13:46:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzCNapi9SRHi7HqhQVbIRchOh46eGObJ6p/11eP21dG5RSdgwNjEXXMdhxotYLSGZmrkyX X-Received: by 2002:a17:906:154d:: with SMTP id c13mr5556ejd.471.1612302369212; Tue, 02 Feb 2021 13:46:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612302369; cv=none; d=google.com; s=arc-20160816; b=ZYQsoL7cz6P/ebk9rKwq15QCjRGnkg3Mb+hewPANjbZjE1A07iRh2HYJ7NvTB2THz+ GH6Ezk3dzlyX3tzwAl1hodg7YozhpQ/T9JwibJwEI+6DySTuKO0OSxgK5g6HaRKKnQuu jluZYEyzfcEpRzKKQeMy7oNwOWIlDtcVoIDXMg4lHs3ewjZENXmz/6EreFFfbtwqEnMz fH18DsHlB2xunXhvVncqg00naAE9uUIHLXsMd4FTWrSbgewMt/Y66ycArBB70kZdio7Z cUNtGEZmLyYmiX/X/I0uqD88os/hgErzilFSioxYRZ2H9VXOEBArdrzOMH2wuE6lMwYD Affw== 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=/r9Yor0fQ0fZc+Q1JjhOFJowQZF+gJBsfY+zlB1qRlU=; b=hlTlLPb8M8cbg+mlUpeHUYcYNmBxAwcR6TdtWyVubsIDgKveNt5MxfhLUVGA/4a6jG 3Yshuf0qzqPoNZ7D6X3awa/2OPWo0Ikv7VO6xL3rHDzGFd2XN0Pr03z9RAiTprMCOdT2 ZuWTrF1Lo0jKzZ9ZuwCtpJiUkOVxeebQtVTWBrZHgQuzeACSxLjEaAhdX3yPFuyefgqf 2jxjldkNPWyfQzPI4FKUBHIljlbP4YHwpi86o/kvOJ0BykNwbXXkKSLWVA3e3rWlQUmt 80GCyj5suKpCHR315edf0JGTiva74PRYbxstHvVQwhKnkogWTxOXl+nkf//1hUx3ND4D Uxbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZNQpY6Y6; 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 j22si57542ejt.468.2021.02.02.13.45.44; Tue, 02 Feb 2021 13:46:09 -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=ZNQpY6Y6; 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 S232910AbhBBNw1 (ORCPT + 99 others); Tue, 2 Feb 2021 08:52:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:36408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232911AbhBBNrA (ORCPT ); Tue, 2 Feb 2021 08:47:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1076664F4A; Tue, 2 Feb 2021 13:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273293; bh=YKH0auUMBPIWywJvMCOnYI8QioRVdCmRwpt4jprkYSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZNQpY6Y6mlBXXVjLgJnhMf9rSbt2htv5GoI3qENwjRaohxMYs/U9r/uoQnGTlxbwd hXo2m9aDyidH5GIGMQ0NYS26Pqxw4ZP1hR1ultixmNNhFF9ZmGlIEVPRkd/H61+ABS 3pf/FCsTzizAEvxnCCajLiu5jyjT+fk5spMfK90o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Lorenzo Bianconi , Jakub Kicinski , Kalle Valo Subject: [PATCH 5.10 053/142] mt7601u: fix rx buffer refcounting Date: Tue, 2 Feb 2021 14:36:56 +0100 Message-Id: <20210202132959.909722510@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@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: Lorenzo Bianconi commit d24c790577ef01bfa01da2b131313a38c843a634 upstream. Fix the following crash due to erroneous page refcounting: [ 32.445919] BUG: Bad page state in process swapper/1 pfn:11f65a [ 32.447409] page:00000000938f0632 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x0 pfn:0x11f65a [ 32.449605] flags: 0x8000000000000000() [ 32.450421] raw: 8000000000000000 ffffffff825b0148 ffffea00045ae988 0000000000000000 [ 32.451795] raw: 0000000000000000 0000000000000001 00000000ffffff7f 0000000000000000 [ 32.452999] page dumped because: nonzero mapcount [ 32.453888] Modules linked in: [ 32.454492] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.11.0-rc2+ #1976 [ 32.455695] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-1.fc33 04/01/2014 [ 32.457157] Call Trace: [ 32.457636] [ 32.457993] dump_stack+0x77/0x97 [ 32.458576] bad_page.cold+0x65/0x96 [ 32.459198] get_page_from_freelist+0x46a/0x11f0 [ 32.460008] __alloc_pages_nodemask+0x10a/0x2b0 [ 32.460794] mt7601u_rx_tasklet+0x651/0x720 [ 32.461505] tasklet_action_common.constprop.0+0x6b/0xd0 [ 32.462343] __do_softirq+0x152/0x46c [ 32.462928] asm_call_irq_on_stack+0x12/0x20 [ 32.463610] [ 32.463953] do_softirq_own_stack+0x5b/0x70 [ 32.464582] irq_exit_rcu+0x9f/0xe0 [ 32.465028] common_interrupt+0xae/0x1a0 [ 32.465536] asm_common_interrupt+0x1e/0x40 [ 32.466071] RIP: 0010:default_idle+0x18/0x20 [ 32.468981] RSP: 0018:ffffc90000077f00 EFLAGS: 00000246 [ 32.469648] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000 [ 32.470550] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81aac3dd [ 32.471463] RBP: ffff88810022ab00 R08: 0000000000000001 R09: 0000000000000001 [ 32.472335] R10: 0000000000000046 R11: 0000000000005aa0 R12: 0000000000000000 [ 32.473235] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [ 32.474139] ? default_idle_call+0x4d/0x200 [ 32.474681] default_idle_call+0x74/0x200 [ 32.475192] do_idle+0x1d5/0x250 [ 32.475612] cpu_startup_entry+0x19/0x20 [ 32.476114] secondary_startup_64_no_verify+0xb0/0xbb [ 32.476765] Disabling lock debugging due to kernel taint Fixes: c869f77d6abb ("add mt7601u driver") Co-developed-by: Felix Fietkau Signed-off-by: Felix Fietkau Signed-off-by: Lorenzo Bianconi Acked-by: Jakub Kicinski Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/62b2380c8c2091834cfad05e1059b55f945bd114.1610643952.git.lorenzo@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/mediatek/mt7601u/dma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/net/wireless/mediatek/mt7601u/dma.c +++ b/drivers/net/wireless/mediatek/mt7601u/dma.c @@ -152,8 +152,7 @@ mt7601u_rx_process_entry(struct mt7601u_ if (new_p) { /* we have one extra ref from the allocator */ - __free_pages(e->p, MT_RX_ORDER); - + put_page(e->p); e->p = new_p; } }