]> git.baikalelectronics.ru Git - kernel.git/commit
media: cec-adap.c: don't unconfigure if already unconfigured
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 6 May 2022 07:25:55 +0000 (09:25 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 13 May 2022 09:28:06 +0000 (11:28 +0200)
commitf30599eea08ef050f2cc779d5b476369e1f15f4a
tree10c54cbd6281dbbb119d616ad944c2c9480fec65
parentb1b66374d2ed8318cd7d0cfc4a8ae826c5040970
media: cec-adap.c: don't unconfigure if already unconfigured

The __cec_s_log_addrs() function can configure or unconfigure the
adapter. The ioctl handler in cec-api.c will prevent it from being
called to configure the adapter if it was already configured (or in
the process of configuring). But it can still be called to unconfigure
an already unconfigured adapter, and it didn't check for that.

This can cause cec_activate_cnt_dec() to be called too often, causing
a WARN_ON.

Instead first check if adap->log_addrs.num_log_addrs == 0 and return
since in that case the adapter is already unconfigured.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/cec/core/cec-adap.c