From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by passt.top (Postfix) with ESMTPS id 756F05A0271 for ; Wed, 9 Aug 2023 11:23:45 +0200 (CEST) Received: from lenovo-t14s.redhat.com ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MuDHR-1pfxXW2vWv-00uXax; Wed, 09 Aug 2023 11:23:43 +0200 From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH] tap: fix seq->p.count limit Date: Wed, 9 Aug 2023 11:23:42 +0200 Message-ID: <20230809092342.2299907-1-lvivier@redhat.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:uXUkLb1IAARp9YksjWEBcYynGoesFEWuWq7SP3/E34O9KlxDoas x5cM4/e4/OPoS+lXJpw4n2+UJ3KZ55TQL3BclO8DL5WJTxu5r25+MHor3tNuck7MiOl0DBd d8hJopEVppFZNVvmSO05hHoWT/MJzJ4FR1fv98xQU8E6TBLxRSFPF+cE3Q36nMVZGfF2XgF MftGUyboF40zKNIl/DzyA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:2ZRcFuoAy+0=;HOqiTj0ERu7S8BynIaSNnOTzCcp QVOJQ5QPl0JdyNbhdEF2JdaSN/uXB0mODB3HWbb3fhEaT/NtOQsIZJ4mJOdYCIGyTJqBHmCAa xPHUOEZ2+5ao3wwNOLtJIdo/06IWEB3iLwpm4b7cGUCdBap21aQiy9ktrU2pdfGpoPoYZdByb NYGzNt7V9m8ACVzpY1QsHQWbBT91wJTZElpSSMFzVshrA41MJfkvepwziJHnfkeb89rRPLYrj 9017EUbFEuZyu+fZa3npfeuUI8WtK3Dl5eqtsKCZz5oYsSlQL6FxmI1e+TCZD0qXgsnIN07pv Fb0Dgqtw5af9nnzqHM3O/LI/G6V+TcuJS3n1H+NzikGIs7ZfiLjgF0SGlLSHlyCbWf67QDR22 2LzrQ0COtmcnGmpy2TF1KWSf/HInUCf6NLmflNPfGvihVhFkGh2TEgd068BAlv9cclPF5Kf2n iU8aOFif1/v03SeQQ157LLrvHKWWgv6nSQcYSBsS3J/WsuN/S7S9QmoL5cXlubwUmDo0nPybA rV1FwvLiucpDEk21L/WFe+An/Q4fe+QOKC6yCowE/HupP1bh8bupV+q7jwmSB/D9tA6igm+ul YzKM9BBB6Y8o2cmDyVQyz3ukajPfV31qdjuNbgpoHFxZHaTkGc8s2lH5HbhKy+S7dJSvT9Rr9 17JSzk2Zn28tHeAAc9MMGcXId6cOWnCg4nWaq94pw203IkveOX2lNI4p111XZtztw5HyNNbEd 5Ii76sjrGYOFBFzqeMMWLlyw1/aGbKcK+ik9/YBYK1RwK5PuWsk65tO2RmC5V8zvWeyt3zGuQ EJFYtxpOGtkDyCVdQMqIG+LfrHLoEMwPlUMbJxgtqA3T1V+VL32AQ6pOWGpOr1VNrVUDMWM4S aaq0CihBTKrcE2w== Message-ID-Hash: 3IEYSAY7LMAQTLJ4WURU2GDKDLV6F7ZE X-Message-ID-Hash: 3IEYSAY7LMAQTLJ4WURU2GDKDLV6F7ZE X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The number of items in pool_l4_t is defined to UIO_MAXIOV, not TAP_SEQS. TAP_SEQS is the number of the messages. Fix the value used to compare seq->p.count with. Fix: bb708111833e ("treewide: Packet abstraction with mandatory boundary checks") Signed-off-by: Laurent Vivier --- tap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tap.c b/tap.c index e034f9468267..69bd19a2a91a 100644 --- a/tap.c +++ b/tap.c @@ -678,7 +678,7 @@ resume: seq->daddr.s_addr = iph->daddr; \ } while (0) - if (seq && L4_MATCH(iph, uh, seq) && seq->p.count < TAP_SEQS) + if (seq && L4_MATCH(iph, uh, seq) && seq->p.count < UIO_MAXIOV) goto append; if (seq_count == TAP_SEQS) @@ -686,7 +686,7 @@ resume: for (seq = tap4_l4 + seq_count - 1; seq >= tap4_l4; seq--) { if (L4_MATCH(iph, uh, seq)) { - if (seq->p.count >= TAP_SEQS) + if (seq->p.count >= UIO_MAXIOV) seq = NULL; break; } @@ -840,7 +840,7 @@ resume: } while (0) if (seq && L4_MATCH(ip6h, proto, uh, seq) && - seq->p.count < TAP_SEQS) + seq->p.count < UIO_MAXIOV) goto append; if (seq_count == TAP_SEQS) @@ -848,7 +848,7 @@ resume: for (seq = tap6_l4 + seq_count - 1; seq >= tap6_l4; seq--) { if (L4_MATCH(ip6h, proto, uh, seq)) { - if (seq->p.count >= TAP_SEQS) + if (seq->p.count >= UIO_MAXIOV) seq = NULL; break; } -- 2.41.0