Skip to content

Commit 472a989

Browse files
joehattoriherbertx
authored andcommitted
crypto: ixp4xx - fix OF node reference leaks in init_ixp_crypto()
init_ixp_crypto() calls of_parse_phandle_with_fixed_args() multiple times, but does not release all the obtained refcounts. Fix it by adding of_node_put() calls. This bug was found by an experimental static analysis tool that I am developing. Fixes: 76f24b4 ("crypto: ixp4xx - Add device tree support") Signed-off-by: Joe Hattori <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent a5a9d95 commit 472a989

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ static int init_ixp_crypto(struct device *dev)
471471
return -ENODEV;
472472
}
473473
npe_id = npe_spec.args[0];
474+
of_node_put(npe_spec.np);
474475

475476
ret = of_parse_phandle_with_fixed_args(np, "queue-rx", 1, 0,
476477
&queue_spec);
@@ -479,6 +480,7 @@ static int init_ixp_crypto(struct device *dev)
479480
return -ENODEV;
480481
}
481482
recv_qid = queue_spec.args[0];
483+
of_node_put(queue_spec.np);
482484

483485
ret = of_parse_phandle_with_fixed_args(np, "queue-txready", 1, 0,
484486
&queue_spec);
@@ -487,6 +489,7 @@ static int init_ixp_crypto(struct device *dev)
487489
return -ENODEV;
488490
}
489491
send_qid = queue_spec.args[0];
492+
of_node_put(queue_spec.np);
490493
} else {
491494
/*
492495
* Hardcoded engine when using platform data, this goes away

0 commit comments

Comments
 (0)