Linux-EDAC Archive on lore.kernel.org
 help / color / Atom feed
* Re: [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
@ 2020-05-29  9:20 Markus Elfring
  2020-05-29  9:36 ` Borislav Petkov
  0 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2020-05-29  9:20 UTC (permalink / raw)
  To: Qiushi Wu, linux-edac
  Cc: linux-kernel, kernel-janitors, Borislav Petkov, Doug Thompson,
	Greg Kroah-Hartman, James Morse, Kangjie Lu,
	Mauro Carvalho Chehab, Robert Richter, Tony Luck

…
> +++ b/drivers/edac/edac_device_sysfs.c
> @@ -275,6 +275,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
>
>  	/* Error exit stack */
>  err_kobj_reg:
> +	kobject_put(&edac_dev->kobj);
>  	module_put(edac_dev->owner);
>
>  err_out:

I suggest to modify the affected source code in a different way.

* The label “err_out” can be replaced by direct return statement,
  can't it?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=75caf310d16cc5e2f851c048cd597f5437013368#n456

* I interpret the function implementation in the way
  that that there is only one if branch where clean-up of
  system resources is needed.
  Thus I would prefer to specify corresponding complete exception handling
  directly at this place (instead of using the goto statement).

Regards,
Markus

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

* Re: [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
  2020-05-29  9:20 [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj() Markus Elfring
@ 2020-05-29  9:36 ` Borislav Petkov
  2020-05-29  9:40   ` Markus Elfring
  0 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2020-05-29  9:36 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Qiushi Wu, linux-edac, linux-kernel, kernel-janitors,
	Doug Thompson, Greg Kroah-Hartman, James Morse, Kangjie Lu,
	Mauro Carvalho Chehab, Robert Richter, Tony Luck

On Fri, May 29, 2020 at 11:20:42AM +0200, Markus Elfring wrote:
> * The label “err_out” can be replaced by direct return statement,
>   can't it?

No, it cannot. It keeps the error handling code out-of-line so that the
function body remains readable.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
  2020-05-29  9:36 ` Borislav Petkov
@ 2020-05-29  9:40   ` Markus Elfring
  2020-05-29  9:47     ` Borislav Petkov
  0 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2020-05-29  9:40 UTC (permalink / raw)
  To: Borislav Petkov, linux-edac
  Cc: linux-kernel, kernel-janitors, Doug Thompson, Greg Kroah-Hartman,
	James Morse, Kangjie Lu, Mauro Carvalho Chehab, Qiushi Wu,
	Robert Richter, Tony Luck

>> * The label “err_out” can be replaced by direct return statement,
>>   can't it?
>
> No, it cannot. It keeps the error handling code out-of-line so that the
> function body remains readable.

Have we got different programming expectations also around the application
of the Linux coding style?

Regards,
Markus

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

* Re: [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
  2020-05-29  9:40   ` Markus Elfring
@ 2020-05-29  9:47     ` Borislav Petkov
  2020-05-29 10:40       ` Markus Elfring
  0 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2020-05-29  9:47 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-edac, linux-kernel, kernel-janitors, Doug Thompson,
	Greg Kroah-Hartman, James Morse, Kangjie Lu,
	Mauro Carvalho Chehab, Qiushi Wu, Robert Richter, Tony Luck

On Fri, May 29, 2020 at 11:40:47AM +0200, Markus Elfring wrote:
> Have we got different programming expectations also around the application
> of the Linux coding style?

We have me stopping you from giving new submitters wrong review and bad
advice.

Please refrain from "reviewing" EDAC patches!

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
  2020-05-29  9:47     ` Borislav Petkov
@ 2020-05-29 10:40       ` Markus Elfring
  2020-05-29 11:50         ` Borislav Petkov
  0 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2020-05-29 10:40 UTC (permalink / raw)
  To: Borislav Petkov, linux-edac
  Cc: linux-kernel, kernel-janitors, Doug Thompson, Greg Kroah-Hartman,
	James Morse, Kangjie Lu, Mauro Carvalho Chehab, Qiushi Wu,
	Robert Richter, Tony Luck

> We have me stopping you from giving new submitters wrong review

I do not find my suggestions wrong for this issue.


> and bad advice.

But I can understand that we might occasionally prefer other software development approaches.


> Please refrain from "reviewing" EDAC patches!

Would you prefer to clarify any remaining adjustments from my selection
of change possibilities?
https://lore.kernel.org/linux-edac/3cf2076e-6394-4997-613d-cbf5b6dbee1e@web.de/
https://lore.kernel.org/patchwork/patch/1130412/
https://lkml.org/lkml/2019/9/21/121

Regards,
Markus

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

* Re: edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
  2020-05-29 10:40       ` Markus Elfring
@ 2020-05-29 11:50         ` Borislav Petkov
  0 siblings, 0 replies; 8+ messages in thread
From: Borislav Petkov @ 2020-05-29 11:50 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-edac, linux-kernel, kernel-janitors, Doug Thompson,
	Greg Kroah-Hartman, James Morse, Kangjie Lu,
	Mauro Carvalho Chehab, Qiushi Wu, Robert Richter, Tony Luck

Which part of

	"Please refrain from "reviewing" EDAC patches!"

don't you understand?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
  2020-05-29  8:45 [PATCH] " Markus Elfring
@ 2020-05-29  9:08 ` Borislav Petkov
  0 siblings, 0 replies; 8+ messages in thread
From: Borislav Petkov @ 2020-05-29  9:08 UTC (permalink / raw)
  To: Markus Elfring, Qiushi Wu
  Cc: linux-edac, kernel-janitors, linux-kernel, Doug Thompson,
	Greg Kroah-Hartman, James Morse, Kangjie Lu,
	Mauro Carvalho Chehab, Robert Richter, Tony Luck

On Fri, May 29, 2020 at 10:45:08AM +0200, Markus Elfring wrote:
> Would you like to indicate with such information (according to
> the topic “net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject”)
> that your issue was detected also with the help of the kernel fuzzing
> tool “syzkaller”?

There's no need for any commt reference - there's text over
kobject_init_and_add() explaining what you need to do when that function
fails.

> How do you think about to add an imperative wording to the change description?

His commit message is fine.

> Will it be helpful to combine this update step together with
> “edac: Fix reference count leak in edac_pci_main_kobj_setup”
> into a small patch series?

Just combine them into one patch.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
@ 2020-05-29  8:45 Markus Elfring
  2020-05-29  9:08 ` Borislav Petkov
  0 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2020-05-29  8:45 UTC (permalink / raw)
  To: Qiushi Wu, linux-edac
  Cc: kernel-janitors, linux-kernel, Borislav Petkov, Doug Thompson,
	Greg Kroah-Hartman, James Morse, Kangjie Lu,
	Mauro Carvalho Chehab, Robert Richter, Tony Luck

> object_init_and_add() should be handled when it return an error,
> because kobject_init_and_add() takes reference even when it fails.

I find this wording approach improvable.


> Previous commit "b8eb718348b8" fixed a similar problem.

Would you like to indicate with such information (according to
the topic “net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject”)
that your issue was detected also with the help of the kernel fuzzing
tool “syzkaller”?


How do you think about to add an imperative wording to the change description?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=b0c3ba31be3e45a130e13b278cf3b90f69bda6f6#n151


Will it be helpful to combine this update step together with
“edac: Fix reference count leak in edac_pci_main_kobj_setup”
into a small patch series?
https://lore.kernel.org/lkml/20200528202238.18078-1-wu000273@umn.edu/
https://lore.kernel.org/patchwork/patch/1249351/

Regards,
Markus

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

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29  9:20 [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj() Markus Elfring
2020-05-29  9:36 ` Borislav Petkov
2020-05-29  9:40   ` Markus Elfring
2020-05-29  9:47     ` Borislav Petkov
2020-05-29 10:40       ` Markus Elfring
2020-05-29 11:50         ` Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2020-05-29  8:45 [PATCH] " Markus Elfring
2020-05-29  9:08 ` Borislav Petkov

Linux-EDAC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-edac/0 linux-edac/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-edac linux-edac/ https://lore.kernel.org/linux-edac \
		linux-edac@vger.kernel.org
	public-inbox-index linux-edac

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-edac


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git