Commit e70ab977 authored by Kees Cook's avatar Kees Cook Committed by David S. Miller

proc connector: reject unprivileged listener bumps

While PROC_CN_MCAST_LISTEN/IGNORE is entirely advisory, it was possible
for an unprivileged user to turn off notifications for all listeners by
sending PROC_CN_MCAST_IGNORE. Instead, require the same privileges as
required for a multicast bind.
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Cc: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: stable@vger.kernel.org
Acked-by: default avatarEvgeniy Polyakov <zbr@ioremap.net>
Acked-by: default avatarMatt Helsley <matthltc@us.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 114a6f8b
...@@ -313,6 +313,12 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, ...@@ -313,6 +313,12 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
(task_active_pid_ns(current) != &init_pid_ns)) (task_active_pid_ns(current) != &init_pid_ns))
return; return;
/* Can only change if privileged. */
if (!capable(CAP_NET_ADMIN)) {
err = EPERM;
goto out;
}
mc_op = (enum proc_cn_mcast_op *)msg->data; mc_op = (enum proc_cn_mcast_op *)msg->data;
switch (*mc_op) { switch (*mc_op) {
case PROC_CN_MCAST_LISTEN: case PROC_CN_MCAST_LISTEN:
...@@ -325,6 +331,8 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, ...@@ -325,6 +331,8 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
err = EINVAL; err = EINVAL;
break; break;
} }
out:
cn_proc_ack(err, msg->seq, msg->ack); cn_proc_ack(err, msg->seq, msg->ack);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment