diff mbox series

[net-next] net/neighbor: clear error in case strict check is not set

Message ID 20241115003221.733593-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit 0de6a472c3b38432b2f184bd64eb70d9ea36d107
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net/neighbor: clear error in case strict check is not set | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 3 maintainers not CCed: kuniyu@amazon.com gnaaman@drivenets.com horms@kernel.org
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 6 this patch: 6
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-11-15--21-00 (tests: 789)

Commit Message

Jakub Kicinski Nov. 15, 2024, 12:32 a.m. UTC
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.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: joel.granados@kernel.org
---
 net/core/neighbour.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Simon Horman Nov. 15, 2024, 2:06 p.m. UTC | #1
On Thu, Nov 14, 2024 at 04:32:21PM -0800, Jakub Kicinski wrote:
> 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.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: joel.granados@kernel.org

Reviewed-by: Simon Horman <horms@kernel.org>
patchwork-bot+netdevbpf@kernel.org Nov. 19, 2024, 3 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 14 Nov 2024 16:32:21 -0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next] net/neighbor: clear error in case strict check is not set
    https://git.kernel.org/netdev/net-next/c/0de6a472c3b3

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 77b819cd995b..cc58315a40a7 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2876,6 +2876,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];