ALSA: info: Return error for invalid read/write
commitc3ea1b15b71ec829759cfbce8338b72fe765fd94
authorTakashi Iwai <tiwai@suse.de>
Sun, 30 Oct 2016 21:13:19 +0000 (30 22:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Nov 2016 09:51:43 +0000 (18 10:51 +0100)
tree102332a8c623360777e907b0cbee7e66654b72d4
parent61385cc1db42b163c664429ab87d6399ea043c0d
ALSA: info: Return error for invalid read/write

commit 6809cd682b82dfff47943850d1a8c714f971b5ca upstream.

Currently the ALSA proc handler allows read or write even if the proc
file were write-only or read-only.  It's mostly harmless, does thing
but allocating memory and ignores the input/output.  But it doesn't
tell user about the invalid use, and it's confusing and inconsistent
in comparison with other proc files.

This patch adds some sanity checks and let the proc handler returning
an -EIO error when the invalid read/write is performed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/core/info.c