Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp463867yba; Wed, 15 May 2019 04:34:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6rb/FuZaasw46wi29sUtrjzHqoRn/+Em+V3HaTevwbcA0ESRJ/Q/HwIa9XxUedmH7ST13 X-Received: by 2002:a62:1c06:: with SMTP id c6mr35617440pfc.168.1557920051317; Wed, 15 May 2019 04:34:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557920051; cv=none; d=google.com; s=arc-20160816; b=B2aqIHmXwShneITEAsE9O5uzZjZtbQyg37WGPGUGx/yIsAa//OEgMp3ihC8xmPawAN Cli++6Z9+ykRAa9/+3zLauq++6cakw0oExEGfSw7jxsG1NCtB3oAjAJg/kAsvDytU3TM AGPNscBiZsSthgt+Yc/OjrSqWZk24C0sx1iIE4HDSnN2KDAjHTwzc5hXYtwOY+Cz4jjy tLtnEKGaLEvgeoomVPNm9eszeF+3Dr68/s4aVoHGhAVTas+CT0J2KknZfuvYCzxCD9hY mbKOs+BN7BkCqbVeBb1hLJ2i4NGLRsFXbGoIV0V/vHSTQKWBfvUEnSxRJkC15cXItVqH TCzw== 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=RiZWlMqIHbC+loTOL66x7S2VgWCx7csFQnH52TZCnKw=; b=SDeONOGgq5TztDv8D7oZgAnpLbrqYEw8G2BeV258Q/dFZbKivOrbcVjG8dkxBwag1Q QzYY5QbgqyeMQCn69678GFMZsqHaRBWV1zLt1+W4NoBudlFMAU4Af4QDOl129CvZaw/f n6sxe0tAXYTZRO1oTuRa/3uqYK637+A8gWwp97YjQhRXWvomDsuXbJmnKyoULOq2/EE/ 8h31DKXUMTqncO60I3eCfGt60zZtzQe2OnLuzOp+TqgXjF6s8HpEdWKMtAyYS1OwyDCR wd6eWyX2rosHkDxKM3dO81BwUEY7VTGFRxmPFZW7T9ZwJRVZD5DwZ0lMomXRc8nStDLt bh0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="mjsFxTd/"; 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 36si1655105pgx.477.2019.05.15.04.33.55; Wed, 15 May 2019 04:34:11 -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="mjsFxTd/"; 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 S1732463AbfEOLau (ORCPT + 99 others); Wed, 15 May 2019 07:30:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:42404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732779AbfEOLas (ORCPT ); Wed, 15 May 2019 07:30:48 -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 6B9132084A; Wed, 15 May 2019 11:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919846; bh=5FMtJThSLK+F+z4iXDndoqJkNHDhzMBT/XAonkQGkOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjsFxTd/TAYQCshSmccDtLiK9d3S3muTmEd+ARiYxvqzSgzXEQt/Q6oKXYqOowo29 cO0yINWGYUmMX90sfSvCGABzefWipZm4KfyguY2PbOvRzmXzS/eNFutgtcb+3gr9EE 23RrqQMyK3ALlx9boUJwoyIyljKuY+AOrD0/JJnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , "David S. Miller" Subject: [PATCH 5.0 114/137] net: ucc_geth - fix Oops when changing number of buffers in the ring Date: Wed, 15 May 2019 12:56:35 +0200 Message-Id: <20190515090701.892913844@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090651.633556783@linuxfoundation.org> References: <20190515090651.633556783@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: Christophe Leroy [ Upstream commit ee0df19305d9fabd9479b785918966f6e25b733b ] When changing the number of buffers in the RX ring while the interface is running, the following Oops is encountered due to the new number of buffers being taken into account immediately while their allocation is done when opening the device only. [ 69.882706] Unable to handle kernel paging request for data at address 0xf0000100 [ 69.890172] Faulting instruction address: 0xc033e164 [ 69.895122] Oops: Kernel access of bad area, sig: 11 [#1] [ 69.900494] BE PREEMPT CMPCPRO [ 69.907120] CPU: 0 PID: 0 Comm: swapper Not tainted 4.14.115-00006-g179ade8ce3-dirty #269 [ 69.915956] task: c0684310 task.stack: c06da000 [ 69.920470] NIP: c033e164 LR: c02e44d0 CTR: c02e41fc [ 69.925504] REGS: dfff1e20 TRAP: 0300 Not tainted (4.14.115-00006-g179ade8ce3-dirty) [ 69.934161] MSR: 00009032 CR: 22004428 XER: 20000000 [ 69.940869] DAR: f0000100 DSISR: 20000000 [ 69.940869] GPR00: c0352d70 dfff1ed0 c0684310 f00000a4 00000040 dfff1f68 00000000 0000001f [ 69.940869] GPR08: df53f410 1cc00040 00000021 c0781640 42004424 100c82b6 f00000a4 df53f5b0 [ 69.940869] GPR16: df53f6c0 c05daf84 00000040 00000000 00000040 c0782be4 00000000 00000001 [ 69.940869] GPR24: 00000000 df53f400 000001b0 df53f410 df53f000 0000003f df708220 1cc00044 [ 69.978348] NIP [c033e164] skb_put+0x0/0x5c [ 69.982528] LR [c02e44d0] ucc_geth_poll+0x2d4/0x3f8 [ 69.987384] Call Trace: [ 69.989830] [dfff1ed0] [c02e4554] ucc_geth_poll+0x358/0x3f8 (unreliable) [ 69.996522] [dfff1f20] [c0352d70] net_rx_action+0x248/0x30c [ 70.002099] [dfff1f80] [c04e93e4] __do_softirq+0xfc/0x310 [ 70.007492] [dfff1fe0] [c0021124] irq_exit+0xd0/0xd4 [ 70.012458] [dfff1ff0] [c000e7e0] call_do_irq+0x24/0x3c [ 70.017683] [c06dbe80] [c0006bac] do_IRQ+0x64/0xc4 [ 70.022474] [c06dbea0] [c001097c] ret_from_except+0x0/0x14 [ 70.027964] --- interrupt: 501 at rcu_idle_exit+0x84/0x90 [ 70.027964] LR = rcu_idle_exit+0x74/0x90 [ 70.037585] [c06dbf60] [20000000] 0x20000000 (unreliable) [ 70.042984] [c06dbf80] [c004bb0c] do_idle+0xb4/0x11c [ 70.047945] [c06dbfa0] [c004bd14] cpu_startup_entry+0x18/0x1c [ 70.053682] [c06dbfb0] [c05fb034] start_kernel+0x370/0x384 [ 70.059153] [c06dbff0] [00003438] 0x3438 [ 70.063062] Instruction dump: [ 70.066023] 38a00000 38800000 90010014 4bfff015 80010014 7c0803a6 3123ffff 7c691910 [ 70.073767] 38210010 4e800020 38600000 4e800020 <80e3005c> 80c30098 3107ffff 7d083910 [ 70.081690] ---[ end trace be7ccd9c1e1a9f12 ]--- This patch forbids the modification of the number of buffers in the ring while the interface is running. Fixes: ac421852b3a0 ("ucc_geth: add ethtool support") Signed-off-by: Christophe Leroy Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/freescale/ucc_geth_ethtool.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c +++ b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c @@ -252,14 +252,12 @@ uec_set_ringparam(struct net_device *net return -EINVAL; } + if (netif_running(netdev)) + return -EBUSY; + ug_info->bdRingLenRx[queue] = ring->rx_pending; ug_info->bdRingLenTx[queue] = ring->tx_pending; - if (netif_running(netdev)) { - /* FIXME: restart automatically */ - netdev_info(netdev, "Please re-open the interface\n"); - } - return ret; }