Skip to content

Commit

Permalink
NET: netpoll, fix potential NULL ptr dereference
Browse files Browse the repository at this point in the history
Stanse found that one error path in netpoll_setup dereferences npinfo
even though it is NULL. Avoid that by adding new label and go to that
instead.

Signed-off-by: Jiri Slaby <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: David S. Miller <[email protected]>
Acked-by: [email protected]
Acked-by: Matt Mackall <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jiri Slaby authored and davem330 committed Mar 16, 2010
1 parent a2f46ee commit 21edbb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ int netpoll_setup(struct netpoll *np)
npinfo = kmalloc(sizeof(*npinfo), GFP_KERNEL);
if (!npinfo) {
err = -ENOMEM;
goto release;
goto put;
}

npinfo->rx_flags = 0;
Expand Down Expand Up @@ -845,7 +845,7 @@ int netpoll_setup(struct netpoll *np)

kfree(npinfo);
}

put:
dev_put(ndev);
return err;
}
Expand Down

0 comments on commit 21edbb2

Please sign in to comment.