From: Kulikov Vasiliy Date: Wed, 11 Aug 2010 08:00:48 +0000 (+0400) Subject: staging: adis16255: fix sysfs leak X-Git-Tag: firefly_0821_release~7613^2~3583^2~3^2~760 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c7e62defd3c4a015b1f80a642bc320b9f9f3896c;p=firefly-linux-kernel-4.4.55.git staging: adis16255: fix sysfs leak Original code does not call sysfs_remove_group() on error. This can lead to NULL dereference. Signed-off-by: Kulikov Vasiliy Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/adis16255/adis16255.c b/drivers/staging/adis16255/adis16255.c index c3e6a4d5f334..8d4d7cbab979 100644 --- a/drivers/staging/adis16255/adis16255.c +++ b/drivers/staging/adis16255/adis16255.c @@ -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: