]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: mctp: test: Use correct skb for route input check
authorJeremy Kerr <jk@codeconstruct.com.au>
Fri, 16 Aug 2024 10:29:17 +0000 (18:29 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 20 Aug 2024 00:48:00 +0000 (17:48 -0700)
In the MCTP route input test, we're routing one skb, then (when delivery
is expected) checking the resulting routed skb.

However, we're currently checking the original skb length, rather than
the routed skb. Check the routed skb instead; the original will have
been freed at this point.

Fixes: 8892c0490779 ("mctp: Add route input to socket tests")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/kernel-janitors/4ad204f0-94cf-46c5-bdab-49592addf315@kili.mountain/
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240816-mctp-kunit-skb-fix-v1-1-3c367ac89c27@codeconstruct.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mctp/test/route-test.c

index 77e5dd42225802fa4418448c6858c06cc636545e..8551dab1d1e69836c84f68509bc9dab43a96cc67 100644 (file)
@@ -366,7 +366,7 @@ static void mctp_test_route_input_sk(struct kunit *test)
 
                skb2 = skb_recv_datagram(sock->sk, MSG_DONTWAIT, &rc);
                KUNIT_EXPECT_NOT_ERR_OR_NULL(test, skb2);
-               KUNIT_EXPECT_EQ(test, skb->len, 1);
+               KUNIT_EXPECT_EQ(test, skb2->len, 1);
 
                skb_free_datagram(sock->sk, skb2);