2023-03-05 21:25:29

by YongSu Yoo

[permalink] [raw]
Subject: [PATCH] media: dvb_demux: Fix a bug for the continuity counter

From: YongSu Yoo <[email protected]>

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

In dvb_demux.c, some logics exist which compare the expected
continuity counter and the real continuity counter. If they
are not matched each other, both of the expected continuity
counter and the real continuity counter should be printed.
But there exists a bug that the expected continuity counter
is not correctly printed. The expected continuity counter is
replaced with the real countinuity counter + 1 so that
the epected continuity counter is not correclty printed.
This is wrong. This bug is fixed.
---
drivers/media/dvb-core/dvb_demux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-core/dvb_demux.c b/drivers/media/dvb-core/dvb_demux.c
index 398c86279b5b..7c4d86bfdd6c 100644
--- a/drivers/media/dvb-core/dvb_demux.c
+++ b/drivers/media/dvb-core/dvb_demux.c
@@ -115,12 +115,12 @@ static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed,

cc = buf[3] & 0x0f;
ccok = ((feed->cc + 1) & 0x0f) == cc;
- feed->cc = cc;
if (!ccok) {
set_buf_flags(feed, DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED);
dprintk_sect_loss("missed packet: %d instead of %d!\n",
cc, (feed->cc + 1) & 0x0f);
}
+ feed->cc = cc;

if (buf[1] & 0x40) // PUSI ?
feed->peslen = 0xfffa;
@@ -300,7 +300,6 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed,

cc = buf[3] & 0x0f;
ccok = ((feed->cc + 1) & 0x0f) == cc;
- feed->cc = cc;

if (buf[3] & 0x20) {
/* adaption field present, check for discontinuity_indicator */
@@ -336,6 +335,7 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed,
feed->pusi_seen = false;
dvb_dmx_swfilter_section_new(feed);
}
+ feed->cc = cc;

if (buf[1] & 0x40) {
/* PUSI=1 (is set), section boundary is here */
--
2.17.1



2023-04-16 12:03:02

by YongSu Yoo

[permalink] [raw]
Subject: Re: [PATCH] media: dvb_demux: Fix a bug for the continuity counter

Hi ~ Everyone
Can you share how this patch is going ?

2023년 3월 6일 (월) 오전 6:25, <[email protected]>님이 작성:
>
> From: YongSu Yoo <[email protected]>
>
> Signed-off-by: Yongsu Yoo <[email protected]>
>
> In dvb_demux.c, some logics exist which compare the expected
> continuity counter and the real continuity counter. If they
> are not matched each other, both of the expected continuity
> counter and the real continuity counter should be printed.
> But there exists a bug that the expected continuity counter
> is not correctly printed. The expected continuity counter is
> replaced with the real countinuity counter + 1 so that
> the epected continuity counter is not correclty printed.
> This is wrong. This bug is fixed.
> ---
> drivers/media/dvb-core/dvb_demux.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/dvb-core/dvb_demux.c b/drivers/media/dvb-core/dvb_demux.c
> index 398c86279b5b..7c4d86bfdd6c 100644
> --- a/drivers/media/dvb-core/dvb_demux.c
> +++ b/drivers/media/dvb-core/dvb_demux.c
> @@ -115,12 +115,12 @@ static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed,
>
> cc = buf[3] & 0x0f;
> ccok = ((feed->cc + 1) & 0x0f) == cc;
> - feed->cc = cc;
> if (!ccok) {
> set_buf_flags(feed, DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED);
> dprintk_sect_loss("missed packet: %d instead of %d!\n",
> cc, (feed->cc + 1) & 0x0f);
> }
> + feed->cc = cc;
>
> if (buf[1] & 0x40) // PUSI ?
> feed->peslen = 0xfffa;
> @@ -300,7 +300,6 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed,
>
> cc = buf[3] & 0x0f;
> ccok = ((feed->cc + 1) & 0x0f) == cc;
> - feed->cc = cc;
>
> if (buf[3] & 0x20) {
> /* adaption field present, check for discontinuity_indicator */
> @@ -336,6 +335,7 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed,
> feed->pusi_seen = false;
> dvb_dmx_swfilter_section_new(feed);
> }
> + feed->cc = cc;
>
> if (buf[1] & 0x40) {
> /* PUSI=1 (is set), section boundary is here */
> --
> 2.17.1
>