提交 ecc515d7 编写于 作者: X Xin Long 提交者: David S. Miller

sctp: fix the panic caused by route update

Commit 7303a147 ("sctp: identify chunks that need to be fragmented
at IP level") made the chunk be fragmented at IP level in the next round
if it's size exceed PMTU.

But there still is another case, PMTU can be updated if transport's dst
expires and transport's pmtu_pending is set in sctp_packet_transmit. If
the new PMTU is less than the chunk, the same issue with that commit can
be triggered.

So we should drop this packet and let it retransmit in another round
where it would be fragmented at IP level.

This patch is to fix it by checking the chunk size after PMTU may be
updated and dropping this packet if it's size exceed PMTU.

Fixes: 90017acc ("sctp: Add GSO support")
Signed-off-by: NXin Long <lucien.xin@gmail.com>
Acked-by: NNeil Horman <nhorman@txudriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 293de7de
...@@ -418,6 +418,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) ...@@ -418,6 +418,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
__u8 has_data = 0; __u8 has_data = 0;
int gso = 0; int gso = 0;
int pktcount = 0; int pktcount = 0;
int auth_len = 0;
struct dst_entry *dst; struct dst_entry *dst;
unsigned char *auth = NULL; /* pointer to auth in skb data */ unsigned char *auth = NULL; /* pointer to auth in skb data */
...@@ -510,7 +511,12 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) ...@@ -510,7 +511,12 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
list_for_each_entry(chunk, &packet->chunk_list, list) { list_for_each_entry(chunk, &packet->chunk_list, list) {
int padded = SCTP_PAD4(chunk->skb->len); int padded = SCTP_PAD4(chunk->skb->len);
if (pkt_size + padded > tp->pathmtu) if (chunk == packet->auth)
auth_len = padded;
else if (auth_len + padded + packet->overhead >
tp->pathmtu)
goto nomem;
else if (pkt_size + padded > tp->pathmtu)
break; break;
pkt_size += padded; pkt_size += padded;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册