ipmi: Fix NULL pointer dereference in ssif_probe
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Fri, 31 Aug 2018 15:00:34 +0000 (10:00 -0500)
committerCorey Minyard <cminyard@mvista.com>
Fri, 31 Aug 2018 19:13:56 +0000 (14:13 -0500)
There is a potential execution path in which function ssif_info_find()
returns NULL, hence there is a NULL pointer dereference when accessing
pointer *addr_info*

Fix this by null checking *addr_info* before dereferencing it.

Addresses-Coverity-ID: 1473145 ("Explicit null dereferenced")
Fixes: e333054a91d1 ("ipmi: Fix I2C client removal in the SSIF driver")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
drivers/char/ipmi/ipmi_ssif.c

index 265d6a6583bc547971ad41e009906f5c95163b65..29e67a80fb208f804e4ed1fb0a560142002c7ffc 100644 (file)
@@ -1643,7 +1643,9 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
 
  out:
        if (rv) {
-               addr_info->client = NULL;
+               if (addr_info)
+                       addr_info->client = NULL;
+
                dev_err(&client->dev, "Unable to start IPMI SSIF: %d\n", rv);
                kfree(ssif_info);
        }