diff options
Diffstat (limited to 'net/netrom/af_netrom.c')
-rw-r--r-- | net/netrom/af_netrom.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 6d9c58ec56ac..4e705f87969f 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -1037,10 +1037,6 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1037 | unsigned char *asmptr; | 1037 | unsigned char *asmptr; |
1038 | int size; | 1038 | int size; |
1039 | 1039 | ||
1040 | /* Netrom empty data frame has no meaning : don't send */ | ||
1041 | if (len == 0) | ||
1042 | return 0; | ||
1043 | |||
1044 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) | 1040 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) |
1045 | return -EINVAL; | 1041 | return -EINVAL; |
1046 | 1042 | ||
@@ -1086,7 +1082,11 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1086 | 1082 | ||
1087 | SOCK_DEBUG(sk, "NET/ROM: sendto: Addresses built.\n"); | 1083 | SOCK_DEBUG(sk, "NET/ROM: sendto: Addresses built.\n"); |
1088 | 1084 | ||
1089 | /* Build a packet */ | 1085 | /* Build a packet - the conventional user limit is 236 bytes. We can |
1086 | do ludicrously large NetROM frames but must not overflow */ | ||
1087 | if (len > 65536) | ||
1088 | return -EMSGSIZE; | ||
1089 | |||
1090 | SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n"); | 1090 | SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n"); |
1091 | size = len + NR_NETWORK_LEN + NR_TRANSPORT_LEN; | 1091 | size = len + NR_NETWORK_LEN + NR_TRANSPORT_LEN; |
1092 | 1092 | ||
@@ -1171,11 +1171,6 @@ static int nr_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1171 | skb_reset_transport_header(skb); | 1171 | skb_reset_transport_header(skb); |
1172 | copied = skb->len; | 1172 | copied = skb->len; |
1173 | 1173 | ||
1174 | /* NetRom empty data frame has no meaning : ignore it */ | ||
1175 | if (copied == 0) { | ||
1176 | goto out; | ||
1177 | } | ||
1178 | |||
1179 | if (copied > size) { | 1174 | if (copied > size) { |
1180 | copied = size; | 1175 | copied = size; |
1181 | msg->msg_flags |= MSG_TRUNC; | 1176 | msg->msg_flags |= MSG_TRUNC; |
@@ -1191,7 +1186,7 @@ static int nr_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1191 | 1186 | ||
1192 | msg->msg_namelen = sizeof(*sax); | 1187 | msg->msg_namelen = sizeof(*sax); |
1193 | 1188 | ||
1194 | out: skb_free_datagram(sk, skb); | 1189 | skb_free_datagram(sk, skb); |
1195 | 1190 | ||
1196 | release_sock(sk); | 1191 | release_sock(sk); |
1197 | return copied; | 1192 | return copied; |