Browse Source

aerofc: forbid gpio changes

We export an "empty" table, but there's no protection when doing
ioctl().
sbg
Lucas De Marchi 9 years ago committed by Lorenz Meier
parent
commit
66628a4cf1
  1. 12
      src/drivers/px4fmu/fmu.cpp

12
src/drivers/px4fmu/fmu.cpp

@ -2560,7 +2560,11 @@ PX4FMU::gpio_ioctl(struct file *filp, int cmd, unsigned long arg) @@ -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) @@ -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:

Loading…
Cancel
Save