*/
#include <linux/module.h>
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/sched.h>
#define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE)
-#ifdef CONFIG_SECURITY_NETWORK
-static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
-{
- memcpy(UNIXSID(skb), &scm->secid, sizeof(u32));
-}
-
-static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
-{
- scm->secid = *UNIXSID(skb);
-}
-#else
-static inline void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
-{ }
-
-static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
-{ }
-#endif /* CONFIG_SECURITY_NETWORK */
-
/*
* SMP locking strategy:
* hash table is protected with spinlock unix_table_lock
.obj_size = sizeof(struct unix_sock),
};
-/*
- * AF_UNIX sockets do not interact with hardware, hence they
- * dont trigger interrupts - so it's safe for them to have
- * bh-unsafe locking for their sk_receive_queue.lock. Split off
- * this special lock-class by reinitializing the spinlock key:
- */
-static struct lock_class_key af_unix_sk_receive_queue_lock_key;
-
static struct sock * unix_create1(struct socket *sock)
{
struct sock *sk = NULL;
atomic_inc(&unix_nr_socks);
sock_init_data(sock,sk);
- lockdep_set_class(&sk->sk_receive_queue.lock,
- &af_unix_sk_receive_queue_lock_key);
sk->sk_write_space = unix_write_space;
sk->sk_max_ack_backlog = sysctl_unix_max_dgram_qlen;
goto out;
err = -ENOMEM;
- addr = kzalloc(sizeof(*addr) + sizeof(short) + 16, GFP_KERNEL);
+ addr = kmalloc(sizeof(*addr) + sizeof(short) + 16, GFP_KERNEL);
if (!addr)
goto out;
+ memset(addr, 0, sizeof(*addr) + sizeof(short) + 16);
addr->name->sun_family = AF_UNIX;
atomic_set(&addr->refcnt, 1);
goto out_unlock;
}
- unix_state_wlock_nested(sk);
+ unix_state_wlock(sk);
if (sk->sk_state != st) {
unix_state_wunlock(sk);
memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
if (siocb->scm->fp)
unix_attach_fds(siocb->scm, skb);
- unix_get_secdata(siocb->scm, skb);
skb->h.raw = skb->data;
err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
memset(&tmp_scm, 0, sizeof(tmp_scm));
}
siocb->scm->creds = *UNIXCREDS(skb);
- unix_set_secdata(siocb->scm, skb);
if (!(flags & MSG_PEEK))
{