diff options
Diffstat (limited to 'net/x25/af_x25.c')
-rw-r--r-- | net/x25/af_x25.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 9fc5b023d111..ed80af8ca5fb 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -951,10 +951,8 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb, | |||
951 | /* | 951 | /* |
952 | * Incoming Call User Data. | 952 | * Incoming Call User Data. |
953 | */ | 953 | */ |
954 | if (skb->len >= 0) { | 954 | skb_copy_from_linear_data(skb, makex25->calluserdata.cuddata, skb->len); |
955 | skb_copy_from_linear_data(skb, makex25->calluserdata.cuddata, skb->len); | 955 | makex25->calluserdata.cudlength = skb->len; |
956 | makex25->calluserdata.cudlength = skb->len; | ||
957 | } | ||
958 | 956 | ||
959 | sk->sk_ack_backlog++; | 957 | sk->sk_ack_backlog++; |
960 | 958 | ||
@@ -1037,6 +1035,12 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1037 | sx25.sx25_addr = x25->dest_addr; | 1035 | sx25.sx25_addr = x25->dest_addr; |
1038 | } | 1036 | } |
1039 | 1037 | ||
1038 | /* Sanity check the packet size */ | ||
1039 | if (len > 65535) { | ||
1040 | rc = -EMSGSIZE; | ||
1041 | goto out; | ||
1042 | } | ||
1043 | |||
1040 | SOCK_DEBUG(sk, "x25_sendmsg: sendto: Addresses built.\n"); | 1044 | SOCK_DEBUG(sk, "x25_sendmsg: sendto: Addresses built.\n"); |
1041 | 1045 | ||
1042 | /* Build a packet */ | 1046 | /* Build a packet */ |
@@ -1122,8 +1126,9 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1122 | if (msg->msg_flags & MSG_OOB) | 1126 | if (msg->msg_flags & MSG_OOB) |
1123 | skb_queue_tail(&x25->interrupt_out_queue, skb); | 1127 | skb_queue_tail(&x25->interrupt_out_queue, skb); |
1124 | else { | 1128 | else { |
1125 | len = x25_output(sk, skb); | 1129 | rc = x25_output(sk, skb); |
1126 | if (len < 0) | 1130 | len = rc; |
1131 | if (rc < 0) | ||
1127 | kfree_skb(skb); | 1132 | kfree_skb(skb); |
1128 | else if (x25->qbitincl) | 1133 | else if (x25->qbitincl) |
1129 | len++; | 1134 | len++; |
@@ -1608,8 +1613,8 @@ static const struct proto_ops SOCKOPS_WRAPPED(x25_proto_ops) = { | |||
1608 | 1613 | ||
1609 | SOCKOPS_WRAP(x25_proto, AF_X25); | 1614 | SOCKOPS_WRAP(x25_proto, AF_X25); |
1610 | 1615 | ||
1611 | static struct packet_type x25_packet_type = { | 1616 | static struct packet_type x25_packet_type __read_mostly = { |
1612 | .type = __constant_htons(ETH_P_X25), | 1617 | .type = cpu_to_be16(ETH_P_X25), |
1613 | .func = x25_lapb_receive_frame, | 1618 | .func = x25_lapb_receive_frame, |
1614 | }; | 1619 | }; |
1615 | 1620 | ||