Skip to contentSkip to conversation

ibmaem: Prevent infinite probing loop on x3650 M2 systems

PATCH New Darrick J. Wong 1 participant 1 message Aug 13, 2008 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ibmaem: Prevent infinite probing loop on x3650 M2 systems

On older machines, probing for a nonexistent AEM interface returned an IPMI error; when we saw this, we'd stop probing. On the x3650 M2 and (presumably) later, we are returned a value indicating success and a buffer full of garbage or zeroes. This causes the probe function to run in an infinite loop. To fix this, we add one last check--if the interface number we're looking for is higher than the number of interfaces that AEM claims to have, stop probing.

---

 drivers/hwmon/ibmaem.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/hwmon/ibmaem.c +2 -1
index c1ee7dd..0f70dc2 100644
@@ -682,7 +682,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;