Browse Source

TT#91151 add additional check for kernel module commands

Change-Id: I27f9ca4f03cd979ecbcf01e8fb1801a306f9d396
pull/1194/head
Richard Fuchs 5 years ago
parent
commit
abb281daac
3 changed files with 12 additions and 4 deletions
  1. +2
    -1
      daemon/kernel.c
  2. +3
    -1
      kernel-module/xt_RTPENGINE.c
  3. +7
    -2
      kernel-module/xt_RTPENGINE.h

+ 2
- 1
daemon/kernel.c View File

@ -76,7 +76,8 @@ static int kernel_open_table(unsigned int id) {
ZERO(msg);
msg.cmd = REMG_NOOP;
msg.u.size = sizeof(msg);
msg.u.noop.size = sizeof(msg);
msg.u.noop.last_cmd = __REMG_LAST;
i = write(fd, &msg, sizeof(msg));
if (i <= 0)
goto fail;


+ 3
- 1
kernel-module/xt_RTPENGINE.c View File

@ -3293,8 +3293,10 @@ static inline ssize_t proc_control_read_write(struct file *file, char __user *ub
switch (msg->cmd) {
case REMG_NOOP:
if (msg->u.size != sizeof(*msg))
if (msg->u.noop.size != sizeof(*msg))
err = -EMSGSIZE;
if (msg->u.noop.last_cmd != __REMG_LAST)
err = -ERANGE;
break;
case REMG_ADD:


+ 7
- 2
kernel-module/xt_RTPENGINE.h View File

@ -146,9 +146,14 @@ struct rtpengine_stats_info {
struct rtpengine_ssrc_stats ssrc_stats; // output
};
struct rtpengine_noop_info {
size_t size;
int last_cmd;
};
struct rtpengine_message {
enum {
/* size: */
/* noop_info: */
REMG_NOOP = 1,
/* target_info: */
@ -175,7 +180,7 @@ struct rtpengine_message {
} cmd;
union {
size_t size;
struct rtpengine_noop_info noop;
struct rtpengine_target_info target;
struct rtpengine_call_info call;
struct rtpengine_stream_info stream;


Loading…
Cancel
Save