From 12e5371a05a279ffde9618af205d3c9e0dd5477f Mon Sep 17 00:00:00 2001 From: jihandong Date: Sat, 25 Jun 2022 17:12:39 +0800 Subject: [PATCH] uorb: fix, should check min_interval modified by lowerhalf. Signed-off-by: jihandong --- drivers/sensors/sensor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c index 4d61eb2c9b..99544231bf 100644 --- a/drivers/sensors/sensor.c +++ b/drivers/sensors/sensor.c @@ -250,11 +250,16 @@ static int sensor_update_interval(FAR struct file *filep, if (min_interval != ULONG_MAX && min_interval != upper->state.min_interval) { + unsigned long expected_interval = min_interval; ret = lower->ops->set_interval(lower, filep, &min_interval); if (ret < 0) { return ret; } + else if (min_interval > expected_interval) + { + return -EINVAL; + } } if (min_latency == ULONG_MAX)