Re: [PATCH 3/4] nvme: pci: pass IRQF_RESCURE_THREAD to request_threaded_irq

Johannes Thumshirn
2019-08-27T09:06:25Z

On 27/08/2019 10:53, Ming Lei wrote:
[...]
> + char *devname;
> + const struct cpumask *mask;
> + unsigned long irqflags = IRQF_SHARED;
> + int vector = pci_irq_vector(pdev, nvmeq->cq_vector);
> +
> + devname = kasprintf(GFP_KERNEL, "nvme%dq%d", nr, nvmeq->qid);
> + if (!devname)
> + return -ENOMEM;
> +
> + mask = pci_irq_get_affinity(pdev, nvmeq->cq_vector);
> + if (mask && cpumask_weight(mask) > 1)
> + irqflags |= IRQF_RESCUE_THREAD;
> +
> + return request_threaded_irq(vector, nvme_irq, NULL, irqflags,
> + devname, nvmeq);

This will leak 'devname' which gets allocated by kasprintf() a few lines
above.

--
Johannes Thumshirn SUSE Labs Filesystems
jthumshirn@suse.de +49 911 74053 689
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5
90409 Nürnberg
Germany
(HRB 247165, AG München)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850