aboutsummaryrefslogtreecommitdiffstats
path: root/net/llc/af_llc.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/llc/af_llc.c')
-rw-r--r--net/llc/af_llc.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 66f55e514b56..2975d88eeb0a 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -404,7 +404,6 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr,
404 struct sock *sk = sock->sk; 404 struct sock *sk = sock->sk;
405 struct llc_sock *llc = llc_sk(sk); 405 struct llc_sock *llc = llc_sk(sk);
406 struct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr; 406 struct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr;
407 struct net_device *dev;
408 int rc = -EINVAL; 407 int rc = -EINVAL;
409 408
410 lock_sock(sk); 409 lock_sock(sk);
@@ -422,7 +421,6 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr,
422 llc->daddr.lsap = addr->sllc_sap; 421 llc->daddr.lsap = addr->sllc_sap;
423 memcpy(llc->daddr.mac, addr->sllc_mac, IFHWADDRLEN); 422 memcpy(llc->daddr.mac, addr->sllc_mac, IFHWADDRLEN);
424 } 423 }
425 dev = llc->dev;
426 if (sk->sk_type != SOCK_STREAM) 424 if (sk->sk_type != SOCK_STREAM)
427 goto out; 425 goto out;
428 rc = -EALREADY; 426 rc = -EALREADY;
@@ -431,7 +429,7 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr,
431 sock->state = SS_CONNECTING; 429 sock->state = SS_CONNECTING;
432 sk->sk_state = TCP_SYN_SENT; 430 sk->sk_state = TCP_SYN_SENT;
433 llc->link = llc_ui_next_link_no(llc->sap->laddr.lsap); 431 llc->link = llc_ui_next_link_no(llc->sap->laddr.lsap);
434 rc = llc_establish_connection(sk, dev->dev_addr, 432 rc = llc_establish_connection(sk, llc->dev->dev_addr,
435 addr->sllc_mac, addr->sllc_sap); 433 addr->sllc_mac, addr->sllc_sap);
436 if (rc) { 434 if (rc) {
437 dprintk("%s: llc_ui_send_conn failed :-(\n", __FUNCTION__); 435 dprintk("%s: llc_ui_send_conn failed :-(\n", __FUNCTION__);
@@ -740,7 +738,6 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock,
740 struct sockaddr_llc *addr = (struct sockaddr_llc *)msg->msg_name; 738 struct sockaddr_llc *addr = (struct sockaddr_llc *)msg->msg_name;
741 int flags = msg->msg_flags; 739 int flags = msg->msg_flags;
742 int noblock = flags & MSG_DONTWAIT; 740 int noblock = flags & MSG_DONTWAIT;
743 struct net_device *dev;
744 struct sk_buff *skb; 741 struct sk_buff *skb;
745 size_t size = 0; 742 size_t size = 0;
746 int rc = -EINVAL, copied = 0, hdrlen; 743 int rc = -EINVAL, copied = 0, hdrlen;
@@ -763,11 +760,10 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock,
763 if (rc) 760 if (rc)
764 goto release; 761 goto release;
765 } 762 }
766 dev = llc->dev; 763 hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr);
767 hdrlen = dev->hard_header_len + llc_ui_header_len(sk, addr);
768 size = hdrlen + len; 764 size = hdrlen + len;
769 if (size > dev->mtu) 765 if (size > llc->dev->mtu)
770 size = dev->mtu; 766 size = llc->dev->mtu;
771 copied = size - hdrlen; 767 copied = size - hdrlen;
772 release_sock(sk); 768 release_sock(sk);
773 skb = sock_alloc_send_skb(sk, size, noblock, &rc); 769 skb = sock_alloc_send_skb(sk, size, noblock, &rc);
@@ -775,7 +771,7 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock,
775 if (!skb) 771 if (!skb)
776 goto release; 772 goto release;
777 skb->sk = sk; 773 skb->sk = sk;
778 skb->dev = dev; 774 skb->dev = llc->dev;
779 skb->protocol = llc_proto_type(addr->sllc_arphrd); 775 skb->protocol = llc_proto_type(addr->sllc_arphrd);
780 skb_reserve(skb, hdrlen); 776 skb_reserve(skb, hdrlen);
781 rc = memcpy_fromiovec(skb_put(skb, copied), msg->msg_iov, copied); 777 rc = memcpy_fromiovec(skb_put(skb, copied), msg->msg_iov, copied);