sctp: return true only for pathmtu update in sctp_transport_pl_toobig
authorXin Long <lucien.xin@gmail.com>
Thu, 28 Oct 2021 09:36:04 +0000 (05:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:43 +0000 (19:16 +0100)
[ Upstream commit 75cf662c64dd8543f56c329c69eba18141c8fd9f ]

sctp_transport_pl_toobig() supposes to return true only if there's
pathmtu update, so that in sctp_icmp_frag_needed() it would call
sctp_assoc_sync_pmtu() and sctp_retransmit(). This patch is to fix
these return places in sctp_transport_pl_toobig().

Fixes: 836964083177 ("sctp: do state transition when receiving an icmp TOOBIG packet")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sctp/transport.c

index 1f2dfad768d526c4d68dfd2de4b63fb013404d19..133f1719bf1b735096ebf4bc26d15bae591cea8e 100644 (file)
@@ -368,6 +368,7 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu)
 
                        t->pl.pmtu = SCTP_BASE_PLPMTU;
                        t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
+                       return true;
                }
        } else if (t->pl.state == SCTP_PL_SEARCH) {
                if (pmtu >= SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {
@@ -378,11 +379,10 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu)
                        t->pl.probe_high = 0;
                        t->pl.pmtu = SCTP_BASE_PLPMTU;
                        t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
+                       return true;
                } else if (pmtu > t->pl.pmtu && pmtu < t->pl.probe_size) {
                        t->pl.probe_size = pmtu;
                        t->pl.probe_count = 0;
-
-                       return false;
                }
        } else if (t->pl.state == SCTP_PL_COMPLETE) {
                if (pmtu >= SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {
@@ -393,10 +393,11 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu)
                        t->pl.probe_high = 0;
                        t->pl.pmtu = SCTP_BASE_PLPMTU;
                        t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
+                       return true;
                }
        }
 
-       return true;
+       return false;
 }
 
 bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)