Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: cc3f414cf2e4 ("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>

authored by

Weigang He and committed by
Helge Deller
eacf9840 88b3b992

+2 -2
+2 -2
drivers/video/of_display_timing.c
··· 181 181 if (disp->num_timings == 0) { 182 182 /* should never happen, as entry was already found above */ 183 183 pr_err("%pOF: no timings specified\n", np); 184 - goto entryfail; 184 + goto timingfail; 185 185 } 186 186 187 187 disp->timings = kcalloc(disp->num_timings, ··· 189 189 GFP_KERNEL); 190 190 if (!disp->timings) { 191 191 pr_err("%pOF: could not allocate timings array\n", np); 192 - goto entryfail; 192 + goto timingfail; 193 193 } 194 194 195 195 disp->num_timings = 0;