From 1bf9310a1336c26873dc3eb5fa188d4263897929 Mon Sep 17 00:00:00 2001 From: Nicolas Dichtel Date: Wed, 24 Apr 2013 10:36:23 +0200 Subject: netlink: fix compilation after memory mapped patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Depending of the kernel configuration (CONFIG_UIDGID_STRICT_TYPE_CHECKS), we can get the following errors: net/netlink/af_netlink.c: In function ‘netlink_queue_mmaped_skb’: net/netlink/af_netlink.c:663:14: error: incompatible types when assigning to type ‘__u32’ from type ‘kuid_t’ net/netlink/af_netlink.c:664:14: error: incompatible types when assigning to type ‘__u32’ from type ‘kgid_t’ net/netlink/af_netlink.c: In function ‘netlink_ring_set_copied’: net/netlink/af_netlink.c:693:14: error: incompatible types when assigning to type ‘__u32’ from type ‘kuid_t’ net/netlink/af_netlink.c:694:14: error: incompatible types when assigning to type ‘__u32’ from type ‘kgid_t’ We must use the helpers to get the uid and gid, and also take care of user_ns. Fix suggested by Eric W. Biederman . Signed-off-by: Nicolas Dichtel Signed-off-by: David S. Miller --- net/netlink/af_netlink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'net/netlink') diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index da5601d13a7f..d9c7869312c1 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -660,8 +660,8 @@ static void netlink_queue_mmaped_skb(struct sock *sk, struct sk_buff *skb) hdr->nm_len = skb->len; hdr->nm_group = NETLINK_CB(skb).dst_group; hdr->nm_pid = NETLINK_CB(skb).creds.pid; - hdr->nm_uid = NETLINK_CB(skb).creds.uid; - hdr->nm_gid = NETLINK_CB(skb).creds.gid; + hdr->nm_uid = from_kuid(sk_user_ns(sk), NETLINK_CB(skb).creds.uid); + hdr->nm_gid = from_kgid(sk_user_ns(sk), NETLINK_CB(skb).creds.gid); netlink_frame_flush_dcache(hdr); netlink_set_status(hdr, NL_MMAP_STATUS_VALID); @@ -690,8 +690,8 @@ static void netlink_ring_set_copied(struct sock *sk, struct sk_buff *skb) hdr->nm_len = skb->len; hdr->nm_group = NETLINK_CB(skb).dst_group; hdr->nm_pid = NETLINK_CB(skb).creds.pid; - hdr->nm_uid = NETLINK_CB(skb).creds.uid; - hdr->nm_gid = NETLINK_CB(skb).creds.gid; + hdr->nm_uid = from_kuid(sk_user_ns(sk), NETLINK_CB(skb).creds.uid); + hdr->nm_gid = from_kgid(sk_user_ns(sk), NETLINK_CB(skb).creds.gid); netlink_set_status(hdr, NL_MMAP_STATUS_COPY); } -- cgit v1.2.3