Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-20726

Fix Invalid Parameter Matching in class_set_global()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • None
    • 3
    • 9223372036854775807

      class_set_global() incorrectly accepts parameters whose name is empty, such as "=value". For an input beginning with =, the calculated off is 0.

      size_t off = value - param - 1;

      The subsequent comparison:

      strncmp(lustre_attrs[i]->name, param, off)

      becomes strncmp(..., ..., 0), which always returns 0. As a result, the first attribute in lustre_attrs[] is incorrectly selected and its store callback is invoked with the supplied value. An empty parameter name should not match any attribute.

      Expected behavior

      • Reject parameters with an empty name, e.g. "=value".
      • Return an appropriate error such as -EINVAL.
      • Only match an attribute when a non-empty parameter name is provided and it matches the attribute name.

            ckansal Chakshu Kansal
            ckansal Chakshu Kansal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: