mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-14 04:26:45 +00:00
serdev: fix receive_buf return value when no callback
[ Upstream commit fd00cf81a9
]
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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
371cf4043b
commit
2ba11e4309
1 changed files with 1 additions and 1 deletions
|
@ -184,7 +184,7 @@ static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl,
|
|||
struct serdev_device *serdev = ctrl->serdev;
|
||||
|
||||
if (!serdev || !serdev->ops->receive_buf)
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
|
||||
return serdev->ops->receive_buf(serdev, data, count);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue