RE: [PATCH net-next v14 02/13] rtase: Implement the .ndo_open function

JustinLai0215
2023-12-14T12:44:38Z

> -----Original Message-----
> From: Paolo Abeni <pabeni@redhat.com>
> Sent: Tuesday, December 12, 2023 5:50 PM
> To: JustinLai0215 <justinlai0215@realtek.com>; kuba@kernel.org
> Cc: davem@davemloft.net; edumazet@google.com;
> linux-kernel@vger.kernel.org; netdev@vger.kernel.org; andrew@lunn.ch;
> Ping-Ke Shih <pkshih@realtek.com>; Larry Chiu <larry.chiu@realtek.com>
> Subject: Re: [PATCH net-next v14 02/13] rtase: Implement the .ndo_open
> function
>
>
> External mail.
>
>
>
> On Fri, 2023-12-08 at 17:47 +0800, Justin Lai wrote:
> > +static int rtase_open(struct net_device *dev) {
> > + struct rtase_private *tp = netdev_priv(dev);
> > + struct rtase_int_vector *ivec = &tp->int_vector[0];
> > + const struct pci_dev *pdev = tp->pdev;
> > + int ret;
> > + u16 i;
> > +
> > + rtase_set_rxbufsize(tp);
> > +
> > + ret = rtase_alloc_desc(tp);
> > + if (ret)
> > + goto err_free_all_allocated_mem;
> > +
> > + ret = rtase_init_ring(dev);
> > + if (ret)
> > + goto err_free_all_allocated_mem;
> > +
> > + rtase_hw_config(dev);
> > +
> > + if (tp->sw_flag & SWF_MSIX_ENABLED) {
> > + ret = request_irq(ivec->irq, rtase_interrupt, 0,
> > + dev->name, ivec);
> > +
> > + /* request other interrupts to handle multiqueue */
> > + for (i = 1; i < tp->int_nums; i++) {
> > + if (ret)
> > + continue;
> > +
> > + ivec = &tp->int_vector[i];
> > + if (ivec->status != 1)
> > + continue;
> > +
> > + snprintf(ivec->name, sizeof(ivec->name),
> "%s_int%i", tp->dev->name, i);
> > + ret = request_irq(ivec->irq, rtase_q_interrupt, 0,
> > + ivec->name, ivec);
>
> It looks like that if the above request_irq fails you will never free
> tp->int_vector[0].irq (and all tp->int_vector[j].irq, for j < i)
>
Thanks for the reminder, I will fix it.
>
> Cheers,
>
> Paolo