[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20131227.124150.654187539741639427.davem@davemloft.net>
Date: Fri, 27 Dec 2013 12:41:50 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: levex@...ux.com
Cc: linux-kernel@...r.kernel.org, ursula.braun@...ibm.com,
linux390@...ibm.com, linux-s390@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH 20/38] net: iucv: add missing put_device call
From: Levente Kurusa <levex@...ux.com>
Date: Thu, 19 Dec 2013 16:03:31 +0100
> This is required so that we give up the last reference to the device.
>
> Signed-off-by: Levente Kurusa <levex@...ux.com>
...
> @@ -2377,8 +2377,10 @@ static int afiucv_iucv_init(void)
> af_iucv_dev->release = (void (*)(struct device *))kfree;
> af_iucv_dev->driver = &af_iucv_driver;
> err = device_register(af_iucv_dev);
> - if (err)
> + if (err) {
> + put_device(af_iucv_dev);
> goto out_driver;
> + }
This has the same problem as the ATM patch, there is no reference held on
af_iucv_dev, I mean look at where it comes from:
af_iucv_dev = kzalloc(sizeof(struct device), GFP_KERNEL);
...
dev_set_name(af_iucv_dev, "af_iucv");
af_iucv_dev->bus = pr_iucv->bus;
af_iucv_dev->parent = pr_iucv->root;
af_iucv_dev->release = (void (*)(struct device *))kfree;
af_iucv_dev->driver = &af_iucv_driver;
No reference count is incremented or set to one for af_iucv_dev.
Please study these code paths more carefully, thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists