]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/neighbor: clear error in case strict check is not set
authorJakub Kicinski <kuba@kernel.org>
Fri, 15 Nov 2024 00:32:21 +0000 (16:32 -0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 19 Nov 2024 02:42:21 +0000 (18:42 -0800)
Commit 51183d233b5a ("net/neighbor: Update neigh_dump_info for strict
data checking") added strict checking. The err variable is not cleared,
so if we find no table to dump we will return the validation error even
if user did not want strict checking.

I think the only way to hit this is to send an buggy request, and ask
for a table which doesn't exist, so there's no point treating this
as a real fix. I only noticed it because a syzbot repro depended on it
to trigger another bug.

Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241115003221.733593-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/neighbour.c

index 5e572f6eaf2ce0009704008215c6a978f481a753..89656d180bc60c57516d56be69774ed0c7b352b2 100644 (file)
@@ -2824,6 +2824,7 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
        err = neigh_valid_dump_req(nlh, cb->strict_check, &filter, cb->extack);
        if (err < 0 && cb->strict_check)
                return err;
+       err = 0;
 
        s_t = cb->args[0];