debugfs: Return error during {full/open}_proxy_open() on rmmod
JIRA: https://issues.redhat.com/browse/RHEL-78837 Conflicts: * Considering already applied commit <95688800eefe> ("debugfs: don't mess with bits in ->d_fsdata") that changed full_proxy_open() to full_proxy_open_regular() commit 112cedc8e600b668688eb809bf11817adec58ddc Author: Sven Eckelmann <sven@narfation.org> Date: Mon, 2 Aug 2021 18:24:44 +0200 If a kernel module gets unloaded then it printed report about a leak before commit275678e7a9
("debugfs: Check module state before warning in {full/open}_proxy_open()"). An additional check was added in this commit to avoid this printing. But it was forgotten that the function must return an error in this case because it was not actually opened. As result, the systems started to crash or to hang when a module was unloaded while something was trying to open a file. Fixes:275678e7a9
("debugfs: Check module state before warning in {full/open}_proxy_open()") Cc: Taehee Yoo <ap420073@gmail.com> Reported-by: Mário Lopes <ml@simonwunderlich.de> Signed-off-by: Sven Eckelmann <sven@narfation.org> Link: https://lore.kernel.org/r/20210802162444.7848-1-sven@narfation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Desnes Nunes <desnesn@redhat.com>
This commit is contained in:
parent
baf5eaf224
commit
274f71d2bf
|
@ -318,8 +318,10 @@ static int open_proxy_open(struct inode *inode, struct file *filp)
|
|||
if (!fops_get(real_fops)) {
|
||||
#ifdef CONFIG_MODULES
|
||||
if (real_fops->owner &&
|
||||
real_fops->owner->state == MODULE_STATE_GOING)
|
||||
real_fops->owner->state == MODULE_STATE_GOING) {
|
||||
r = -ENXIO;
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Huh? Module did not clean up after itself at exit? */
|
||||
|
@ -459,8 +461,10 @@ static int full_proxy_open_regular(struct inode *inode, struct file *filp)
|
|||
if (!fops_get(real_fops)) {
|
||||
#ifdef CONFIG_MODULES
|
||||
if (real_fops->owner &&
|
||||
real_fops->owner->state == MODULE_STATE_GOING)
|
||||
real_fops->owner->state == MODULE_STATE_GOING) {
|
||||
r = -ENXIO;
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Huh? Module did not cleanup after itself at exit? */
|
||||
|
|
Loading…
Reference in New Issue