* [PATCH 1/1] media: si470x-i2c: Move free() past last use of 'radio'
@ 2020-02-03 13:21 Lee Jones
2020-02-03 14:32 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Lee Jones @ 2020-02-03 13:21 UTC (permalink / raw)
To: stable; +Cc: linux-arm-kernel, linux-kernel
A pointer to 'struct si470x_device' is currently used after free:
drivers/media/radio/si470x/radio-si470x-i2c.c:462:25-30: ERROR: reference
preceded by free on line 460
Shift the call to free() down past its final use.
NB: Not sending to Mainline, since the problem does not exist there.
Cc: <stable@vger.kernel.org> # v3.18+
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/media/radio/si470x/radio-si470x-i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
index ae7540b765e1d..aa12fd2663895 100644
--- a/drivers/media/radio/si470x/radio-si470x-i2c.c
+++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
@@ -483,10 +483,10 @@ static int si470x_i2c_remove(struct i2c_client *client)
free_irq(client->irq, radio);
video_unregister_device(&radio->videodev);
- kfree(radio);
v4l2_ctrl_handler_free(&radio->hdl);
v4l2_device_unregister(&radio->v4l2_dev);
+ kfree(radio);
return 0;
}
--
2.24.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] media: si470x-i2c: Move free() past last use of 'radio'
2020-02-03 13:21 [PATCH 1/1] media: si470x-i2c: Move free() past last use of 'radio' Lee Jones
@ 2020-02-03 14:32 ` Greg KH
2020-02-03 14:58 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2020-02-03 14:32 UTC (permalink / raw)
To: Lee Jones; +Cc: stable, linux-arm-kernel, linux-kernel
On Mon, Feb 03, 2020 at 01:21:30PM +0000, Lee Jones wrote:
> A pointer to 'struct si470x_device' is currently used after free:
>
> drivers/media/radio/si470x/radio-si470x-i2c.c:462:25-30: ERROR: reference
> preceded by free on line 460
>
> Shift the call to free() down past its final use.
>
> NB: Not sending to Mainline, since the problem does not exist there.
It doesn't exist there because of a bad merge? What commit caused the
problem?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] media: si470x-i2c: Move free() past last use of 'radio'
2020-02-03 14:32 ` Greg KH
@ 2020-02-03 14:58 ` Greg KH
2020-02-03 15:12 ` Lee Jones
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2020-02-03 14:58 UTC (permalink / raw)
To: Lee Jones; +Cc: stable, linux-arm-kernel, linux-kernel
On Mon, Feb 03, 2020 at 02:32:45PM +0000, Greg KH wrote:
> On Mon, Feb 03, 2020 at 01:21:30PM +0000, Lee Jones wrote:
> > A pointer to 'struct si470x_device' is currently used after free:
> >
> > drivers/media/radio/si470x/radio-si470x-i2c.c:462:25-30: ERROR: reference
> > preceded by free on line 460
> >
> > Shift the call to free() down past its final use.
> >
> > NB: Not sending to Mainline, since the problem does not exist there.
>
> It doesn't exist there because of a bad merge? What commit caused the
> problem?
Ah, found it, it was 2df200ab234a ("media: si470x-i2c: add missed
operations in remove")
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] media: si470x-i2c: Move free() past last use of 'radio'
2020-02-03 14:58 ` Greg KH
@ 2020-02-03 15:12 ` Lee Jones
0 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2020-02-03 15:12 UTC (permalink / raw)
To: Greg KH; +Cc: stable, linux-arm-kernel, linux-kernel
On Mon, 03 Feb 2020, Greg KH wrote:
> On Mon, Feb 03, 2020 at 02:32:45PM +0000, Greg KH wrote:
> > On Mon, Feb 03, 2020 at 01:21:30PM +0000, Lee Jones wrote:
> > > A pointer to 'struct si470x_device' is currently used after free:
> > >
> > > drivers/media/radio/si470x/radio-si470x-i2c.c:462:25-30: ERROR: reference
> > > preceded by free on line 460
> > >
> > > Shift the call to free() down past its final use.
> > >
> > > NB: Not sending to Mainline, since the problem does not exist there.
> >
> > It doesn't exist there because of a bad merge? What commit caused the
> > problem?
>
> Ah, found it, it was 2df200ab234a ("media: si470x-i2c: add missed
> operations in remove")
I was about to follow up with a v2:
"NB: Cauased during the backporting of upstream commit 2df200ab234a
("media: si470x-i2c: add missed operations in remove"). This issue does
not exist in Mainline since the kfree() was removed in v5.0 as part of
commit f86c51b66bf6 ("media: si470x-i2c: Use managed resource helpers")."
--
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-03 15:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-03 13:21 [PATCH 1/1] media: si470x-i2c: Move free() past last use of 'radio' Lee Jones
2020-02-03 14:32 ` Greg KH
2020-02-03 14:58 ` Greg KH
2020-02-03 15:12 ` Lee Jones
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).