lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <Y9T8SION2vDlmaSa@kroah.com> Date: Sat, 28 Jan 2023 11:43:20 +0100 From: Greg KH <gregkh@...uxfoundation.org> To: Zhong Jinghua <zhongjinghua@...wei.com> Cc: jejb@...ux.ibm.com, martin.petersen@...cle.com, hare@...e.de, bvanassche@....org, emilne@...hat.com, linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org, yi.zhang@...wei.com, yukuai3@...wei.com Subject: Re: [PATCH-next v2 1/2] driver core: introduce get_device_unless_zero() On Sat, Jan 28, 2023 at 05:41:45PM +0800, Zhong Jinghua wrote: > When the dev reference count is 0, calling get_device will go from 0 to 1, You can NOT have a device reference count that is 0. If you do, you are doing something really really wrong, and there's a bug somewhere else. > which will cause errors in some place of the kernel. It's already an error in the kernel that tries to increment a reference count of 0 as that device is already freed and you are working with memory that is not present. > So introduce a > get_devcie_unless_zero method that returns NULL when the dev reference > count is 0. No, this is not ok, sorry, please never do this. Fix the caller. thanks, greg k-h
Powered by blists - more mailing lists