[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <34a6dc2e.8f73.197ce7659b8.Coremail.linma@zju.edu.cn>
Date: Thu, 3 Jul 2025 12:05:52 +0800 (GMT+08:00)
From: "Lin Ma" <linma@....edu.cn>
To: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, horms@...nel.org, mingo@...nel.org,
tglx@...utronix.de, pwn9uin@...il.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net v2] net: atm: Fix incorrect net_device lec check
Hi there,
Sorry again for the careless mistakes... the `lec_netdev_ops` is a static ops variable defined
elsewhere, hence the patch cannot compile correctly.
Preparing the v3 patch.
Regards
Lin
> V1 -> V2: add null check suggested by Eric Dumazet <edumazet@...gle.com>,
> otherwise will crash
>
> net/atm/mpc.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/atm/mpc.c b/net/atm/mpc.c
> index f6b447bba329..af409d6fa2dd 100644
> --- a/net/atm/mpc.c
> +++ b/net/atm/mpc.c
> @@ -275,6 +275,9 @@ static struct net_device *find_lec_by_itfnum(int itf)
> sprintf(name, "lec%d", itf);
> dev = dev_get_by_name(&init_net, name);
>
> + if (!dev || dev->netdev_ops != lec_netdev_ops)
> + return NULL;
> +
> return dev;
> }
>
> @@ -1006,7 +1009,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier,
> if (!net_eq(dev_net(dev), &init_net))
> return NOTIFY_DONE;
>
> - if (strncmp(dev->name, "lec", 3))
> + if (dev->netdev_ops != lec_netdev_ops)
> return NOTIFY_DONE; /* we are only interested in lec:s */
>
> switch (event) {
> --
> 2.17.1
Powered by blists - more mailing lists