[iproute2] devlink: require resource parameters
diff mbox series

Message ID 20191105211336.10075-1-jakub.kicinski@netronome.com
State New
Delegated to: stephen hemminger
Headers show
Series
  • [iproute2] devlink: require resource parameters
Related show

Commit Message

Jakub Kicinski Nov. 5, 2019, 9:13 p.m. UTC
If devlink resource set parameters are not provided it crashes:
$ devlink resource set netdevsim/netdevsim0
Segmentation fault (core dumped)

This is because even though DL_OPT_RESOURCE_PATH and
DL_OPT_RESOURCE_SIZE are passed as o_required, the validation
table doesn't contain a relevant string.

Fixes: 8cd644095842 ("devlink: Add support for devlink resource abstraction")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
--
CC: Jiri Pirko <jiri@mellanox.com>
CC: Arkadi Sharshevsky <arkadis@mellanox.com>
---
 devlink/devlink.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jiri Pirko Nov. 6, 2019, 8:12 a.m. UTC | #1
Tue, Nov 05, 2019 at 10:13:36PM CET, jakub.kicinski@netronome.com wrote:
>If devlink resource set parameters are not provided it crashes:
>$ devlink resource set netdevsim/netdevsim0
>Segmentation fault (core dumped)
>
>This is because even though DL_OPT_RESOURCE_PATH and
>DL_OPT_RESOURCE_SIZE are passed as o_required, the validation
>table doesn't contain a relevant string.
>
>Fixes: 8cd644095842 ("devlink: Add support for devlink resource abstraction")
>Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>--
>CC: Jiri Pirko <jiri@mellanox.com>
>CC: Arkadi Sharshevsky <arkadis@mellanox.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>
Stephen Hemminger Nov. 8, 2019, 4:38 a.m. UTC | #2
On Tue,  5 Nov 2019 13:13:36 -0800
Jakub Kicinski <jakub.kicinski@netronome.com> wrote:

> If devlink resource set parameters are not provided it crashes:
> $ devlink resource set netdevsim/netdevsim0
> Segmentation fault (core dumped)
> 
> This is because even though DL_OPT_RESOURCE_PATH and
> DL_OPT_RESOURCE_SIZE are passed as o_required, the validation
> table doesn't contain a relevant string.
> 
> Fixes: 8cd644095842 ("devlink: Add support for devlink resource abstraction")
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Applied

Patch
diff mbox series

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 5bbe0bddd910..056ac95ee726 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1121,6 +1121,8 @@  static const struct dl_args_metadata dl_args_required[] = {
 	{DL_OPT_DPIPE_TABLE_NAME,     "Dpipe table name expected."},
 	{DL_OPT_DPIPE_TABLE_COUNTERS, "Dpipe table counter state expected."},
 	{DL_OPT_ESWITCH_ENCAP_MODE,   "E-Switch encapsulation option expected."},
+	{DL_OPT_RESOURCE_PATH,	      "Resource path expected."},
+	{DL_OPT_RESOURCE_SIZE,	      "Resource size expected."},
 	{DL_OPT_PARAM_NAME,	      "Parameter name expected."},
 	{DL_OPT_PARAM_VALUE,	      "Value to set expected."},
 	{DL_OPT_PARAM_CMODE,	      "Configuration mode expected."},