* [PATCH] video: fbdev: Fix an errro handling path in 'au1200fb_drv_probe()' @ 2017-09-12 5:39 ` Christophe JAILLET 2017-10-12 16:25 ` Bartlomiej Zolnierkiewicz 0 siblings, 1 reply; 3+ messages in thread From: Christophe JAILLET @ 2017-09-12 5:39 UTC (permalink / raw) To: b.zolnierkie, tj, viro Cc: linux-fbdev, linux-kernel, kernel-janitors, Christophe JAILLET If 'dmam_alloc_attrs()' fails, we must go through the error handling code, as done elsewhere in this function. Otherwise, there is a resource leak. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- I'm also puzzled by the 'framebuffer_alloc()' call a few lines above. 'ret' is known to be 0 at this point. I guess that -ENOMEM should also be returned. --- drivers/video/fbdev/au1200fb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index 5f04b4096c42..99d6cfb168b5 100644 --- a/drivers/video/fbdev/au1200fb.c +++ b/drivers/video/fbdev/au1200fb.c @@ -1701,7 +1701,8 @@ static int au1200fb_drv_probe(struct platform_device *dev) if (!fbdev->fb_mem) { print_err("fail to allocate frambuffer (size: %dK))", fbdev->fb_len / 1024); - return -ENOMEM; + ret = -ENOMEM; + goto failed; } /* -- 2.11.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] video: fbdev: Fix an errro handling path in 'au1200fb_drv_probe()' 2017-09-12 5:39 ` [PATCH] video: fbdev: Fix an errro handling path in 'au1200fb_drv_probe()' Christophe JAILLET @ 2017-10-12 16:25 ` Bartlomiej Zolnierkiewicz 2017-10-15 14:26 ` Christophe JAILLET 0 siblings, 1 reply; 3+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2017-10-12 16:25 UTC (permalink / raw) To: Christophe JAILLET Cc: tj, viro, linux-fbdev, linux-kernel, kernel-janitors, dri-devel [ added dri-devel ML to cc: ] On Tuesday, September 12, 2017 07:39:30 AM Christophe JAILLET wrote: > If 'dmam_alloc_attrs()' fails, we must go through the error handling code, > as done elsewhere in this function. Otherwise, there is a resource leak. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > I'm also puzzled by the 'framebuffer_alloc()' call a few lines above. > 'ret' is known to be 0 at this point. I guess that -ENOMEM should also be > returned. Yes, moreover the "failed:" error path is incomplete (please take a look at au1200fb_drv_remove() for comparison) and needs to be fixed. Could you please take care of it? > --- > drivers/video/fbdev/au1200fb.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c > index 5f04b4096c42..99d6cfb168b5 100644 > --- a/drivers/video/fbdev/au1200fb.c > +++ b/drivers/video/fbdev/au1200fb.c > @@ -1701,7 +1701,8 @@ static int au1200fb_drv_probe(struct platform_device *dev) > if (!fbdev->fb_mem) { > print_err("fail to allocate frambuffer (size: %dK))", > fbdev->fb_len / 1024); > - return -ENOMEM; > + ret = -ENOMEM; > + goto failed; > } > > /* Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] video: fbdev: Fix an errro handling path in 'au1200fb_drv_probe()' 2017-10-12 16:25 ` Bartlomiej Zolnierkiewicz @ 2017-10-15 14:26 ` Christophe JAILLET 0 siblings, 0 replies; 3+ messages in thread From: Christophe JAILLET @ 2017-10-15 14:26 UTC (permalink / raw) To: Bartlomiej Zolnierkiewicz Cc: tj, viro, linux-fbdev, linux-kernel, kernel-janitors, dri-devel Le 12/10/2017 à 18:25, Bartlomiej Zolnierkiewicz a écrit : > [ added dri-devel ML to cc: ] > > On Tuesday, September 12, 2017 07:39:30 AM Christophe JAILLET wrote: >> If 'dmam_alloc_attrs()' fails, we must go through the error handling code, >> as done elsewhere in this function. Otherwise, there is a resource leak. >> >> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> >> --- >> I'm also puzzled by the 'framebuffer_alloc()' call a few lines above. >> 'ret' is known to be 0 at this point. I guess that -ENOMEM should also be >> returned. > Yes, moreover the "failed:" error path is incomplete (please take > a look at au1200fb_drv_remove() for comparison) and needs to be fixed. > > Could you please take care of it? I will try, but be indulgent :) My understanding of the code is that they are several issues all related to this error handling path (double free, missing memory release, invalid irq release...) I will try to sort it out, but my first tries will likely be incomplete and/or broken. CJ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-15 14:26 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <CGME20170912054234epcas4p2afadfa32766d7a186c00f1fdc568c7bf@epcas4p2.samsung.com> 2017-09-12 5:39 ` [PATCH] video: fbdev: Fix an errro handling path in 'au1200fb_drv_probe()' Christophe JAILLET 2017-10-12 16:25 ` Bartlomiej Zolnierkiewicz 2017-10-15 14:26 ` Christophe JAILLET
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).