Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-90182

RHEL10 ledctl locate_off command error due to ledmon code bug on version 1.1.0

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • rhel-10.1
    • None
    • ledmon
    • None
    • ledmon-1.1.0-2.el10
    • No
    • Moderate
    • ZStream
    • rhel-systemd
    • ssg_core_services
    • 26
    • 2
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • Approved Blocker
    • Unspecified
    • Unspecified
    • Unspecified
    • x86_64
    • None

      What were you trying to do that didn't work?

      Perform locate_off, the light  should be turned off, but it turn on the light

      What is the impact of this issue to you?

      Please provide the package NVR for which the bug is seen:

      How reproducible is this bug?:

      Steps to reproduce

      1. install redhat10
      2. start ledmon service
      3. exe ledtl locate_off on nvme

      Analyze results

      On rehat10 verison, the ledmon and ledctl version is 1.1.0.
      This version have bugs on locate_off command.
      On the  *_ibpi_state_get function,enum led_ibpi_pattern ibpi = string2ibpi(name) will feedback wrong ibpi para between locate and locate_off.
       
      If the char *name is locate_off, the strncmp  use the input name lenth to compare the string, it will first match the "locate" string, and "locate_off" will execute the "locate" logic. Need  modify the "strncmp(input_name, name, strlen(input_name)) == 0" to  "strcmp(input_name, name) == 0".
       enum led_ibpi_pattern string2ibpi(const char *name)
      {
      int i;
       
      for (i = 0; i < ARRAY_SIZE(ipbi_names); i++)

      { char *input_name = ipbi_names[i].input_name;   if (!input_name) continue;   if (strncmp(input_name, name, strlen(input_name)) == 0) return ipbi_names[i].ibpi; }

       
      return LED_IBPI_PATTERN_UNKNOWN;
      }
       
      intel has fix this issue on ledmon mainline, but redhat has not fix this issue yet
      utils: Fix string2ibpi functionstring2ibpi does not compare strings correctly, the function uses strncmp, which in case strings of different lengths, may return incorrect value if substrings of given max length are identical. In this function whole strings must be identical. Fix is to change strncmp to strcmp. Fixes #259 Fixes: 9481845 ("Add struct for mapping ibpi statuses to strings. (#211)") Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
       
      Please help provide the fixed ledmon version.
       

              jamacku@redhat.com Jan Macku
              wangdong28 wang dong
              Lenovo Confidential Group
              Jan Macku Jan Macku
              Changhui Zhong Changhui Zhong
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated: