crypto: ixp4xx - fix OF node reference leaks in init_ixp_crypto()
[ Upstream commit 472a989029aac2b78ef2f0b18b27c568bf76d104 ]
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: 76f24b4f46
("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>
This commit is contained in:
parent
dbacf8ffed
commit
1a36117e16
@ -469,6 +469,7 @@ static int init_ixp_crypto(struct device *dev)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
npe_id = npe_spec.args[0];
|
npe_id = npe_spec.args[0];
|
||||||
|
of_node_put(npe_spec.np);
|
||||||
|
|
||||||
ret = of_parse_phandle_with_fixed_args(np, "queue-rx", 1, 0,
|
ret = of_parse_phandle_with_fixed_args(np, "queue-rx", 1, 0,
|
||||||
&queue_spec);
|
&queue_spec);
|
||||||
@ -477,6 +478,7 @@ static int init_ixp_crypto(struct device *dev)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
recv_qid = queue_spec.args[0];
|
recv_qid = queue_spec.args[0];
|
||||||
|
of_node_put(queue_spec.np);
|
||||||
|
|
||||||
ret = of_parse_phandle_with_fixed_args(np, "queue-txready", 1, 0,
|
ret = of_parse_phandle_with_fixed_args(np, "queue-txready", 1, 0,
|
||||||
&queue_spec);
|
&queue_spec);
|
||||||
@ -485,6 +487,7 @@ static int init_ixp_crypto(struct device *dev)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
send_qid = queue_spec.args[0];
|
send_qid = queue_spec.args[0];
|
||||||
|
of_node_put(queue_spec.np);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Hardcoded engine when using platform data, this goes away
|
* Hardcoded engine when using platform data, this goes away
|
||||||
|
Loading…
Reference in New Issue
Block a user