Skip to content

Commit 2f2a951

Browse files
joehattoriopsiff
authored andcommitted
crypto: ixp4xx - fix OF node reference leaks in init_ixp_crypto()
[ Upstream commit 472a989 ] 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 <joe@pf.is.s.u-tokyo.ac.jp> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit df2c01fa057b30fe72b1cc4ed21bcba0f9268cd7)
1 parent a9228b3 commit 2f2a951

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

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)