linux_dsm_epyc7002/drivers/media
Mauro Carvalho Chehab cc4a82581c [media] media-entity: cache media_device on object removal
As pointed by Dan, the commit f8fd4c61b5ae ("[media] media-entity:
protect object creation/removal using spin lock")' leads to the
following static checker warning:

	drivers/media/media-entity.c:781 media_remove_intf_link()
	error: dereferencing freed memory 'link'

drivers/media/media-entity.c
   777  void media_remove_intf_link(struct media_link *link)
   778  {
   779          spin_lock(&link->graph_obj.mdev->lock);
   780          __media_remove_intf_link(link);
   781          spin_unlock(&link->graph_obj.mdev->lock);

In practice, I didn't see any troubles even with KASAN enabled. I guess
gcc optimizer internally cached the mdev reference, instead of getting
it twice. Yet, it is a very bad idea to rely on such optimization. So,
let's fix the code.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:14 -02:00
..
common [media] dvb core: must check dvb_create_media_graph() 2016-01-11 12:18:59 -02:00
dvb-core [media] dvbdev: Document the new MC-related fields 2016-01-11 12:19:10 -02:00
dvb-frontends [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
firewire [media] dvb: modify core to implement interfaces/entities at MC new gen 2016-01-11 12:18:52 -02:00
i2c [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
mmc [media] siano: register media controller earlier 2015-02-26 09:10:39 -03:00
pci [media] dvb: modify core to implement interfaces/entities at MC new gen 2016-01-11 12:18:52 -02:00
platform [media] v4l: vsp1: use else if instead of continue when creating links 2016-01-11 12:19:09 -02:00
radio [media] media, sound: tea575x: constify snd_tea575x_ops structures 2015-12-03 11:26:45 -02:00
rc [media] rc: sunxi-cir: Initialize the spinlock properly 2015-12-23 15:51:40 -02:00
tuners [media] tv tuner max2165 driver: extend frequency range 2015-11-19 11:19:42 -02:00
usb [media] uvcvideo: register entity subdev on init 2016-01-11 12:19:09 -02:00
v4l2-core [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
Kconfig [media] Kconfig: Re-enable Media controller support for DVB 2016-01-11 12:18:40 -02:00
Makefile [media] bq/c-qcam, w9966, pms: move to staging in preparation for removal 2014-12-16 23:21:44 -02:00
media-device.c [media] media-device.h: document the last functions 2016-01-11 12:19:13 -02:00
media-devnode.c [media] media-devnode: move kernel-doc documentation to the header 2016-01-11 12:19:13 -02:00
media-entity.c [media] media-entity: cache media_device on object removal 2016-01-11 12:19:14 -02:00