All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  8:03 ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  8:03 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: kernel-janitors, linux-kernel, Ben Skeggs, David Airlie, Kangjie Lu

> When gk20a_clk_ctor() returns an error code, pointer "clk"
> should be released.

Such an information is reasonable.


> It's the same when gm20b_clk_new() returns from elsewhere following this call.

I suggest to reconsider the interpretation of the software situation once more.
Can it be that the allocated clock object should be kept usable even after
a successful return from this function?


Would you like to add the tag “Fixes” to the commit message?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  8:03 ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  8:03 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> When gk20a_clk_ctor() returns an error code, pointer "clk"
> should be released.

Such an information is reasonable.


> It's the same when gm20b_clk_new() returns from elsewhere following this call.

I suggest to reconsider the interpretation of the software situation once more.
Can it be that the allocated clock object should be kept usable even after
a successful return from this function?


Would you like to add the tag “Fixes” to the commit message?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  8:03 ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  8:03 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> When gk20a_clk_ctor() returns an error code, pointer "clk"
> should be released.

Such an information is reasonable.


> It's the same when gm20b_clk_new() returns from elsewhere following this call.

I suggest to reconsider the interpretation of the software situation once more.
Can it be that the allocated clock object should be kept usable even after
a successful return from this function?


Would you like to add the tag “Fixes” to the commit message?

Regards,
Markus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-05-31  8:03 ` Markus Elfring
  (?)
@ 2020-05-31  8:23   ` dinghao.liu
  -1 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31  8:23 UTC (permalink / raw)
  To: Markus Elfring
  Cc: dri-devel, nouveau, kernel-janitors, linux-kernel, Ben Skeggs,
	David Airlie, Kangjie Lu

> 
> > It's the same when gm20b_clk_new() returns from elsewhere following this call.
> 
> I suggest to reconsider the interpretation of the software situation once more.
> Can it be that the allocated clock object should be kept usable even after
> a successful return from this function?
> 

It's possible that we expect an usable clk pointer, though I could not find
the exact usage yet. For security, I will release this pointer only on error 
paths in this function.

> 
> Would you like to add the tag “Fixes” to the commit message?
> 

Thank you for your advice! I will add this tag in the next version of patch.

Regards,
Dinghao

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  8:23   ` dinghao.liu
  0 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31  8:23 UTC (permalink / raw)
  To: Markus Elfring
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Ben Skeggs, Kangjie Lu

PiAKPiA+IEl0J3MgdGhlIHNhbWUgd2hlbiBnbTIwYl9jbGtfbmV3KCkgcmV0dXJucyBmcm9tIGVs
c2V3aGVyZSBmb2xsb3dpbmcgdGhpcyBjYWxsLgo+IAo+IEkgc3VnZ2VzdCB0byByZWNvbnNpZGVy
IHRoZSBpbnRlcnByZXRhdGlvbiBvZiB0aGUgc29mdHdhcmUgc2l0dWF0aW9uIG9uY2UgbW9yZS4K
PiBDYW4gaXQgYmUgdGhhdCB0aGUgYWxsb2NhdGVkIGNsb2NrIG9iamVjdCBzaG91bGQgYmUga2Vw
dCB1c2FibGUgZXZlbiBhZnRlcgo+IGEgc3VjY2Vzc2Z1bCByZXR1cm4gZnJvbSB0aGlzIGZ1bmN0
aW9uPwo+IAoKSXQncyBwb3NzaWJsZSB0aGF0IHdlIGV4cGVjdCBhbiB1c2FibGUgY2xrIHBvaW50
ZXIsIHRob3VnaCBJIGNvdWxkIG5vdCBmaW5kCnRoZSBleGFjdCB1c2FnZSB5ZXQuIEZvciBzZWN1
cml0eSwgSSB3aWxsIHJlbGVhc2UgdGhpcyBwb2ludGVyIG9ubHkgb24gZXJyb3IgCnBhdGhzIGlu
IHRoaXMgZnVuY3Rpb24uCgo+IAo+IFdvdWxkIHlvdSBsaWtlIHRvIGFkZCB0aGUgdGFnIOKAnEZp
eGVz4oCdIHRvIHRoZSBjb21taXQgbWVzc2FnZT8KPiAKClRoYW5rIHlvdSBmb3IgeW91ciBhZHZp
Y2UhIEkgd2lsbCBhZGQgdGhpcyB0YWcgaW4gdGhlIG5leHQgdmVyc2lvbiBvZiBwYXRjaC4KClJl
Z2FyZHMsCkRpbmdoYW8

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  8:23   ` dinghao.liu
  0 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31  8:23 UTC (permalink / raw)
  To: Markus Elfring
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Ben Skeggs, Kangjie Lu

> 
> > It's the same when gm20b_clk_new() returns from elsewhere following this call.
> 
> I suggest to reconsider the interpretation of the software situation once more.
> Can it be that the allocated clock object should be kept usable even after
> a successful return from this function?
> 

It's possible that we expect an usable clk pointer, though I could not find
the exact usage yet. For security, I will release this pointer only on error 
paths in this function.

> 
> Would you like to add the tag “Fixes” to the commit message?
> 

Thank you for your advice! I will add this tag in the next version of patch.

Regards,
Dinghao
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-05-31  8:23   ` dinghao.liu
  (?)
  (?)
@ 2020-05-31  8:38     ` Markus Elfring
  -1 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  8:38 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: kernel-janitors, linux-kernel, Ben Skeggs, David Airlie, Kangjie Lu

> It's possible that we expect an usable clk pointer, though I could not find
> the exact usage yet.

I am curious if another developer would like to add helpful background information.


> For security, I will release this pointer only on error paths in this function.

Do you tend to release objects (which are referenced by pointers)?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  8:38     ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  8:38 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> It's possible that we expect an usable clk pointer, though I could not find
> the exact usage yet.

I am curious if another developer would like to add helpful background information.


> For security, I will release this pointer only on error paths in this function.

Do you tend to release objects (which are referenced by pointers)?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  8:38     ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  8:38 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: David Airlie, Kangjie Lu, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ben Skeggs

> It's possible that we expect an usable clk pointer, though I could not find
> the exact usage yet.

I am curious if another developer would like to add helpful background information.


> For security, I will release this pointer only on error paths in this function.

Do you tend to release objects (which are referenced by pointers)?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  8:38     ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  8:38 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> It's possible that we expect an usable clk pointer, though I could not find
> the exact usage yet.

I am curious if another developer would like to add helpful background information.


> For security, I will release this pointer only on error paths in this function.

Do you tend to release objects (which are referenced by pointers)?

Regards,
Markus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-05-31  8:38     ` Markus Elfring
  (?)
@ 2020-05-31  8:52       ` dinghao.liu
  -1 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31  8:52 UTC (permalink / raw)
  To: Markus Elfring
  Cc: dri-devel, nouveau, kernel-janitors, linux-kernel, Ben Skeggs,
	David Airlie, Kangjie Lu

> 
> > For security, I will release this pointer only on error paths in this function.
> 
> Do you tend to release objects (which are referenced by pointers)?
> 

I just found that clk is referenced by pclk in this function. When clk is freed, 
pclk will be allocated in gm20b_clk_new_speedo0(). Thus we should not release clk
in this function and there is no bug here. Thank you for reminding me!

Regards,
Dinghao

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  8:52       ` dinghao.liu
  0 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31  8:52 UTC (permalink / raw)
  To: Markus Elfring
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Ben Skeggs, Kangjie Lu

PiAKPiA+IEZvciBzZWN1cml0eSwgSSB3aWxsIHJlbGVhc2UgdGhpcyBwb2ludGVyIG9ubHkgb24g
ZXJyb3IgcGF0aHMgaW4gdGhpcyBmdW5jdGlvbi4KPiAKPiBEbyB5b3UgdGVuZCB0byByZWxlYXNl
IG9iamVjdHMgKHdoaWNoIGFyZSByZWZlcmVuY2VkIGJ5IHBvaW50ZXJzKT8KPiAKCkkganVzdCBm
b3VuZCB0aGF0IGNsayBpcyByZWZlcmVuY2VkIGJ5IHBjbGsgaW4gdGhpcyBmdW5jdGlvbi4gV2hl
biBjbGsgaXMgZnJlZWQsIApwY2xrIHdpbGwgYmUgYWxsb2NhdGVkIGluIGdtMjBiX2Nsa19uZXdf
c3BlZWRvMCgpLiBUaHVzIHdlIHNob3VsZCBub3QgcmVsZWFzZSBjbGsKaW4gdGhpcyBmdW5jdGlv
biBhbmQgdGhlcmUgaXMgbm8gYnVnIGhlcmUuIFRoYW5rIHlvdSBmb3IgcmVtaW5kaW5nIG1lIQoK
UmVnYXJkcywKRGluZ2hhbw=

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  8:52       ` dinghao.liu
  0 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31  8:52 UTC (permalink / raw)
  To: Markus Elfring
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Ben Skeggs, Kangjie Lu

> 
> > For security, I will release this pointer only on error paths in this function.
> 
> Do you tend to release objects (which are referenced by pointers)?
> 

I just found that clk is referenced by pclk in this function. When clk is freed, 
pclk will be allocated in gm20b_clk_new_speedo0(). Thus we should not release clk
in this function and there is no bug here. Thank you for reminding me!

Regards,
Dinghao
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-05-31  8:52       ` dinghao.liu
  (?)
@ 2020-05-31  9:00         ` Markus Elfring
  -1 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  9:00 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: kernel-janitors, linux-kernel, Ben Skeggs, David Airlie, Kangjie Lu

> I just found that clk is referenced by pclk in this function. When clk is freed,
> pclk will be allocated in gm20b_clk_new_speedo0(). Thus we should not release clk
> in this function and there is no bug here.

Can there be a need to release a clock object after a failed gk20a_clk_ctor() call?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  9:00         ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  9:00 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> I just found that clk is referenced by pclk in this function. When clk is freed,
> pclk will be allocated in gm20b_clk_new_speedo0(). Thus we should not release clk
> in this function and there is no bug here.

Can there be a need to release a clock object after a failed gk20a_clk_ctor() call?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  9:00         ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  9:00 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> I just found that clk is referenced by pclk in this function. When clk is freed,
> pclk will be allocated in gm20b_clk_new_speedo0(). Thus we should not release clk
> in this function and there is no bug here.

Can there be a need to release a clock object after a failed gk20a_clk_ctor() call?

Regards,
Markus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-05-31  9:00         ` Markus Elfring
  (?)
@ 2020-05-31  9:15           ` dinghao.liu
  -1 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31  9:15 UTC (permalink / raw)
  To: Markus Elfring
  Cc: dri-devel, nouveau, kernel-janitors, linux-kernel, Ben Skeggs,
	David Airlie, Kangjie Lu

> > I just found that clk is referenced by pclk in this function. When clk is freed,
> > pclk will be allocated in gm20b_clk_new_speedo0(). Thus we should not release clk
> > in this function and there is no bug here.
> 
> Can there be a need to release a clock object after a failed gk20a_clk_ctor() call?
> 

I think this mainly depends on pclk pointer. It seems that the caller of 
gm20b_clk_new() always expects pclk to be allocated unless it returns -ENOMEM,
which means kzalloc() failed. If gk20a_clk_ctor() never returns such an error 
code, we may need not to release this clock object.

Regards,
Dinghao

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  9:15           ` dinghao.liu
  0 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31  9:15 UTC (permalink / raw)
  To: Markus Elfring
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Ben Skeggs, Kangjie Lu

PiA+IEkganVzdCBmb3VuZCB0aGF0IGNsayBpcyByZWZlcmVuY2VkIGJ5IHBjbGsgaW4gdGhpcyBm
dW5jdGlvbi4gV2hlbiBjbGsgaXMgZnJlZWQsCj4gPiBwY2xrIHdpbGwgYmUgYWxsb2NhdGVkIGlu
IGdtMjBiX2Nsa19uZXdfc3BlZWRvMCgpLiBUaHVzIHdlIHNob3VsZCBub3QgcmVsZWFzZSBjbGsK
PiA+IGluIHRoaXMgZnVuY3Rpb24gYW5kIHRoZXJlIGlzIG5vIGJ1ZyBoZXJlLgo+IAo+IENhbiB0
aGVyZSBiZSBhIG5lZWQgdG8gcmVsZWFzZSBhIGNsb2NrIG9iamVjdCBhZnRlciBhIGZhaWxlZCBn
azIwYV9jbGtfY3RvcigpIGNhbGw/Cj4gCgpJIHRoaW5rIHRoaXMgbWFpbmx5IGRlcGVuZHMgb24g
cGNsayBwb2ludGVyLiBJdCBzZWVtcyB0aGF0IHRoZSBjYWxsZXIgb2YgCmdtMjBiX2Nsa19uZXco
KSBhbHdheXMgZXhwZWN0cyBwY2xrIHRvIGJlIGFsbG9jYXRlZCB1bmxlc3MgaXQgcmV0dXJucyAt
RU5PTUVNLAp3aGljaCBtZWFucyBremFsbG9jKCkgZmFpbGVkLiBJZiBnazIwYV9jbGtfY3Rvcigp
IG5ldmVyIHJldHVybnMgc3VjaCBhbiBlcnJvciAKY29kZSwgd2UgbWF5IG5lZWQgbm90IHRvIHJl
bGVhc2UgdGhpcyBjbG9jayBvYmplY3QuCgpSZWdhcmRzLApEaW5naGFv

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  9:15           ` dinghao.liu
  0 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31  9:15 UTC (permalink / raw)
  To: Markus Elfring
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Ben Skeggs, Kangjie Lu

> > I just found that clk is referenced by pclk in this function. When clk is freed,
> > pclk will be allocated in gm20b_clk_new_speedo0(). Thus we should not release clk
> > in this function and there is no bug here.
> 
> Can there be a need to release a clock object after a failed gk20a_clk_ctor() call?
> 

I think this mainly depends on pclk pointer. It seems that the caller of 
gm20b_clk_new() always expects pclk to be allocated unless it returns -ENOMEM,
which means kzalloc() failed. If gk20a_clk_ctor() never returns such an error 
code, we may need not to release this clock object.

Regards,
Dinghao
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-05-31  9:15           ` dinghao.liu
  (?)
  (?)
@ 2020-05-31  9:51             ` Markus Elfring
  -1 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  9:51 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: kernel-janitors, linux-kernel, Ben Skeggs, David Airlie, Kangjie Lu

> If gk20a_clk_ctor() never returns such an error code,
> we may need not to release this clock object.

Would you like to achieve complete exception handling
also for this function implementation?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  9:51             ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  9:51 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> If gk20a_clk_ctor() never returns such an error code,
> we may need not to release this clock object.

Would you like to achieve complete exception handling
also for this function implementation?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  9:51             ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  9:51 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: David Airlie, Kangjie Lu, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ben Skeggs

> If gk20a_clk_ctor() never returns such an error code,
> we may need not to release this clock object.

Would you like to achieve complete exception handling
also for this function implementation?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31  9:51             ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31  9:51 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> If gk20a_clk_ctor() never returns such an error code,
> we may need not to release this clock object.

Would you like to achieve complete exception handling
also for this function implementation?

Regards,
Markus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-05-31  9:51             ` Markus Elfring
  (?)
@ 2020-05-31 10:42               ` dinghao.liu
  -1 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31 10:42 UTC (permalink / raw)
  To: Markus Elfring
  Cc: dri-devel, nouveau, kernel-janitors, linux-kernel, Ben Skeggs,
	David Airlie, Kangjie Lu

> > If gk20a_clk_ctor() never returns such an error code,
> > we may need not to release this clock object.
> 
> Would you like to achieve complete exception handling
> also for this function implementation?
> 

It seems that it's possible to get -ENOMEM from gk20a_clk_ctor().
The call chain is as follows:
gk20a_clk_ctor() <- nvkm_clk_ctor() <- nvkm_notify_init()

When nvkm_notify_init() returns -ENOMEM, all of its callers (and 
callers of callers) will be influenced if there is a failed
kzalloc inside which. 

In this case, maybe we should check the return value of 
gk20a_clk_ctor() and release clk if it returns -ENOMEM. 
And many other functions also have the same issue (e.g.,
gm20b_clk_new_speedo0). Do you have any idea about this 
problem?

Regards,
Dinghao

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31 10:42               ` dinghao.liu
  0 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31 10:42 UTC (permalink / raw)
  To: Markus Elfring
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Ben Skeggs, Kangjie Lu

PiA+IElmIGdrMjBhX2Nsa19jdG9yKCkgbmV2ZXIgcmV0dXJucyBzdWNoIGFuIGVycm9yIGNvZGUs
Cj4gPiB3ZSBtYXkgbmVlZCBub3QgdG8gcmVsZWFzZSB0aGlzIGNsb2NrIG9iamVjdC4KPiAKPiBX
b3VsZCB5b3UgbGlrZSB0byBhY2hpZXZlIGNvbXBsZXRlIGV4Y2VwdGlvbiBoYW5kbGluZwo+IGFs
c28gZm9yIHRoaXMgZnVuY3Rpb24gaW1wbGVtZW50YXRpb24/Cj4gCgpJdCBzZWVtcyB0aGF0IGl0
J3MgcG9zc2libGUgdG8gZ2V0IC1FTk9NRU0gZnJvbSBnazIwYV9jbGtfY3RvcigpLgpUaGUgY2Fs
bCBjaGFpbiBpcyBhcyBmb2xsb3dzOgpnazIwYV9jbGtfY3RvcigpIDwtIG52a21fY2xrX2N0b3Io
KSA8LSBudmttX25vdGlmeV9pbml0KCkKCldoZW4gbnZrbV9ub3RpZnlfaW5pdCgpIHJldHVybnMg
LUVOT01FTSwgYWxsIG9mIGl0cyBjYWxsZXJzIChhbmQgCmNhbGxlcnMgb2YgY2FsbGVycykgd2ls
bCBiZSBpbmZsdWVuY2VkIGlmIHRoZXJlIGlzIGEgZmFpbGVkCmt6YWxsb2MgaW5zaWRlIHdoaWNo
LiAKCkluIHRoaXMgY2FzZSwgbWF5YmUgd2Ugc2hvdWxkIGNoZWNrIHRoZSByZXR1cm4gdmFsdWUg
b2YgCmdrMjBhX2Nsa19jdG9yKCkgYW5kIHJlbGVhc2UgY2xrIGlmIGl0IHJldHVybnMgLUVOT01F
TS4gCkFuZCBtYW55IG90aGVyIGZ1bmN0aW9ucyBhbHNvIGhhdmUgdGhlIHNhbWUgaXNzdWUgKGUu
Zy4sCmdtMjBiX2Nsa19uZXdfc3BlZWRvMCkuIERvIHlvdSBoYXZlIGFueSBpZGVhIGFib3V0IHRo
aXMgCnByb2JsZW0/CgpSZWdhcmRzLApEaW5naGFv

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-05-31 10:42               ` dinghao.liu
  0 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-05-31 10:42 UTC (permalink / raw)
  To: Markus Elfring
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Ben Skeggs, Kangjie Lu

> > If gk20a_clk_ctor() never returns such an error code,
> > we may need not to release this clock object.
> 
> Would you like to achieve complete exception handling
> also for this function implementation?
> 

It seems that it's possible to get -ENOMEM from gk20a_clk_ctor().
The call chain is as follows:
gk20a_clk_ctor() <- nvkm_clk_ctor() <- nvkm_notify_init()

When nvkm_notify_init() returns -ENOMEM, all of its callers (and 
callers of callers) will be influenced if there is a failed
kzalloc inside which. 

In this case, maybe we should check the return value of 
gk20a_clk_ctor() and release clk if it returns -ENOMEM. 
And many other functions also have the same issue (e.g.,
gm20b_clk_new_speedo0). Do you have any idea about this 
problem?

Regards,
Dinghao
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leaks after failed gk20a_clk_ctor() calls
  2020-05-31 10:42               ` dinghao.liu
  (?)
  (?)
@ 2020-05-31 12:14                 ` Markus Elfring
  -1 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31 12:14 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: kernel-janitors, linux-kernel, Ben Skeggs, David Airlie, Kangjie Lu

> In this case, maybe we should check the return value of
> gk20a_clk_ctor() and release clk if it returns -ENOMEM.

All error situations (including failed memory allocations) can matter here.


> And many other functions also have the same issue
> (e.g. gm20b_clk_new_speedo0).

I recommend to increase the error detection and improve the desired
exception handling accordingly.

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leaks after failed gk20a_clk_ctor() calls
@ 2020-05-31 12:14                 ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31 12:14 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> In this case, maybe we should check the return value of
> gk20a_clk_ctor() and release clk if it returns -ENOMEM.

All error situations (including failed memory allocations) can matter here.


> And many other functions also have the same issue
> (e.g. gm20b_clk_new_speedo0).

I recommend to increase the error detection and improve the desired
exception handling accordingly.

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leaks after failed gk20a_clk_ctor() calls
@ 2020-05-31 12:14                 ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31 12:14 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: David Airlie, Kangjie Lu, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ben Skeggs

> In this case, maybe we should check the return value of
> gk20a_clk_ctor() and release clk if it returns -ENOMEM.

All error situations (including failed memory allocations) can matter here.


> And many other functions also have the same issue
> (e.g. gm20b_clk_new_speedo0).

I recommend to increase the error detection and improve the desired
exception handling accordingly.

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Fix memory leaks after failed gk20a_clk_ctor() calls
@ 2020-05-31 12:14                 ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-05-31 12:14 UTC (permalink / raw)
  To: Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> In this case, maybe we should check the return value of
> gk20a_clk_ctor() and release clk if it returns -ENOMEM.

All error situations (including failed memory allocations) can matter here.


> And many other functions also have the same issue
> (e.g. gm20b_clk_new_speedo0).

I recommend to increase the error detection and improve the desired
exception handling accordingly.

Regards,
Markus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-05-31  8:23   ` dinghao.liu
  (?)
  (?)
@ 2020-06-02 10:29     ` Dan Carpenter
  -1 siblings, 0 replies; 47+ messages in thread
From: Dan Carpenter @ 2020-06-02 10:29 UTC (permalink / raw)
  To: dinghao.liu
  Cc: Markus Elfring, dri-devel, nouveau, kernel-janitors,
	linux-kernel, Ben Skeggs, David Airlie, Kangjie Lu

The original patch was basically fine.  Just add a Fixes tag and resend.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-06-02 10:29     ` Dan Carpenter
  0 siblings, 0 replies; 47+ messages in thread
From: Dan Carpenter @ 2020-06-02 10:29 UTC (permalink / raw)
  To: dinghao.liu
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Markus Elfring, Ben Skeggs, Kangjie Lu

The original patch was basically fine.  Just add a Fixes tag and resend.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-06-02 10:29     ` Dan Carpenter
  0 siblings, 0 replies; 47+ messages in thread
From: Dan Carpenter @ 2020-06-02 10:29 UTC (permalink / raw)
  To: dinghao.liu-Y5EWUtBUdg4nDS1+zs4M5A
  Cc: David Airlie, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Markus Elfring,
	Ben Skeggs, Kangjie Lu

The original patch was basically fine.  Just add a Fixes tag and resend.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-06-02 10:29     ` Dan Carpenter
  0 siblings, 0 replies; 47+ messages in thread
From: Dan Carpenter @ 2020-06-02 10:29 UTC (permalink / raw)
  To: dinghao.liu
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Markus Elfring, Ben Skeggs, Kangjie Lu

The original patch was basically fine.  Just add a Fixes tag and resend.

regards,
dan carpenter

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-06-02 10:29     ` Dan Carpenter
  (?)
  (?)
@ 2020-06-02 11:10       ` Markus Elfring
  -1 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-06-02 11:10 UTC (permalink / raw)
  To: Dan Carpenter, Dinghao Liu, dri-devel, nouveau
  Cc: kernel-janitors, linux-kernel, Ben Skeggs, David Airlie, Kangjie Lu

> The original patch was basically fine.

I propose to reconsider the interpretation of the software situation once more.

* Should the allocated clock object be kept usable even after
  a successful return from this function?

* How much do “destructor” calls matter here for (sub)devices?


> Just add a Fixes tag and resend.

This tag can help also.

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-06-02 11:10       ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-06-02 11:10 UTC (permalink / raw)
  To: Dan Carpenter, Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> The original patch was basically fine.

I propose to reconsider the interpretation of the software situation once more.

* Should the allocated clock object be kept usable even after
  a successful return from this function?

* How much do “destructor” calls matter here for (sub)devices?


> Just add a Fixes tag and resend.

This tag can help also.

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-06-02 11:10       ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-06-02 11:10 UTC (permalink / raw)
  To: Dan Carpenter, Dinghao Liu,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: David Airlie, Kangjie Lu, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ben Skeggs

> The original patch was basically fine.

I propose to reconsider the interpretation of the software situation once more.

* Should the allocated clock object be kept usable even after
  a successful return from this function?

* How much do “destructor” calls matter here for (sub)devices?


> Just add a Fixes tag and resend.

This tag can help also.

Regards,
Markus
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-06-02 11:10       ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-06-02 11:10 UTC (permalink / raw)
  To: Dan Carpenter, Dinghao Liu, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> The original patch was basically fine.

I propose to reconsider the interpretation of the software situation once more.

* Should the allocated clock object be kept usable even after
  a successful return from this function?

* How much do “destructor” calls matter here for (sub)devices?


> Just add a Fixes tag and resend.

This tag can help also.

Regards,
Markus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-06-02 11:10       ` Markus Elfring
  (?)
@ 2020-06-02 15:39         ` Dan Carpenter
  -1 siblings, 0 replies; 47+ messages in thread
From: Dan Carpenter @ 2020-06-02 15:39 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Dinghao Liu, dri-devel, nouveau, kernel-janitors, linux-kernel,
	Ben Skeggs, David Airlie, Kangjie Lu

On Tue, Jun 02, 2020 at 01:10:34PM +0200, Markus Elfring wrote:
> > The original patch was basically fine.
> 
> I propose to reconsider the interpretation of the software situation once more.
> 
> * Should the allocated clock object be kept usable even after
>   a successful return from this function?

Heh.  You're right.  The patch is freeing "clk" on the success path so
that doesn't work.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-06-02 15:39         ` Dan Carpenter
  0 siblings, 0 replies; 47+ messages in thread
From: Dan Carpenter @ 2020-06-02 15:39 UTC (permalink / raw)
  To: Markus Elfring
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Ben Skeggs, Dinghao Liu, Kangjie Lu

On Tue, Jun 02, 2020 at 01:10:34PM +0200, Markus Elfring wrote:
> > The original patch was basically fine.
> 
> I propose to reconsider the interpretation of the software situation once more.
> 
> * Should the allocated clock object be kept usable even after
>   a successful return from this function?

Heh.  You're right.  The patch is freeing "clk" on the success path so
that doesn't work.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-06-02 15:39         ` Dan Carpenter
  0 siblings, 0 replies; 47+ messages in thread
From: Dan Carpenter @ 2020-06-02 15:39 UTC (permalink / raw)
  To: Markus Elfring
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Ben Skeggs, Dinghao Liu, Kangjie Lu

On Tue, Jun 02, 2020 at 01:10:34PM +0200, Markus Elfring wrote:
> > The original patch was basically fine.
> 
> I propose to reconsider the interpretation of the software situation once more.
> 
> * Should the allocated clock object be kept usable even after
>   a successful return from this function?

Heh.  You're right.  The patch is freeing "clk" on the success path so
that doesn't work.

regards,
dan carpenter

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
  2020-06-02 15:39         ` Dan Carpenter
  (?)
@ 2020-06-03  2:21           ` dinghao.liu
  -1 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-06-03  2:21 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Markus Elfring, dri-devel, nouveau, kernel-janitors,
	linux-kernel, Ben Skeggs, David Airlie, Kangjie Lu


> On Tue, Jun 02, 2020 at 01:10:34PM +0200, Markus Elfring wrote:
> > > The original patch was basically fine.
> > 
> > I propose to reconsider the interpretation of the software situation once more.
> > 
> > * Should the allocated clock object be kept usable even after
> >   a successful return from this function?
> 
> Heh.  You're right.  The patch is freeing "clk" on the success path so
> that doesn't work.
> 

Ben has explained this problem:
https://lore.kernel.org/patchwork/patch/1249592/
Since the caller will check "pclk" on failure, we don't need to free
"clk" in gm20b_clk_new() and I think this patch is no longer needed.

Regards,
Dinghao

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-06-03  2:21           ` dinghao.liu
  0 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-06-03  2:21 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Markus Elfring, Ben Skeggs, Kangjie Lu

Cj4gT24gVHVlLCBKdW4gMDIsIDIwMjAgYXQgMDE6MTA6MzRQTSArMDIwMCwgTWFya3VzIEVsZnJp
bmcgd3JvdGU6Cj4gPiA+IFRoZSBvcmlnaW5hbCBwYXRjaCB3YXMgYmFzaWNhbGx5IGZpbmUuCj4g
PiAKPiA+IEkgcHJvcG9zZSB0byByZWNvbnNpZGVyIHRoZSBpbnRlcnByZXRhdGlvbiBvZiB0aGUg
c29mdHdhcmUgc2l0dWF0aW9uIG9uY2UgbW9yZS4KPiA+IAo+ID4gKiBTaG91bGQgdGhlIGFsbG9j
YXRlZCBjbG9jayBvYmplY3QgYmUga2VwdCB1c2FibGUgZXZlbiBhZnRlcgo+ID4gICBhIHN1Y2Nl
c3NmdWwgcmV0dXJuIGZyb20gdGhpcyBmdW5jdGlvbj8KPiAKPiBIZWguICBZb3UncmUgcmlnaHQu
ICBUaGUgcGF0Y2ggaXMgZnJlZWluZyAiY2xrIiBvbiB0aGUgc3VjY2VzcyBwYXRoIHNvCj4gdGhh
dCBkb2Vzbid0IHdvcmsuCj4gCgpCZW4gaGFzIGV4cGxhaW5lZCB0aGlzIHByb2JsZW06Cmh0dHBz
Oi8vbG9yZS5rZXJuZWwub3JnL3BhdGNod29yay9wYXRjaC8xMjQ5NTkyLwpTaW5jZSB0aGUgY2Fs
bGVyIHdpbGwgY2hlY2sgInBjbGsiIG9uIGZhaWx1cmUsIHdlIGRvbid0IG5lZWQgdG8gZnJlZQoi
Y2xrIiBpbiBnbTIwYl9jbGtfbmV3KCkgYW5kIEkgdGhpbmsgdGhpcyBwYXRjaCBpcyBubyBsb25n
ZXIgbmVlZGVkLgoKUmVnYXJkcywKRGluZ2hhbw=

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new()
@ 2020-06-03  2:21           ` dinghao.liu
  0 siblings, 0 replies; 47+ messages in thread
From: dinghao.liu @ 2020-06-03  2:21 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David Airlie, nouveau, kernel-janitors, linux-kernel, dri-devel,
	Markus Elfring, Ben Skeggs, Kangjie Lu


> On Tue, Jun 02, 2020 at 01:10:34PM +0200, Markus Elfring wrote:
> > > The original patch was basically fine.
> > 
> > I propose to reconsider the interpretation of the software situation once more.
> > 
> > * Should the allocated clock object be kept usable even after
> >   a successful return from this function?
> 
> Heh.  You're right.  The patch is freeing "clk" on the success path so
> that doesn't work.
> 

Ben has explained this problem:
https://lore.kernel.org/patchwork/patch/1249592/
Since the caller will check "pclk" on failure, we don't need to free
"clk" in gm20b_clk_new() and I think this patch is no longer needed.

Regards,
Dinghao
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Understanding challenges around gm20b_clk_new()
  2020-06-03  2:21           ` dinghao.liu
  (?)
@ 2020-06-03  5:04             ` Markus Elfring
  -1 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-06-03  5:04 UTC (permalink / raw)
  To: Dinghao Liu, Dan Carpenter, dri-devel, nouveau
  Cc: kernel-janitors, linux-kernel, Ben Skeggs, David Airlie, Kangjie Lu

> Ben has explained this problem:
> https://lore.kernel.org/patchwork/patch/1249592/
> Since the caller will check "pclk" on failure, we don't need to free
> "clk" in gm20b_clk_new() and I think this patch is no longer needed.

* I am curious if it can become easier to see the relationships for
  these variables according to mentioned “destructor” calls.

* Did you notice opportunities to improve source code analysis
  (or software documentation) accordingly?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Understanding challenges around gm20b_clk_new()
@ 2020-06-03  5:04             ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-06-03  5:04 UTC (permalink / raw)
  To: Dinghao Liu, Dan Carpenter, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> Ben has explained this problem:
> https://lore.kernel.org/patchwork/patch/1249592/
> Since the caller will check "pclk" on failure, we don't need to free
> "clk" in gm20b_clk_new() and I think this patch is no longer needed.

* I am curious if it can become easier to see the relationships for
  these variables according to mentioned “destructor” calls.

* Did you notice opportunities to improve source code analysis
  (or software documentation) accordingly?

Regards,
Markus

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: drm/nouveau/clk/gm20b: Understanding challenges around gm20b_clk_new()
@ 2020-06-03  5:04             ` Markus Elfring
  0 siblings, 0 replies; 47+ messages in thread
From: Markus Elfring @ 2020-06-03  5:04 UTC (permalink / raw)
  To: Dinghao Liu, Dan Carpenter, dri-devel, nouveau
  Cc: David Airlie, Kangjie Lu, kernel-janitors, linux-kernel, Ben Skeggs

> Ben has explained this problem:
> https://lore.kernel.org/patchwork/patch/1249592/
> Since the caller will check "pclk" on failure, we don't need to free
> "clk" in gm20b_clk_new() and I think this patch is no longer needed.

* I am curious if it can become easier to see the relationships for
  these variables according to mentioned “destructor” calls.

* Did you notice opportunities to improve source code analysis
  (or software documentation) accordingly?

Regards,
Markus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2020-06-03  7:05 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-31  8:03 [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new() Markus Elfring
2020-05-31  8:03 ` Markus Elfring
2020-05-31  8:03 ` Markus Elfring
2020-05-31  8:23 ` dinghao.liu
2020-05-31  8:23   ` dinghao.liu
2020-05-31  8:23   ` dinghao.liu
2020-05-31  8:38   ` Markus Elfring
2020-05-31  8:38     ` Markus Elfring
2020-05-31  8:38     ` Markus Elfring
2020-05-31  8:38     ` Markus Elfring
2020-05-31  8:52     ` dinghao.liu
2020-05-31  8:52       ` dinghao.liu
2020-05-31  8:52       ` dinghao.liu
2020-05-31  9:00       ` Markus Elfring
2020-05-31  9:00         ` Markus Elfring
2020-05-31  9:00         ` Markus Elfring
2020-05-31  9:15         ` dinghao.liu
2020-05-31  9:15           ` dinghao.liu
2020-05-31  9:15           ` dinghao.liu
2020-05-31  9:51           ` Markus Elfring
2020-05-31  9:51             ` Markus Elfring
2020-05-31  9:51             ` Markus Elfring
2020-05-31  9:51             ` Markus Elfring
2020-05-31 10:42             ` dinghao.liu
2020-05-31 10:42               ` dinghao.liu
2020-05-31 10:42               ` dinghao.liu
2020-05-31 12:14               ` drm/nouveau/clk/gm20b: Fix memory leaks after failed gk20a_clk_ctor() calls Markus Elfring
2020-05-31 12:14                 ` Markus Elfring
2020-05-31 12:14                 ` Markus Elfring
2020-05-31 12:14                 ` Markus Elfring
2020-06-02 10:29   ` Re: [PATCH] drm/nouveau/clk/gm20b: Fix memory leak in gm20b_clk_new() Dan Carpenter
2020-06-02 10:29     ` Dan Carpenter
2020-06-02 10:29     ` Dan Carpenter
2020-06-02 10:29     ` Dan Carpenter
2020-06-02 11:10     ` Markus Elfring
2020-06-02 11:10       ` Markus Elfring
2020-06-02 11:10       ` Markus Elfring
2020-06-02 11:10       ` Markus Elfring
2020-06-02 15:39       ` Dan Carpenter
2020-06-02 15:39         ` Dan Carpenter
2020-06-02 15:39         ` Dan Carpenter
2020-06-03  2:21         ` dinghao.liu
2020-06-03  2:21           ` dinghao.liu
2020-06-03  2:21           ` dinghao.liu
2020-06-03  5:04           ` drm/nouveau/clk/gm20b: Understanding challenges around gm20b_clk_new() Markus Elfring
2020-06-03  5:04             ` Markus Elfring
2020-06-03  5:04             ` Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.