public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Peilin He <he.peilin@zte.com.cn>,
	Kun Jiang <jiang.kun2@zte.com.cn>, xu xin <xu.xin16@zte.com.cn>,
	netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Vladimir Oltean <olteanv@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Fan Yu <fan.yu9@zte.com.cn>,
	tu.qiang35@zte.com.cn, yang.yang29@zte.com.cn,
	Yaxin Wang <wang.yaxin@zte.com.cn>,
	ye xingchen <ye.xingchen@zte.com.cn>,
	Yunkai Zhang <zhang.yunkai@zte.com.cn>,
	Yutan Qiu <qiu.yutan@zte.com.cn>
Subject: Re: [PATCH linux next] net: dsa: fix the dsa_ptr null pointer dereference
Date: Fri, 20 Dec 2024 12:10:14 +0100	[thread overview]
Message-ID: <41e1f541-ef92-40ad-ab4d-263303479959@web.de> (raw)
In-Reply-To: <20241220140516563WDQ_X40bt0ZOch3Qte1YO@zte.com.cn>

…
> +++ b/net/dsa/dsa.c
> @@ -1561,6 +1561,17 @@ void dsa_unregister_switch(struct dsa_switch *ds)
>  }
>  EXPORT_SYMBOL_GPL(dsa_unregister_switch);
>
> +static void dsa_conduit_ethtool_shutdown(struct net_device *dev)
> +{
> +	struct dsa_port *cpu_dp = dev->dsa_ptr;

I suggest to assign this local variable only after the subsequent check.


> +
> +	if (netif_is_lag_master(dev))
> +		return;
> +
> +	dev->ethtool_ops = cpu_dp->orig_ethtool_ops;
> +	cpu_dp->orig_ethtool_ops = NULL;
> +}
…


Regards,
Markus

  reply	other threads:[~2024-12-20 11:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-20  6:05 [PATCH linux next] net:dsa:fix the dsa_ptr null pointer dereference jiang.kun2
2024-12-20 11:10 ` Markus Elfring [this message]
2024-12-20 11:27 ` Vladimir Oltean
2024-12-24  8:05   ` PeilinHe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41e1f541-ef92-40ad-ab4d-263303479959@web.de \
    --to=markus.elfring@web.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fan.yu9@zte.com.cn \
    --cc=he.peilin@zte.com.cn \
    --cc=jiang.kun2@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=qiu.yutan@zte.com.cn \
    --cc=tu.qiang35@zte.com.cn \
    --cc=wang.yaxin@zte.com.cn \
    --cc=xu.xin16@zte.com.cn \
    --cc=yang.yang29@zte.com.cn \
    --cc=ye.xingchen@zte.com.cn \
    --cc=zhang.yunkai@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox