Re: [PATCH] switchtec: cleanup cdev init

2017-02-21 Thread Jason Gunthorpe
On Sun, Feb 19, 2017 at 09:22:35PM -0700, Logan Gunthorpe wrote: > Really, in any situation where there's a cdev and a device in the same > structure, the life cycles of the two become linked but their reference > counts are not and that is the problem here. Yes, the cdev must hold a kref on the

Re: [PATCH] switchtec: cleanup cdev init

2017-02-21 Thread Jason Gunthorpe
On Sun, Feb 19, 2017 at 09:22:35PM -0700, Logan Gunthorpe wrote: > Really, in any situation where there's a cdev and a device in the same > structure, the life cycles of the two become linked but their reference > counts are not and that is the problem here. Yes, the cdev must hold a kref on the

Re: [PATCH] switchtec: cleanup cdev init

2017-02-19 Thread Logan Gunthorpe
On 19/02/17 02:43 PM, Dan Williams wrote: > Is this race present for all file operations? I've only seen it with > mmap() and late faults. So if these other drivers do not support mmap > it's not clear they can trigger the failure. I don't see how it's related to mmap only. I think there's a

Re: [PATCH] switchtec: cleanup cdev init

2017-02-19 Thread Logan Gunthorpe
On 19/02/17 02:43 PM, Dan Williams wrote: > Is this race present for all file operations? I've only seen it with > mmap() and late faults. So if these other drivers do not support mmap > it's not clear they can trigger the failure. I don't see how it's related to mmap only. I think there's a

Re: [PATCH] switchtec: cleanup cdev init

2017-02-19 Thread Dan Williams
On Sat, Feb 18, 2017 at 12:22 PM, Logan Gunthorpe wrote: > Hi, > > Please don't apply this patch and instead apply the switchtec driver as > we submitted in v2. As per the discussion in [1], not using the cdev's > kobj parent results in incorrect reference counting and a

Re: [PATCH] switchtec: cleanup cdev init

2017-02-19 Thread Dan Williams
On Sat, Feb 18, 2017 at 12:22 PM, Logan Gunthorpe wrote: > Hi, > > Please don't apply this patch and instead apply the switchtec driver as > we submitted in v2. As per the discussion in [1], not using the cdev's > kobj parent results in incorrect reference counting and a possible use > of the

Re: [PATCH] switchtec: cleanup cdev init

2017-02-18 Thread Logan Gunthorpe
Hi, Please don't apply this patch and instead apply the switchtec driver as we submitted in v2. As per the discussion in [1], not using the cdev's kobj parent results in incorrect reference counting and a possible use of the cdev after its containing structure is freed. I've also done a quick

Re: [PATCH] switchtec: cleanup cdev init

2017-02-18 Thread Logan Gunthorpe
Hi, Please don't apply this patch and instead apply the switchtec driver as we submitted in v2. As per the discussion in [1], not using the cdev's kobj parent results in incorrect reference counting and a possible use of the cdev after its containing structure is freed. I've also done a quick

[PATCH] switchtec: cleanup cdev init

2017-02-10 Thread Logan Gunthorpe
Per a suggestion from Greg Kroah-Hartman [1], don't set the cdev's kobject parent. This allows us to use device_register instead of init and add. [1] https://lkml.org/lkml/2017/2/10/370 --- drivers/pci/switch/switchtec.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff

[PATCH] switchtec: cleanup cdev init

2017-02-10 Thread Logan Gunthorpe
Per a suggestion from Greg Kroah-Hartman [1], don't set the cdev's kobject parent. This allows us to use device_register instead of init and add. [1] https://lkml.org/lkml/2017/2/10/370 --- drivers/pci/switch/switchtec.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff