]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/llc/af_llc.c
[S390] cio: Avoid machine check vs. not operational races.
[linux-2.6-omap-h63xx.git] / net / llc / af_llc.c
index 6b8a103cf9e66f198984fed8656ddacf9781718a..49eacba824df5bfdf1905c1df6e5503eaf15326d 100644 (file)
@@ -150,14 +150,17 @@ static struct proto llc_proto = {
  *     socket type we have available.
  *     Returns 0 upon success, negative upon failure.
  */
-static int llc_ui_create(struct socket *sock, int protocol)
+static int llc_ui_create(struct net *net, struct socket *sock, int protocol)
 {
        struct sock *sk;
        int rc = -ESOCKTNOSUPPORT;
 
+       if (net != &init_net)
+               return -EAFNOSUPPORT;
+
        if (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) {
                rc = -ENOMEM;
-               sk = llc_sk_alloc(PF_LLC, GFP_KERNEL, &llc_proto);
+               sk = llc_sk_alloc(net, PF_LLC, GFP_KERNEL, &llc_proto);
                if (sk) {
                        rc = 0;
                        llc_ui_sk_init(sock, sk);
@@ -249,7 +252,7 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)
        if (!sock_flag(sk, SOCK_ZAPPED))
                goto out;
        rc = -ENODEV;
-       llc->dev = dev_getfirstbyhwtype(addr->sllc_arphrd);
+       llc->dev = dev_getfirstbyhwtype(&init_net, addr->sllc_arphrd);
        if (!llc->dev)
                goto out;
        rc = -EUSERS;
@@ -300,7 +303,7 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
                goto out;
        rc = -ENODEV;
        rtnl_lock();
-       llc->dev = dev_getbyhwaddr(addr->sllc_arphrd, addr->sllc_mac);
+       llc->dev = dev_getbyhwaddr(&init_net, addr->sllc_arphrd, addr->sllc_mac);
        rtnl_unlock();
        if (!llc->dev)
                goto out;