Project

General

Profile

Bug #13046

i40e_device_find() ASSERTs that num_ports and num_partitions are non-zero, but i40e_parse_discover_capabilities() can return with them being zero

Added by Randy Fishel 4 months ago. Updated 4 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

In the function i40e_parse_discover_capabilities(), the i40e_hw elements of num_ports and num_partitions are initialized to zero; such that if the driver fails to discover any active ports, both values will be zero after the function returns. Yet in i40e_device_find, it is ASSRT'd that both values are non-zero; and further tries to use values later that are expected to be non-zero.

Instead, the function should check if either value is non-zero and return a NULL i40e_device_t (callers check to see if the return is NULL, and will fail the configuration).

Suggested code:

                /*
                 * Though remote, it is possible that both ports and partitions
                 * can be zero.  Though it is possible that this is a temporary
                 * condition, this driver doesn't have a way of being restarted,
                 * so we fail here and maybe a future attach will be better.
                 */
                if (hw->num_ports == 0 || hw->num_partitions == 0) {
                        i40e_error(i40e, "Device doesn't have ports or partitions");
                        return (NULL);
                }

Related issues

Related to illumos gate - Bug #9601: Divide by zero in i40e_get_available_resources()ClosedMarcel Telka2018-06-14

Actions

Also available in: Atom PDF