Re: [PATCH 07/14] infiniband: utilize new device_add_cdev helper function

2017-02-22 Thread Lars-Peter Clausen
On 02/22/2017 12:54 AM, Logan Gunthorpe wrote: [...] >> >> Ah, this needs more help. Once device_initialize is called put_device >> should be the error-unwind, can you use something more like this? > > Is that true? Once device_register or device_add is called then you need > to use put_device. [.

Re: [PATCH 07/14] infiniband: utilize new device_add_cdev helper function

2017-02-21 Thread Jason Gunthorpe
On Tue, Feb 21, 2017 at 04:54:05PM -0700, Logan Gunthorpe wrote: > Is that true? Once device_register or device_add is called then you need > to use put_device. General rule is once kref_init has been called then you should use kref_put and not kfree. device_initialize ultimately calls kref_init

Re: [PATCH 07/14] infiniband: utilize new device_add_cdev helper function

2017-02-21 Thread Logan Gunthorpe
On 21/02/17 12:09 PM, Jason Gunthorpe wrote: > On Mon, Feb 20, 2017 at 10:00:46PM -0700, Logan Gunthorpe wrote: >> This patch updates core/ucm.c which didn't originally use the >> cdev.kobj.parent with it's parent device. I did not look heavily into >> whether this was a bug or not, but it seems

Re: [PATCH 07/14] infiniband: utilize new device_add_cdev helper function

2017-02-21 Thread Jason Gunthorpe
On Mon, Feb 20, 2017 at 10:00:46PM -0700, Logan Gunthorpe wrote: > This patch updates core/ucm.c which didn't originally use the > cdev.kobj.parent with it's parent device. I did not look heavily into > whether this was a bug or not, but it seems likely to me there would > be a use before free. Hu

[PATCH 07/14] infiniband: utilize new device_add_cdev helper function

2017-02-20 Thread Logan Gunthorpe
This patch updates core/ucm.c which didn't originally use the cdev.kobj.parent with it's parent device. I did not look heavily into whether this was a bug or not, but it seems likely to me there would be a use before free. I also took a look at core/uverbs_main.c, core/user_mad.c and hw/hfi1/devic