diff options
| author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-08-17 10:57:56 +0400 | 
|---|---|---|
| committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-08-17 11:01:08 +0400 | 
| commit | a22ddff8bedfe33eeb1330bbb7ef1fbe007a42c4 (patch) | |
| tree | 61a2eb7fa62f5af10c2b913ca429e6b068b0eb2d /security/selinux/netlink.c | |
| parent | 20d5a540e55a29daeef12706f9ee73baf5641c16 (diff) | |
| parent | d9875690d9b89a866022ff49e3fcea892345ad92 (diff) | |
| download | linux-a22ddff8bedfe33eeb1330bbb7ef1fbe007a42c4.tar.xz | |
Merge tag 'v3.6-rc2' into drm-intel-next
Backmerge Linux 3.6-rc2 to resolve a few funny conflicts before we put
even more madness on top:
- drivers/gpu/drm/i915/i915_irq.c: Just a spurious WARN removed in
  -fixes, that has been changed in a variable-rename in -next, too.
- drivers/gpu/drm/i915/intel_ringbuffer.c: -next remove scratch_addr
  (since all their users have been extracted in another fucntion),
  -fixes added another user for a hw workaroudn.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'security/selinux/netlink.c')
| -rw-r--r-- | security/selinux/netlink.c | 17 | 
1 files changed, 12 insertions, 5 deletions
diff --git a/security/selinux/netlink.c b/security/selinux/netlink.c index 161e01a6c7ef..8a77725423e0 100644 --- a/security/selinux/netlink.c +++ b/security/selinux/netlink.c @@ -19,6 +19,7 @@  #include <linux/netlink.h>  #include <linux/selinux_netlink.h>  #include <net/net_namespace.h> +#include <net/netlink.h>  #include "security.h" @@ -47,7 +48,7 @@ static void selnl_add_payload(struct nlmsghdr *nlh, int len, int msgtype, void *  {  	switch (msgtype) {  	case SELNL_MSG_SETENFORCE: { -		struct selnl_msg_setenforce *msg = NLMSG_DATA(nlh); +		struct selnl_msg_setenforce *msg = nlmsg_data(nlh);  		memset(msg, 0, len);  		msg->val = *((int *)data); @@ -55,7 +56,7 @@ static void selnl_add_payload(struct nlmsghdr *nlh, int len, int msgtype, void *  	}  	case SELNL_MSG_POLICYLOAD: { -		struct selnl_msg_policyload *msg = NLMSG_DATA(nlh); +		struct selnl_msg_policyload *msg = nlmsg_data(nlh);  		memset(msg, 0, len);  		msg->seqno = *((u32 *)data); @@ -81,7 +82,9 @@ static void selnl_notify(int msgtype, void *data)  		goto oom;  	tmp = skb->tail; -	nlh = NLMSG_PUT(skb, 0, 0, msgtype, len); +	nlh = nlmsg_put(skb, 0, 0, msgtype, len, 0); +	if (!nlh) +		goto out_kfree_skb;  	selnl_add_payload(nlh, len, msgtype, data);  	nlh->nlmsg_len = skb->tail - tmp;  	NETLINK_CB(skb).dst_group = SELNLGRP_AVC; @@ -89,7 +92,7 @@ static void selnl_notify(int msgtype, void *data)  out:  	return; -nlmsg_failure: +out_kfree_skb:  	kfree_skb(skb);  oom:  	printk(KERN_ERR "SELinux:  OOM in %s\n", __func__); @@ -108,8 +111,12 @@ void selnl_notify_policyload(u32 seqno)  static int __init selnl_init(void)  { +	struct netlink_kernel_cfg cfg = { +		.groups	= SELNLGRP_MAX, +	}; +  	selnl = netlink_kernel_create(&init_net, NETLINK_SELINUX, -				      SELNLGRP_MAX, NULL, NULL, THIS_MODULE); +				      THIS_MODULE, &cfg);  	if (selnl == NULL)  		panic("SELinux:  Cannot create netlink socket.");  	netlink_set_nonroot(NETLINK_SELINUX, NL_NONROOT_RECV);  | 
