]> git.baikalelectronics.ru Git - kernel.git/commit
configfs: don't set buffer_needs_fill to zero if show() returns error
authorTal Shorer <tal.shorer@gmail.com>
Fri, 1 Jul 2016 09:28:57 +0000 (12:28 +0300)
committerChristoph Hellwig <hch@lst.de>
Sun, 10 Jul 2016 12:02:18 +0000 (21:02 +0900)
commit679069a1c393e0c05a025e6930f78370c9f8d974
tree2d9095867f2272e11ac0831e4d312811220d84d6
parent56a7287150d7c6cb9a93fa138dce8042c3db430f
configfs: don't set buffer_needs_fill to zero if show() returns error

A confgifs attribute's show() callback is called once the first time
the user attempts to read from it. If it returns an error, that
error is returned to the user. However, the open file's
buffer_needs_fill is still set to zero and consecutive read() calls
will find an empty buffer that doesn't need filling and return 0 to
the user. This could give the user the wrong impression that the
attribute was read successfully.

Fix this by not setting buffer_needs_fill if show() returns an error,
making consecutive read() calls call show() again and either get an
error again or get data.

Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/configfs/file.c