summaryrefslogtreecommitdiff
path: root/drivers/connector/cn_proc.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2013-02-25 21:32:25 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-14 18:26:22 (GMT)
commit5836682c53c66176c7c4fe2be178c9b436e2daca (patch)
tree94513a66a4d8d097db8c54f467bffc5ad1daf917 /drivers/connector/cn_proc.c
parenta9382b7791f46b85a17841e5970ac3da7f5a9ca5 (diff)
downloadlinux-fsl-qoriq-5836682c53c66176c7c4fe2be178c9b436e2daca.tar.xz
proc connector: reject unprivileged listener bumps
commit e70ab977991964a5a7ad1182799451d067e62669 upstream. 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: Kees Cook <keescook@chromium.org> Cc: Evgeniy Polyakov <zbr@ioremap.net> Cc: Matt Helsley <matthltc@us.ibm.com> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Acked-by: Matt Helsley <matthltc@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/connector/cn_proc.c')
-rw-r--r--drivers/connector/cn_proc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index fce2000..1110478 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -313,6 +313,12 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
(task_active_pid_ns(current) != &init_pid_ns))
return;
+ /* Can only change if privileged. */
+ if (!capable(CAP_NET_ADMIN)) {
+ err = EPERM;
+ goto out;
+ }
+
mc_op = (enum proc_cn_mcast_op *)msg->data;
switch (*mc_op) {
case PROC_CN_MCAST_LISTEN:
@@ -325,6 +331,8 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
err = EINVAL;
break;
}
+
+out:
cn_proc_ack(err, msg->seq, msg->ack);
}