On Sat, Oct 20, 2018 at 11:26:23PM +0900, Akinobu Mita wrote: > The video device release() callback for video-i2c driver frees the whole > struct video_i2c_data. If there is no user left for the video device > when video_unregister_device() is called, the release callback is executed. > > However, in video_i2c_remove() some fields (v4l2_dev, lock, and queue_lock) > in struct video_i2c_data are still accessed after video_unregister_device() > is called. > > This fixes the use after free by moving the code from video_i2c_remove() > to the release() callback. > > Fixes: 5cebaac60974 ("media: video-i2c: add video-i2c driver") > Cc: Matt Ranostay <matt.ranostay@xxxxxxxxxxxx> > Cc: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> > Cc: Hans Verkuil <hansverk@xxxxxxxxx> > Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> > Reviewed-by: Matt Ranostay <matt.ranostay@xxxxxxxxxxxx> > Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx> Acked-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> -- Sakari Ailus e-mail: sakari.ailus@xxxxxx