2023-12-31 07:34:07

by YongSu Yoo

[permalink] [raw]
Subject: [PATCH] [PATCH] media: dvb_ca_en50221: Fix a bug for detecting CI MODULE

From: Yongsu yoo <[email protected]>

Signed-off-by:Yongsu Yoo <[email protected]>

In source/drivers/media/dvb-core/dvb_ca_en50221.c, if the CA_RESET
ioctl is called, the dvb_ca_en50221_slot_shutdown will also be called.
Inside of the dvb_ca_en50221_slot_shutdown,
the ca->slot_info[slot].slot_state will become DVB_CA_SLOTSTATE_NONE.
In the most of cases, the ca->slot_info[slot].slot_state will quickly
becomes restored to other states by the subsequent operations of the
thread dvb_ca_en50221_thread_state_machine.
But in some rare cases, when the CA_GET_SLOT_INFO ioctl is immediately
called after the CA_RESET ioctl is called, the
the ca->slot_info[slot].slot_state can still remains at
DVB_CA_SLOTSTATE_NONE, and this causes CA_GET_SLOT_INFO ioctl not to
return CA_CI_MODULE_PRESENT as info->flags even if CA_CI_MODULE is
really connected on TV. This means that the CA_GET_SLOT_INFO ioctl
does not return right informtion. This is a Bug. We fix this bug.
---
drivers/media/dvb-core/dvb_ca_en50221.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c
index baf64540dc00..8d37c3c13227 100644
--- a/drivers/media/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb-core/dvb_ca_en50221.c
@@ -1403,6 +1403,10 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file,
(sl->slot_state != DVB_CA_SLOTSTATE_INVALID)) {
info->flags = CA_CI_MODULE_PRESENT;
}
+ if ((sl->slot_state == DVB_CA_SLOTSTATE_NONE) &&
+ (sl->camchange_type == DVB_CA_EN50221_CAMCHANGE_INSERTED)) {
+ info->flags = CA_CI_MODULE_PRESENT;
+ }
if (sl->slot_state == DVB_CA_SLOTSTATE_RUNNING)
info->flags |= CA_CI_MODULE_READY;
break;
--
2.17.1



2024-01-09 12:27:12

by YongSu Yoo

[permalink] [raw]
Subject: Re: [PATCH] [PATCH] media: dvb_ca_en50221: Fix a bug for detecting CI MODULE

Dear All

Do you know how can I change
from [PATCH] [PATCH] media: dvb_ca_en50221: Fix a bug for dete...
to [PATCH] media: dvb_ca_en50221: Fix a bug for dete... ?

2023년 12월 31일 (일) 오후 4:33, <[email protected]>님이 작성:
>
> From: Yongsu yoo <[email protected]>
>
> Signed-off-by:Yongsu Yoo <[email protected]>
>
> In source/drivers/media/dvb-core/dvb_ca_en50221.c, if the CA_RESET
> ioctl is called, the dvb_ca_en50221_slot_shutdown will also be called.
> Inside of the dvb_ca_en50221_slot_shutdown,
> the ca->slot_info[slot].slot_state will become DVB_CA_SLOTSTATE_NONE.
> In the most of cases, the ca->slot_info[slot].slot_state will quickly
> becomes restored to other states by the subsequent operations of the
> thread dvb_ca_en50221_thread_state_machine.
> But in some rare cases, when the CA_GET_SLOT_INFO ioctl is immediately
> called after the CA_RESET ioctl is called, the
> the ca->slot_info[slot].slot_state can still remains at
> DVB_CA_SLOTSTATE_NONE, and this causes CA_GET_SLOT_INFO ioctl not to
> return CA_CI_MODULE_PRESENT as info->flags even if CA_CI_MODULE is
> really connected on TV. This means that the CA_GET_SLOT_INFO ioctl
> does not return right informtion. This is a Bug. We fix this bug.
> ---
> drivers/media/dvb-core/dvb_ca_en50221.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c
> index baf64540dc00..8d37c3c13227 100644
> --- a/drivers/media/dvb-core/dvb_ca_en50221.c
> +++ b/drivers/media/dvb-core/dvb_ca_en50221.c
> @@ -1403,6 +1403,10 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file,
> (sl->slot_state != DVB_CA_SLOTSTATE_INVALID)) {
> info->flags = CA_CI_MODULE_PRESENT;
> }
> + if ((sl->slot_state == DVB_CA_SLOTSTATE_NONE) &&
> + (sl->camchange_type == DVB_CA_EN50221_CAMCHANGE_INSERTED)) {
> + info->flags = CA_CI_MODULE_PRESENT;
> + }
> if (sl->slot_state == DVB_CA_SLOTSTATE_RUNNING)
> info->flags |= CA_CI_MODULE_READY;
> break;
> --
> 2.17.1
>