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: b18d89195b ("devlink: Add devlink health set command")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
98631f134d
commit
4fb98f0895
|
|
@ -231,8 +231,8 @@ static void ifname_map_free(struct ifname_map *ifname_map)
|
|||
#define DL_OPT_FLASH_FILE_NAME BIT(25)
|
||||
#define DL_OPT_FLASH_COMPONENT BIT(26)
|
||||
#define DL_OPT_HEALTH_REPORTER_NAME BIT(27)
|
||||
#define DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD BIT(27)
|
||||
#define DL_OPT_HEALTH_REPORTER_AUTO_RECOVER BIT(28)
|
||||
#define DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD BIT(28)
|
||||
#define DL_OPT_HEALTH_REPORTER_AUTO_RECOVER BIT(29)
|
||||
|
||||
struct dl_opts {
|
||||
uint32_t present; /* flags of present items */
|
||||
|
|
|
|||
Loading…
Reference in New Issue