staging: adis16255: fix sysfs leak
authorKulikov Vasiliy <segooon@gmail.com>
Wed, 11 Aug 2010 08:00:48 +0000 (12:00 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 31 Aug 2010 21:51:53 +0000 (14:51 -0700)
Original code does not call sysfs_remove_group() on error. This can lead
to NULL dereference.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/adis16255/adis16255.c

index c3e6a4d5f33429ff76cdc001192259fe60a6fc59..8d4d7cbab979e8d298990d950594f6296a3eed12 100644 (file)
@@ -406,12 +406,14 @@ static int __devinit spi_adis16255_probe(struct spi_device *spi)
 
        status = spi_adis16255_bringup(spiadis);
        if (status != 0)
-               goto irq_err;
+               goto sysfs_err;
 
        dev_info(&spi->dev, "spi_adis16255 driver added!\n");
 
        return status;
 
+sysfs_err:
+       sysfs_remove_group(&spiadis->spi->dev.kobj, &adis16255_attr_group);
 irq_err:
        free_irq(spiadis->irq, spiadis);
 gpio_err: