Hi all,

Today's linux-next merge of the net-next tree got a conflict in
net/netfilter/nfnetlink_log.c between commit 0626af313957 ("netfilter:
take care of timewait sockets") from the  tree and commit 9eea9515cb5f
("userns: nfnetlink_log: Report socket uids in the log sockets user
namespace") from the net-next tree.

Just context changes. I fixed it up (see below) and can carry the fix as
necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    [email protected]

diff --cc net/netfilter/nfnetlink_log.c
index 5cfb5be,8cb67c4..0000000
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@@ -500,14 -501,16 +502,17 @@@ __build_packet_message(struct nfulnl_in
        }
  
        /* UID */
 -      if (skb->sk) {
 -              read_lock_bh(&skb->sk->sk_callback_lock);
 -              if (skb->sk->sk_socket && skb->sk->sk_socket->file) {
 -                      struct file *file = skb->sk->sk_socket->file;
 +      sk = skb->sk;
 +      if (sk && sk->sk_state != TCP_TIME_WAIT) {
 +              read_lock_bh(&sk->sk_callback_lock);
 +              if (sk->sk_socket && sk->sk_socket->file) {
 +                      struct file *file = sk->sk_socket->file;
-                       __be32 uid = htonl(file->f_cred->fsuid);
-                       __be32 gid = htonl(file->f_cred->fsgid);
+                       __be32 uid = htonl(from_kuid_munged(inst->peer_user_ns,
+                                                           
file->f_cred->fsuid));
+                       __be32 gid = htonl(from_kgid_munged(inst->peer_user_ns,
+                                                           
file->f_cred->fsgid));
+                       /* need to unlock here since NLA_PUT may goto */
 -                      read_unlock_bh(&skb->sk->sk_callback_lock);
 +                      read_unlock_bh(&sk->sk_callback_lock);
                        if (nla_put_be32(inst->skb, NFULA_UID, uid) ||
                            nla_put_be32(inst->skb, NFULA_GID, gid))
                                goto nla_put_failure;

Attachment: pgphYUx7w60yU.pgp
Description: PGP signature

Reply via email to