OSDN Git Service

media: v4l: fwnode: Make v4l2_fwnode_endpoint_free() safer
authorSakari Ailus <sakari.ailus@linux.intel.com>
Mon, 23 Sep 2019 09:09:46 +0000 (06:09 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 1 Oct 2019 20:32:55 +0000 (17:32 -0300)
Assign vep->link_frequencies to NULL after releasing its memory. Without
this change, multiple calls to v4l2_fwnode_endpoint_free() would result in
double kfree calls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/v4l2-fwnode.c

index 3bd1888..192cac0 100644 (file)
@@ -512,6 +512,7 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep)
                return;
 
        kfree(vep->link_frequencies);
+       vep->link_frequencies = NULL;
 }
 EXPORT_SYMBOL_GPL(v4l2_fwnode_endpoint_free);