Skip to contentSkip to conversation

devlink: fix devlink flash error reporting

PATCH Applied Ivan Vecera 3 participants 3 messages Oct 22, 2025 – Oct 30, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devlink: fix devlink flash error reporting

Currently, devlink silently exits when a non-existent device is specified for flashing or when the user lacks sufficient permissions. This makes it hard to diagnose the problem.

Print an appropriate error message in these cases to improve user feedback.

Prior:

$ devlink dev flash foo/bar file test
$ sudo devlink dev flash foo/bar file test
$

After patch:

$ devlink/devlink dev flash foo/bar file test
devlink answers: Operation not permitted
$ sudo devlink/devlink dev flash foo/bar file test
devlink answers: No such device
Fixes 9b13cddfe268 ("devlink: implement flash status monitoring")
---
 devlink/devlink.c | 2 ++
 1 file changed, 2 insertions(+)
devlink/devlink.c +2 -0
index 171b85327be3..b162cf4050f9 100644
@@ -4594,6 +4594,8 @@ static int cmd_dev_flash(struct dl *dl)
 	} while (!ctx.flash_done || (ctx.not_first && !ctx.received_end));
 
 	err = mnlu_gen_socket_recv_run(&dl->nlg, NULL, NULL);
+	if (err < 0)
+		pr_err("devlink answers: %s\n", strerror(errno));
 
 out:
 	close(pipe_r);
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Wed, Oct 22, 2025 at 02:23:02PM +0200, [email protected] wrote:

Currently, devlink silently exits when a non-existent device is specified for flashing or when the user lacks sufficient permissions. This makes it hard to diagnose the problem.

Print an appropriate error message in these cases to improve user feedback.

Prior:

$ devlink dev flash foo/bar file test
$ sudo devlink dev flash foo/bar file test
$
Quoted 8 lines

After patch:

$ devlink/devlink dev flash foo/bar file test
devlink answers: Operation not permitted
$ sudo devlink/devlink dev flash foo/bar file test
devlink answers: No such device
Fixes 9b13cddfe268 ("devlink: implement flash status monitoring")

Thanks!

#2 lore raw
In reply to Ivan Vecera
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Quoted 4 lines · On Wed, 22 Oct 2025 14:23:02 +0200 you wrote:

Currently, devlink silently exits when a non-existent device is specified for flashing or when the user lacks sufficient permissions. This makes it hard to diagnose the problem.

Quoted 8 lines

Print an appropriate error message in these cases to improve user feedback.

Prior:

$ devlink dev flash foo/bar file test
$ sudo devlink dev flash foo/bar file test
$

[...]

Here is the summary with links:
- [iproute2] devlink: fix devlink flash error reporting

    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=ab785eff0b1b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html