From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolai Stange Date: Fri, 09 Oct 2020 07:38:59 +0200 Subject: [PATCH net 000/117] net: avoid to remove module when its debugfs is being used In-Reply-To: (Taehee Yoo's message of "Fri, 9 Oct 2020 01:37:26 +0900") References: <20201008155048.17679-1-ap420073@gmail.com> <1cbb69d83188424e99b2d2482848ae64@AcuMS.aculab.com> <62f6c2bd11ed8b25c1cd4462ebc6db870adc4229.camel@sipsolutions.net> Message-ID: <87r1q8gdqk.fsf@suse.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Taehee Yoo Cc: Johannes Berg , David Laight , "davem@davemloft.net" , "kuba@kernel.org" , "netdev@vger.kernel.org" , Nicolai Stange , "linux-wireless@vger.kernel.org" , "wil6210@qti.qualcomm.com" , "brcm80211-dev-list@cypress.com" , "b43-dev@lists.infradead.org" , "linux-bluetooth@vger.kernel.org" Taehee Yoo writes: > On Fri, 9 Oct 2020 at 01:14, Johannes Berg wrote: > On Thu, 2020-10-08 at 15:59 +0000, David Laight wrote: > >> From: Taehee Yoo >> > Sent: 08 October 2020 16:49 >> > >> > When debugfs file is opened, its module should not be removed until >> > it's closed. >> > Because debugfs internally uses the module's data. >> > So, it could access freed memory. Yes, the file_operations' ->release() to be more specific -- that's not covered by debugfs' proxy fops. >> > In order to avoid panic, it just sets .owner to THIS_MODULE. >> > So that all modules will be held when its debugfs file is opened. >> >> Can't you fix it in common code? > >> Yeah I was just wondering that too - weren't the proxy_fops even already >> intended to fix this? > > I didn't try to fix this issue in the common code(debugfs). > Because I thought It's a typical pattern of panic and THIS_MODULE > can fix it clearly. > So I couldn't think there is a root reason in the common code. That's correct, ->owner should get set properly, c.f. my other mail in this thread. Thanks, Nicolai -- SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany (HRB 36809, AG N?rnberg), GF: Felix Imend?rffer