Skip to contentSkip to conversation

media: dvb_ca_en50221: Fix a bug for detecting CI MODULE

PATCH In review [email protected] 2 participants 6 messages Mar 8, 2024 – May 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: dvb_ca_en50221: Fix a bug for detecting CI MODULE

From: 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(+)
drivers/media/dvb-core/dvb_ca_en50221.c +4 -0
index baf64540dc00..8d37c3c13227 100644
@@ -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;
Signature · 1 line
2.17.1
author
#1 lore raw

Dear All

Can you review this patch ?
Can you share how this modification is going ?

2024년 3월 8일 (금) 오후 9:10, <[email protected]>님이 작성:

Quoted 41 lines

From: 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(+)
drivers/media/dvb-core/dvb_ca_en50221.c +4 -1
index baf64540dc00..8d37c3c13227 100644
@@ -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

author
#2 lore raw

Dear All

Can you review this patch ?
Can you share how this is going ?

2024년 4월 11일 (목) 오후 9:03, YongSu Yoo <[email protected]>님이 작성:

Quoted 48 lines

Dear All

Can you review this patch ?
Can you share how this modification is going ?

2024년 3월 8일 (금) 오후 9:10, <[email protected]>님이 작성:

Quoted 41 lines

From: 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(+)
drivers/media/dvb-core/dvb_ca_en50221.c +4 -1
index baf64540dc00..8d37c3c13227 100644
@@ -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

#3 lore raw
In reply to [email protected]

…

Quoted 2 lines

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.

1. I hope that typos will be avoided for subsequent change descriptions.

2. How do you think about to improve the patch further with a corresponding imperative wording?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc6#n94

3. Would you like to add the tag “Fixes” accordingly?

Regards,
Markus

author
#4 lore raw

Dear Markus Elfring
Can you explain what I shall do more ?
1. What is the "typo" ?
2. Can you take some examples which show the "Imperative wording" ?
3. Can you give me some examples for adding "Fixes" ?
Do I have to use "Fixes" instead of "Fix" ?

2024년 5월 2일 (목) 오전 1:25, Markus Elfring <[email protected]>님이 작성:

Quoted 14 lines

…

Quoted 2 lines

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.

1. I hope that typos will be avoided for subsequent change descriptions.

2. How do you think about to improve the patch further with a corresponding imperative wording?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc6#n94

3. Would you like to add the tag “Fixes” accordingly?

Regards,
Markus

#5 lore raw
Quoted 1 line

1. What is the "typo" ?

Please take another look at opportunities for spell checking also in commit messages.

Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

… right informtion. … a Bug. …

2. Can you take some examples which show the "Imperative wording" ?

I hope that you can take published guidance better into account (instead of the wording “We fix this bug.” in the discussed changelog).
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9#n94

Quoted 1 line

3. Can you give me some examples for adding "Fixes" ?

An other tag specification might be more appropriate than the following suggestion.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9#n145

Fixes a75aa90c7c2f ("media: dvb_ca_en50221: Used a helper variable")

Regards,
Markus