Commit 472a9890 authored by Joe Hattori's avatar Joe Hattori Committed by Herbert Xu
Browse files

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: 76f24b4f ("crypto: ixp4xx - Add device tree support")
Signed-off-by: default avatarJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent a5a9d959
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -471,6 +471,7 @@ static int init_ixp_crypto(struct device *dev)
			return -ENODEV;
		}
		npe_id = npe_spec.args[0];
		of_node_put(npe_spec.np);

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

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