[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1762481052.9107397-1-xuanzhuo@linux.alibaba.com>
Date: Fri, 7 Nov 2025 10:04:12 +0800
From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Wen Gu <guwen@...ux.alibaba.com>,
Philo Lu <lulie@...ux.alibaba.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Lukas Bulwahn <lukas.bulwahn@...hat.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Vivian Wang <wangruikang@...as.ac.cn>,
Troy Mitchell <troy.mitchell@...ux.spacemit.com>,
Dust Li <dust.li@...ux.alibaba.com>
Subject: Re: [PATCH net-next v10 3/5] eea: probe the netdevice and create adminq
On Thu, 6 Nov 2025 18:01:11 -0800, Jakub Kicinski <kuba@...nel.org> wrote:
> On Wed, 5 Nov 2025 09:34:17 +0800 Xuan Zhuo wrote:
> > + if (rep->has_reply) {
> > + rep->reply_str[EEA_HINFO_MAX_REP_LEN - 1] = '\0';
> > + dev_warn(dev, "Device replied in host_info config: %s",
>
> nit: missing \n ?
>
> > + rep->reply_str);
> > + }
> > + }
> > +
> > + kfree(rep);
> > +err_free_cfg:
> > + kfree(cfg);
> > + return rc;
> > +}
>
> > +static int eea_netdev_init_features(struct net_device *netdev,
> > + struct eea_net *enet,
> > + struct eea_device *edev)
> > +{
> > + struct eea_aq_cfg *cfg __free(kfree) = NULL;
> > + int err;
> > + u32 mtu;
> > +
> > + cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
> > + if (!cfg)
> > + return -ENOMEM;
> > +
> > + err = eea_adminq_query_cfg(enet, cfg);
> > + if (err)
> > + return err;
>
> AFAICT this is leaking cfg
cfg is freed by __free(kfree).
>
> > + mtu = le16_to_cpu(cfg->mtu);
> > + if (mtu < ETH_MIN_MTU) {
> > + dev_err(edev->dma_dev, "The device gave us an invalid MTU. Here we can only exit the initialization. %d < %d",
> > + mtu, ETH_MIN_MTU);
> > + return -EINVAL;
>
> and here? perhaps cfg is always leaked..
>
> > +void eea_net_remove(struct eea_device *edev)
> > +{
> > + struct net_device *netdev;
> > + struct eea_net *enet;
> > +
> > + enet = edev->enet;
> > + netdev = enet->netdev;
> > +
> > + unregister_netdev(netdev);
> > + netdev_dbg(enet->netdev, "eea removed.\n");
> > +
> > + eea_device_reset(edev);
> > +
> > + eea_destroy_adminq(enet);
>
> missing free_netdev(), looks transient but each patch must be correct..
Thanks.
> --
> pw-bot: cr
Powered by blists - more mailing lists