]> www.infradead.org Git - users/dwmw2/linux.git/commit
media: cec-notifier: clear cec_adap in cec_notifier_unregister
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 23 Aug 2019 11:12:59 +0000 (08:12 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 11:13:48 +0000 (13:13 +0200)
commit730e14891202a3858bc7e94df5607165caa6ac6f
treefba36f5af7533c16efff8cec9e3712910a4ae844
parentb74f2a4c0af2ab5486db694909809bf2398337a3
media: cec-notifier: clear cec_adap in cec_notifier_unregister

[ Upstream commit 14d5511691e5290103bc480998bc322e68f139d4 ]

If cec_notifier_cec_adap_unregister() is called before
cec_unregister_adapter() then everything is OK (and this is the
case today). But if it is the other way around, then
cec_notifier_unregister() is called first, and that doesn't
set n->cec_adap to NULL.

So if e.g. cec_notifier_set_phys_addr() is called after
cec_notifier_unregister() but before cec_unregister_adapter()
then n->cec_adap points to an unregistered and likely deleted
cec adapter. So just set n->cec_adap->notifier and n->cec_adap
to NULL for rubustness.

Eventually cec_notifier_unregister will disappear and this will
be simplified substantially.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/cec/cec-notifier.c