]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ibmaem: prevent infinite probing loop on x3650 M2 systems
authorDarrick J. Wong <djwong@us.ibm.com>
Fri, 15 Aug 2008 07:40:40 +0000 (00:40 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Aug 2008 15:35:44 +0000 (08:35 -0700)
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.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/hwmon/ibmaem.c

index 5e4775a62f6cb25e888299662196b453f902f9b9..08c5179e6d846cdaacbe4207e29534d166e5dcc2 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;