Re: [PATCH v4 12/13] gpiolib: add new ioctl() for monitoring changes in line info

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

 



On Tue, Dec 24, 2019 at 01:07:08PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
> 

[snip!]

> +static int lineinfo_changed_notify(struct notifier_block *nb,
> +				   unsigned long action, void *data)
> +{
> +	struct gpio_chardev_data *priv = to_gpio_chardev_data(nb);
> +	struct gpioline_info_changed chg;
> +	struct gpio_desc *desc = data;
> +	int ret;
> +
> +	if (!test_bit(desc_to_gpio(desc), priv->watched_lines))
> +		return NOTIFY_DONE;
> +
> +	memset(&chg, 0, sizeof(chg));
> +	chg.info.line_offset = gpio_chip_hwgpio(desc);
> +	chg.event_type = action;
> +	chg.timestamp = ktime_get_real_ns();
> +	gpio_desc_to_lineinfo(desc, &chg.info);
> +

Is this call legal?  It can sleep - in fact you recently changed that
very function to move a mutex call outside of a spinlock protected section.
Here it is being called within an RCU lock, as lineinfo_changed_notify
is at the end of an atomic_notifier_call_chain.

I was looking at adding a chg.seqno here and considering what level of
locking would be appropriate for the source counter when I noticed that
call. Hopefully I'm missing something.

Cheers,
Kent.




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux