Commit f99bcff7a290768e035f3d4726e103c6ebe858bf
Committed by
David S. Miller
1 parent
60784427ab
Exists in
master
and in
4 other branches
ax25: zero length frame filtering in AX25
In previous commit 244f46ae6e9e18f6fc0be7d1f49febde4762c34b was introduced a zero length frame filter for ROSE protocole. This patch has the same purpose at AX25 frame level for the same reason. Empty frames have no meaning in AX25 protocole. Signed-off-by: Bernard Pidoux <f6bvp@amsat.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 12 additions and 0 deletions Side-by-side Diff
net/ax25/af_ax25.c
... | ... | @@ -1435,6 +1435,11 @@ |
1435 | 1435 | size_t size; |
1436 | 1436 | int lv, err, addr_len = msg->msg_namelen; |
1437 | 1437 | |
1438 | + /* AX.25 empty data frame has no meaning : don't send */ | |
1439 | + if (len == 0) { | |
1440 | + return (0); | |
1441 | + } | |
1442 | + | |
1438 | 1443 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) |
1439 | 1444 | return -EINVAL; |
1440 | 1445 | |
... | ... | @@ -1633,6 +1638,13 @@ |
1633 | 1638 | |
1634 | 1639 | skb_reset_transport_header(skb); |
1635 | 1640 | copied = skb->len; |
1641 | + | |
1642 | + /* AX.25 empty data frame has no meaning : ignore it */ | |
1643 | + if (copied == 0) { | |
1644 | + err = copied; | |
1645 | + skb_free_datagram(sk, skb); | |
1646 | + goto out; | |
1647 | + } | |
1636 | 1648 | |
1637 | 1649 | if (copied > size) { |
1638 | 1650 | copied = size; |