x25_forward_call(): fix NULL dereferences
Subsystems (3)
PATCH 1/1 x25_forward_call(): fix NULL dereferences
This patch fixes two NULL dereferences spotted by the Coverity checker.
For a better understanding, the "diff -uwp" output (that ignores the indentation changes) is:
net/x25/x25_forward.c renamed from net/x25/x25_forward.c.old +4 -2
@@ -25,9 +25,10 @@ int x25_forward_call(struct x25_addressstruct sk_buff *skbn;short same_lci =0 ;int rc =0 ; -if ((rt =x25_get_route (dest_addr)) !=NULL ) { +if ((rt =x25_get_route (dest_addr)) ==NULL ) + goto out_no_route;if ((neigh_new =x25_get_neigh (rt->dev)) ==NULL ) {/* This shouldnt happen, if it occurs somehow * do something sensible
@@ -75,16 +76,17 @@ int x25_forward_call(struct x25_address goto out_put_nb; }x25_transmit_link (skbn, neigh_new); rc =1 ; - } out_put_nb:x25_neigh_put (neigh_new); out_put_route:x25_route_put (rt); + +out_no_route:return rc; }
Signed-off-by Adrian Bunk <[email protected]>
---
net/x25/x25_forward.c | 86 +++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 42 deletions(-)
net/x25/x25_forward.c renamed from net/x25/x25_forward.c.old +44 -42
108 lines not on this page · raw message
David Miller
maintainerFrom: Adrian Bunk <[email protected]>
Date: Mon, 19 Mar 2007 10:24:03 +0100
Quoted 4 lines
This patch fixes two NULL dereferences spotted by the Coverity checker.
For a better understanding, the "diff -uwp" output (that ignores the indentation changes) is:
I'll apply this, thanks Adrian.