diff mbox

[davinci] ccdc_update_raw_params() frees the wrong thing

Message ID 20151213003201.GQ20997@ZenIV.linux.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Al Viro Dec. 13, 2015, 12:32 a.m. UTC
Passing a physical address to free_pages() is a bad idea.
config_params->fault_pxl.fpc_table_addr is set to virt_to_phys()
of __get_free_pages() return value; what we should pass to free_pages()
is its phys_to_virt().  ccdc_close() does that properly, but
ccdc_update_raw_params() doesn't.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Lad, Prabhakar Jan. 5, 2016, 5:37 p.m. UTC | #1
On Sun, Dec 13, 2015 at 12:32 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
>         Passing a physical address to free_pages() is a bad idea.
> config_params->fault_pxl.fpc_table_addr is set to virt_to_phys()
> of __get_free_pages() return value; what we should pass to free_pages()
> is its phys_to_virt().  ccdc_close() does that properly, but
> ccdc_update_raw_params() doesn't.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Regards,
--Prabhakar Lad

> diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c b/drivers/media/platform/davinci/dm644x_ccdc.c
> index ffbefdf..6fba32b 100644
> --- a/drivers/media/platform/davinci/dm644x_ccdc.c
> +++ b/drivers/media/platform/davinci/dm644x_ccdc.c
> @@ -261,7 +261,7 @@ static int ccdc_update_raw_params(struct ccdc_config_params_raw *raw_params)
>          */
>         if (raw_params->fault_pxl.fp_num != config_params->fault_pxl.fp_num) {
>                 if (fpc_physaddr != NULL) {
> -                       free_pages((unsigned long)fpc_physaddr,
> +                       free_pages((unsigned long)fpc_virtaddr,
>                                    get_order
>                                    (config_params->fault_pxl.fp_num *
>                                    FP_NUM_BYTES));
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Al Viro Jan. 6, 2016, 4:34 p.m. UTC | #2
On Tue, Jan 05, 2016 at 05:37:06PM +0000, Lad, Prabhakar wrote:
> On Sun, Dec 13, 2015 at 12:32 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> >         Passing a physical address to free_pages() is a bad idea.
> > config_params->fault_pxl.fpc_table_addr is set to virt_to_phys()
> > of __get_free_pages() return value; what we should pass to free_pages()
> > is its phys_to_virt().  ccdc_close() does that properly, but
> > ccdc_update_raw_params() doesn't.
> >
> > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> >
> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> 
> Regards,
> --Prabhakar Lad

	Which tree should it go through?  I can certainly put that into
vfs.git#work.misc, but it looks like a better fit for linux-media tree, or
the davinci-specific one...
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lad, Prabhakar Jan. 6, 2016, 5:14 p.m. UTC | #3
On Wed, Jan 6, 2016 at 4:34 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Tue, Jan 05, 2016 at 05:37:06PM +0000, Lad, Prabhakar wrote:
>> On Sun, Dec 13, 2015 at 12:32 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
>> >         Passing a physical address to free_pages() is a bad idea.
>> > config_params->fault_pxl.fpc_table_addr is set to virt_to_phys()
>> > of __get_free_pages() return value; what we should pass to free_pages()
>> > is its phys_to_virt().  ccdc_close() does that properly, but
>> > ccdc_update_raw_params() doesn't.
>> >
>> > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
>> >
>> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>>
>> Regards,
>> --Prabhakar Lad
>
>         Which tree should it go through?  I can certainly put that into
> vfs.git#work.misc, but it looks like a better fit for linux-media tree, or
> the davinci-specific one...

It needs to go linux-media tree I'll issue a pull to mauro soon.

Cheers,
--Prabhakar Lad
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c b/drivers/media/platform/davinci/dm644x_ccdc.c
index ffbefdf..6fba32b 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc.c
+++ b/drivers/media/platform/davinci/dm644x_ccdc.c
@@ -261,7 +261,7 @@  static int ccdc_update_raw_params(struct ccdc_config_params_raw *raw_params)
 	 */
 	if (raw_params->fault_pxl.fp_num != config_params->fault_pxl.fp_num) {
 		if (fpc_physaddr != NULL) {
-			free_pages((unsigned long)fpc_physaddr,
+			free_pages((unsigned long)fpc_virtaddr,
 				   get_order
 				   (config_params->fault_pxl.fp_num *
 				   FP_NUM_BYTES));