Skip to content

Commit eacf984

Browse files
Weigang Hehdeller
authored andcommitted
fbdev: of: display_timing: fix refcount leak in of_get_display_timings()
of_parse_phandle() returns a device_node with refcount incremented, which is stored in 'entry' and then copied to 'native_mode'. When the error paths at lines 184 or 192 jump to 'entryfail', native_mode's refcount is not decremented, causing a refcount leak. Fix this by changing the goto target from 'entryfail' to 'timingfail', which properly calls of_node_put(native_mode) before cleanup. Fixes: cc3f414 ("video: add of helper for display timings/videomode") Cc: stable@vger.kernel.org Signed-off-by: Weigang He <geoffreyhe2@gmail.com> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 88b3b99 commit eacf984

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/video/of_display_timing.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ struct display_timings *of_get_display_timings(const struct device_node *np)
181181
if (disp->num_timings == 0) {
182182
/* should never happen, as entry was already found above */
183183
pr_err("%pOF: no timings specified\n", np);
184-
goto entryfail;
184+
goto timingfail;
185185
}
186186

187187
disp->timings = kcalloc(disp->num_timings,
188188
sizeof(struct display_timing *),
189189
GFP_KERNEL);
190190
if (!disp->timings) {
191191
pr_err("%pOF: could not allocate timings array\n", np);
192-
goto entryfail;
192+
goto timingfail;
193193
}
194194

195195
disp->num_timings = 0;

0 commit comments

Comments
 (0)