Skip to content

Commit 7bdd969

Browse files
XidianGeneralgregkh
authored andcommitted
char: ppdev: Fix a possible null-pointer dereference in pp_release()
In pp_release(), there is an if statement on line 730 to check whether pp->pdev is NULL: else if ((pp->flags & PP_CLAIMED) && pp->pdev && ...) When pp->pdev is NULL, it is used on line 743: info = &pp->pdev->port->ieee1284; and on line 748: parport_release(pp->pdev); Thus, a possible null-pointer dereference may occur. To fix this bug, pp->pdev is checked on line 740. This bug is found by a static analysis tool STCheck written by us. Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Link: https://lore.kernel.org/r/20190724090426.1401-1-baijiaju1990@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 092f47c commit 7bdd969

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/char/ppdev.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ static int pp_release(struct inode *inode, struct file *file)
737737
"negotiated back to compatibility mode because user-space forgot\n");
738738
}
739739

740-
if (pp->flags & PP_CLAIMED) {
740+
if ((pp->flags & PP_CLAIMED) && pp->pdev) {
741741
struct ieee1284_info *info;
742742

743743
info = &pp->pdev->port->ieee1284;

0 commit comments

Comments
 (0)