From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65F5712D1F1; Tue, 30 Apr 2024 11:05:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714475147; cv=none; b=QcUYm5mMhuK+YgOIdMaUu8DHlhIAP/lZ5TgUHA4wlFBku3l4A337haQzxpiGMSqHyNLt2Ei+Zy+cKkKv/0VufrBq9q4yNyM1K+MdCHB1YMVYoDKlFeUgIsmhqkFF2Xtw+gYHhwGD3YRVIk/Q5ahx/sjq4WJkKKtlQYQHdeSAdIM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714475147; c=relaxed/simple; bh=o+7uCw+vO+HmCwjCBEC8mi6/VYWHPSv1h7spfNFPk5c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lbELxIYEGajPu1XqvraqQ2qBYDriGqh2nesdWhg4lz/3A7nqT2bJ95X+/JJzQ5z4GslCT+VKzkjZ/XfnJokAri2fxXkC3ODOSWpT7fy3arXJNlqGHsvwpXrcQoEcBGkF7y423pYQfUUV6pCltTQaW8CToU4HXWGgtAM8tYNmxJU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f6D8cm5E; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="f6D8cm5E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 900B5C2BBFC; Tue, 30 Apr 2024 11:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714475145; bh=o+7uCw+vO+HmCwjCBEC8mi6/VYWHPSv1h7spfNFPk5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f6D8cm5E699SvV/PPkF0i2neAVqodsnJaVDSIWYv5XKI4/JHli9B3lTYpWqAMUXiv B+mskZwYjuR0GmmH+c5m+inNntWuG+ZP6tG4DzoeeFt4yZy08/DwL89o8sFgGvVMmg a95QeMQFt/QnFYncllv3SGji+PIanriYmpJxQALI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Peter=20M=C3=BCnster?= , Jonas Gorski , Vaclav Svoboda , Andrew Lunn , Michael Chan , Jakub Kicinski Subject: [PATCH 5.10 123/138] net: b44: set pause params only when interface is up Date: Tue, 30 Apr 2024 12:40:08 +0200 Message-ID: <20240430103053.024857412@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430103049.422035273@linuxfoundation.org> References: <20240430103049.422035273@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Münster commit e3eb7dd47bd4806f00e104eb6da092c435f9fb21 upstream. b44_free_rings() accesses b44::rx_buffers (and ::tx_buffers) unconditionally, but b44::rx_buffers is only valid when the device is up (they get allocated in b44_open(), and deallocated again in b44_close()), any other time these are just a NULL pointers. So if you try to change the pause params while the network interface is disabled/administratively down, everything explodes (which likely netifd tries to do). Link: https://github.com/openwrt/openwrt/issues/13789 Fixes: 1da177e4c3f4 (Linux-2.6.12-rc2) Cc: stable@vger.kernel.org Reported-by: Peter Münster Suggested-by: Jonas Gorski Signed-off-by: Vaclav Svoboda Tested-by: Peter Münster Reviewed-by: Andrew Lunn Signed-off-by: Peter Münster Reviewed-by: Michael Chan Link: https://lore.kernel.org/r/87y192oolj.fsf@a16n.net Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/b44.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c @@ -2027,12 +2027,14 @@ static int b44_set_pauseparam(struct net bp->flags |= B44_FLAG_TX_PAUSE; else bp->flags &= ~B44_FLAG_TX_PAUSE; - if (bp->flags & B44_FLAG_PAUSE_AUTO) { - b44_halt(bp); - b44_init_rings(bp); - b44_init_hw(bp, B44_FULL_RESET); - } else { - __b44_set_flow_ctrl(bp, bp->flags); + if (netif_running(dev)) { + if (bp->flags & B44_FLAG_PAUSE_AUTO) { + b44_halt(bp); + b44_init_rings(bp); + b44_init_hw(bp, B44_FULL_RESET); + } else { + __b44_set_flow_ctrl(bp, bp->flags); + } } spin_unlock_irq(&bp->lock);