ibmaem: prevent infinite probing loop on x3650 M2 systems
[safe/jmp/linux-2.6] / drivers / hwmon / ibmaem.c
index 5e4775a..08c5179 100644 (file)
@@ -676,7 +676,8 @@ static int aem_find_aem2(struct aem_ipmi_data *data,
                return -ETIMEDOUT;
 
        if (data->rx_result || data->rx_msg_len != sizeof(*fi_resp) ||
-           memcmp(&fi_resp->id, &system_x_id, sizeof(system_x_id)))
+           memcmp(&fi_resp->id, &system_x_id, sizeof(system_x_id)) ||
+           fi_resp->num_instances <= instance_num)
                return -ENOENT;
 
        return 0;