lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vc49M-bdRviytZojK8+vMWJPXA_7zmLx3EvyQNXh8veZA@mail.gmail.com>
Date:   Tue, 17 Aug 2021 20:31:30 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Utkarsh Verma <utkarshverma294@...il.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jirislaby@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Valmer Huhn <valmer.huhn@...current-rt.com>,
        "open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-kernel-mentees@...ts.linuxfoundation.org,
        Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH] serial: 8250_exar: Add missing call to pci_free_irq_vectors()

On Tue, Aug 17, 2021 at 8:05 PM Utkarsh Verma <utkarshverma294@...il.com> wrote:
>
> Free the pci irq vectors if the call to pci_alloc_irq_vectors() fails
> or if the device is removed.

+Cc: Bjorn

This patch adds no value for all the code. This needs simply better
semantics on allocations (because freeing is happening here
implicitly).
Bjorn, this is an exact example why we need pcim_alloc_irq_vectors().

> Signed-off-by: Utkarsh Verma <utkarshverma294@...il.com>
> ---
>  drivers/tty/serial/8250/8250_exar.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
> index 3ffeedc29c83..38b65d6980f5 100644
> --- a/drivers/tty/serial/8250/8250_exar.c
> +++ b/drivers/tty/serial/8250/8250_exar.c
> @@ -627,8 +627,10 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
>         pci_set_master(pcidev);
>
>         rc = pci_alloc_irq_vectors(pcidev, 1, 1, PCI_IRQ_ALL_TYPES);
> -       if (rc < 0)
> +       if (rc < 0) {
> +               pci_free_irq_vectors(pcidev);
>                 return rc;
> +       }
>
>         memset(&uart, 0, sizeof(uart));
>         uart.port.flags = UPF_SHARE_IRQ | UPF_EXAR_EFR | UPF_FIXED_TYPE | UPF_FIXED_PORT;
> @@ -677,6 +679,7 @@ static void exar_pci_remove(struct pci_dev *pcidev)
>
>         if (priv->board->exit)
>                 priv->board->exit(pcidev);
> +       pci_free_irq_vectors(pcidev);
>  }


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ