Skip to content

Commit

Permalink
proc: fix return value of proc_reg_open() in "too late" case
Browse files Browse the repository at this point in the history
If ->open() wasn't called, returning 0 is misleading and, theoretically,
oopsable:
1) remove_proc_entry clears ->proc_fops, drops lock,
2) ->open "succeeds",
3) ->release oopses, because it assumes ->open was called (single_release()).

Signed-off-by: Alexey Dobriyan <[email protected]>
  • Loading branch information
Alexey Dobriyan committed Oct 10, 2008
1 parent 3fa8749 commit 300b994
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/proc/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ static int proc_reg_open(struct inode *inode, struct file *file)
if (!pde->proc_fops) {
spin_unlock(&pde->pde_unload_lock);
kfree(pdeo);
return rv;
return -EINVAL;
}
pde->pde_users++;
open = pde->proc_fops->open;
Expand Down

0 comments on commit 300b994

Please sign in to comment.