[PATCH 09/12] pps: fix device destruction ordering

From: Konstantin Khlebnikov
Date: Fri Dec 14 2012 - 06:03:51 EST


device_destroy() calls final kfree(), thus cdev_del() must be called before it.
Catched as overwritten poison in kmalloc-512.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxx>
Cc: Rodolfo Giometti <giometti@xxxxxxxxxxxx>
---
drivers/pps/pps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 2420d5a..769bb84 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -352,8 +352,8 @@ free_idr:

void pps_unregister_cdev(struct pps_device *pps)
{
- device_destroy(pps_class, pps->dev->devt);
cdev_del(&pps->cdev);
+ device_destroy(pps_class, pps->dev->devt);
}

/*

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/