aerofc: forbid gpio changes

We export an "empty" table, but there's no protection when doing
ioctl().
This commit is contained in:
Lucas De Marchi
2016-09-21 14:23:48 -03:00
committed by Lorenz Meier
parent fdb5a92873
commit 66628a4cf1
+12
View File
@@ -2560,7 +2560,11 @@ PX4FMU::gpio_ioctl(struct file *filp, int cmd, unsigned long arg)
case GPIO_SET_OUTPUT_HIGH:
case GPIO_SET_INPUT:
case GPIO_SET_ALT_1:
#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
ret = -EINVAL;
#else
gpio_set_function(arg, cmd);
#endif
break;
case GPIO_SET_ALT_2:
@@ -2571,11 +2575,19 @@ PX4FMU::gpio_ioctl(struct file *filp, int cmd, unsigned long arg)
case GPIO_SET:
case GPIO_CLEAR:
#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
ret = -EINVAL;
#else
gpio_write(arg, cmd);
#endif
break;
case GPIO_GET:
#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
ret = -EINVAL;
#else
*(uint32_t *)arg = gpio_read();
#endif
break;
default: