]> git.proxmox.com Git - mirror_iproute2.git/commit
devlink: fix segfault on health command
authorAndrea Claudi <aclaudi@redhat.com>
Wed, 4 Sep 2019 17:26:14 +0000 (19:26 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 4 Sep 2019 19:01:19 +0000 (12:01 -0700)
commit4fb98f08956ff4810354d75afa9b04cb6f8011bc
tree10a6df586dfd1816cb0c427266cf8d17164037a3
parent98631f134d24db615e8d2adf8c7cb23df715a644
devlink: fix segfault on health command

devlink segfaults when using grace_period without reporter

$ devlink health set pci/0000:00:09.0 grace_period 3500
Segmentation fault

devlink is instead supposed to gracefully fail printing a warning
message

$ devlink health set pci/0000:00:09.0 grace_period 3500
Reporter's name is expected.

This happens because DL_OPT_HEALTH_REPORTER_NAME and
DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD are both defined as BIT(27).
When dl_opts_put() parse options and grace_period is set, it erroneously
tries to set reporter name to null.

This is fixed simply shifting by 1 bit enumeration starting with
DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD.

Fixes: b18d89195b16 ("devlink: Add devlink health set command")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
devlink/devlink.c