drivers: Perform a runtime check if a driver is capable of an operation

Driver APIs might not implement all operations, making it possible for
a user thread to get the kernel to execute a function at 0x00000000.

Perform runtime checks in all the driver handlers, checking if they're
capable of performing the requested operation.

Fixes #6907.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This commit is contained in:
Leandro Pereira 2018-04-04 13:50:32 -07:00 committed by Anas Nashif
commit c200367b68
20 changed files with 224 additions and 119 deletions

View file

@ -135,35 +135,15 @@ struct k_mem_partition;
enum k_objects {
K_OBJ_ANY,
/* Core kernel objects */
K_OBJ_ALERT,
K_OBJ_MSGQ,
K_OBJ_MUTEX,
K_OBJ_PIPE,
K_OBJ_SEM,
K_OBJ_STACK,
K_OBJ_THREAD,
K_OBJ_TIMER,
K_OBJ__THREAD_STACK_ELEMENT,
/* Driver subsystems */
K_OBJ_DRIVER_ADC,
K_OBJ_DRIVER_AIO_CMP,
K_OBJ_DRIVER_COUNTER,
K_OBJ_DRIVER_CRYPTO,
K_OBJ_DRIVER_DMA,
K_OBJ_DRIVER_FLASH,
K_OBJ_DRIVER_GPIO,
K_OBJ_DRIVER_I2C,
K_OBJ_DRIVER_I2S,
K_OBJ_DRIVER_IPM,
K_OBJ_DRIVER_PINMUX,
K_OBJ_DRIVER_PWM,
K_OBJ_DRIVER_ENTROPY,
K_OBJ_DRIVER_RTC,
K_OBJ_DRIVER_SENSOR,
K_OBJ_DRIVER_SPI,
K_OBJ_DRIVER_UART,
/** @cond
* Doxygen should ignore this build-time generated include file
* when genrating API documentation. Enumeration values are
* generated during build by gen_kobject_list.py. It includes
* basic kernel objects (e.g. pipes and mutexes) and driver types.
*/
#include <kobj-types-enum.h>
/** @endcond
*/
K_OBJ_LAST
};