Re: [PATCH v2] staging: pi433: fix race condition in pi433_open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 19, 2018 at 10:33:26PM -0400, Hugo Lefeuvre wrote:
> @@ -1178,6 +1152,11 @@ static int pi433_probe(struct spi_device *spi)
>  	device->tx_active = false;
>  	device->interrupt_rx_allowed = false;
>  
> +	/* init rx buffer */
> +	device->rx_buffer = kmalloc(MAX_MSG_SIZE, GFP_KERNEL);
> +	if (!device->rx_buffer)
> +		return -ENOMEM;

We need to free device.

> +
>  	/* init wait queues */
>  	init_waitqueue_head(&device->tx_wait_queue);
>  	init_waitqueue_head(&device->rx_wait_queue);
> @@ -1280,6 +1259,7 @@ static int pi433_probe(struct spi_device *spi)
>  minor_failed:
>  	free_gpio(device);
>  GPIO_failed:
> +	kfree(device->rx_buffer);
>  	kfree(device);
>  
>  	return retval;

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux