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

Paolo Abeni
2023-12-12T09:50:05Z

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)

Cheers,

Paolo