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 CE5B08801; Tue, 30 Apr 2024 11:13:33 +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=1714475613; cv=none; b=QvLbKGDbRYOwPrbAp19OGZ6b/r5P4WSNnPrEzBqLOZgsDWjuTaUyerR83cAP2tgNkzdXU0ROxjnEUX9RFY/okEJpaQTfQ1ZmSA5IlOBxjVII3Z67fMBGV/9Am9NHgyo7aVCk3d6HjH9uaRrkM2P3LlvfsjA3IIcy1BxAonitCIY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714475613; c=relaxed/simple; bh=HtHoI4wk2odBLjt4W4+LmPtAn2/3GJmEMF8N+GxIWCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XEvgeU6VMyEas+TRavQkJ+3K3XGkmwgpTpeJQbhKTz/j/GkrrMssN/2IBlWfTgraT86yGOgOBDSuNcjTwJy36bbqcMrd3BhO59+gwwKtg7uk9J//0WOVcOIaQQ6SPzb/E4+TxgJ+x6XIeGSNua9XDgHgwNFpBubg9hUgcPZ4/uY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=j/4F6/7P; 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="j/4F6/7P" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FF07C2BBFC; Tue, 30 Apr 2024 11:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714475613; bh=HtHoI4wk2odBLjt4W4+LmPtAn2/3GJmEMF8N+GxIWCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/4F6/7P5qtcMpxIZLtz8pxTGcn9Ud0K6Q7Sy1lgDtJVSUc7gY8X60nk0ipZxJSSi 9St3W8j30DMTcX5khkrBFVwJ2LeiNQ7YG5+tpUwPKN3veRiBxwi40VeD1uWjnD9St0 UQVLmljazglIhpl3PCcvWLfcfYOY97A2yRcteFr4= 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 6.6 149/186] net: b44: set pause params only when interface is up Date: Tue, 30 Apr 2024 12:40:01 +0200 Message-ID: <20240430103102.359430149@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430103058.010791820@linuxfoundation.org> References: <20240430103058.010791820@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 6.6-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 @@ -2009,12 +2009,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);