Skip to content

Commit 040d516

Browse files
committed
iio: ad9361: fix double-free when parsing DT for filter-band settings
Reported via: https://ez.analog.com/linux-device-drivers/linux-software-drivers/f/q-a/114085/kernel-panic-with-e310/340287 When looping with of_for_each_phandle(), the only time that is recommended to use `of_node_put()` is on error-paths (which is already being done). Otherwise, the of_for_each_phandle() call should handle free-ing the `it.node` if the loop finishes successfully. This type of API design (with `of_for_each_phandle()`) is a bit error prone when being used. And in this case it was causing double-free. Also, ARM is not the most consistent architecture with regards to Linux panic-ing on access violations. Sometimes it lets you get away with 1-2-3, which could be one reason why we didn't catch this in our testing. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
1 parent 153fe91 commit 040d516

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/iio/adc/ad9361_ext_band_ctrl.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ static int ad9361_parse_setting_seq(struct device *dev,
176176
nseq->delay = args[0]; /* delay to wait after this setting */
177177

178178
list_add_tail(&nseq->list, lst);
179-
180-
of_node_put(it.node);
181179
};
182180

183181
out:

0 commit comments

Comments
 (0)