From: Johan Hovold Date: Fri, 3 Nov 2017 14:30:53 +0000 (+0100) Subject: serdev: fix receive_buf return value when no callback X-Git-Tag: v4.19~2038^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd00cf81a9a84776ba58e56bd042c726dcf75cf3;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/include/linux/serdev.h b/include/linux/serdev.h index e69402d..d609e6d 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, struct serdev_device *serdev = ctrl->serdev; if (!serdev || !serdev->ops->receive_buf) - return -EINVAL; + return 0; return serdev->ops->receive_buf(serdev, data, count); }