Re: [PATCH] gpio: chardev: Return error for seek operations

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

 



On Wed, Nov 30, 2016 at 1:05 PM, Lars-Peter Clausen <lars@xxxxxxxxxx> wrote:

> The GPIO chardev is used for management tasks (allocating line and event
> handles) and does neither support read() nor write() operations. Hence it
> does not make much sense to allow seek operations.
>
> Currently the chardev uses noop_llseek() for its seek implementation. This
> function does not move the pointer and simply returns the current position
> (always 0 for the GPIO chardev). noop_llseek() is primarily meant for
> devices that can not support seek, but where there might be a user that
> depends on the seek() operation succeeding. For newly added devices that
> can not support seek operations it is recommended to use no_llseek(), which
> will return an error. For more information see commit 6038f373a3dc
> ("llseek: automatically add .llseek fop").
>
> Unfortunately this was overlooked when the GPIO chardev ABI was introduced.
> But it is highly unlikely that since then userspace applications have
> appeared that rely on being able to perform non-failing seek operations on
> a GPIO chardev file descriptor. So it should be safe to change from
> noop_llseel() to no_seek(). Also use nonseekable_open() in the chardev
> open() callback to clear the FMODE_SEEK, FMODE_PREAD and FMODE_PWRITE flags
> from the file. Neither of these should be set on a file that does not
> support seek operations.
>
> Fixes: 3c702e9987e2 ("gpio: add a userspace chardev ABI for GPIOs")
> Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>
> ---
> Ideally this gets added to stable as well to get a consistent ABI
> throughout.

Thanks Lars-Peter, I applied this and tagged it for stable.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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