diff options
author | Johan Hovold <johan@kernel.org> | 2017-11-03 10:30:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-28 10:00:50 -0500 |
commit | fd00cf81a9a84776ba58e56bd042c726dcf75cf3 (patch) | |
tree | 446b6b8cc297eb266c1d4d50995be2acdd9b2b01 | |
parent | eb281683621b71ab9710d9dccbbef0c2e1769c97 (diff) |
serdev: fix receive_buf return value when no callback
The receive_buf callback is supposed to return the number of bytes
processed and should specifically not return a negative errno.
Due to missing sanity checks in the serdev tty-port controller, a driver
not providing a receive_buf callback could cause the flush_to_ldisc()
worker to spin in a tight loop when the tty buffer pointers are
incremented with -EINVAL (-22).
The missing sanity checks have now been added to the tty-port
controller, but let's fix up the serdev-controller helper as well.
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | include/linux/serdev.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/serdev.h b/include/linux/serdev.h index e69402d4a8ae..d609e6dc5bad 100644 --- a/include/linux/serdev.h +++ b/include/linux/serdev.h | |||
@@ -184,7 +184,7 @@ static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl, | |||
184 | struct serdev_device *serdev = ctrl->serdev; | 184 | struct serdev_device *serdev = ctrl->serdev; |
185 | 185 | ||
186 | if (!serdev || !serdev->ops->receive_buf) | 186 | if (!serdev || !serdev->ops->receive_buf) |
187 | return -EINVAL; | 187 | return 0; |
188 | 188 | ||
189 | return serdev->ops->receive_buf(serdev, data, count); | 189 | return serdev->ops->receive_buf(serdev, data, count); |
190 | } | 190 | } |