linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is this a bug between dvb_usb_adapter_frontend_init and cinergyt2_frontend_attach?
@ 2021-05-24 15:06 慕冬亮
  0 siblings, 0 replies; only message in thread
From: 慕冬亮 @ 2021-05-24 15:06 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, linux-kernel

Hi kernel developers,

I doubt there is a bug between dvb_usb_adapter_frontend_init [1] and
cinergyt2_frontend_attach [2]. The following source code includes the
critical part.

-----------------------------------------------------------------------------------------------------
int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
{
        ......
        /* register all given adapter frontends */
        for (i = 0; i < adap->props.num_frontends; i++) {
                ret = adap->props.fe[i].frontend_attach(adap);
                if (ret || adap->fe_adap[i].fe == NULL) {
                        return 0;
                }
        }
        ......
}

static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap)
{
        ......
        adap->fe_adap[0].fe = cinergyt2_fe_attach(adap->dev);
        ......
        return ret;
}
-----------------------------------------------------------------------------------------------------

In the dvb_usb_adapter_frontend_init, the function pointer -
frontend_attach points to cinergyt2_frontend_attach. Then the parent
function dvb_usb_adapter_frontend_init checks the return value and
adap->fe_adap[i].fe to verify the execution of the child function.
However, the child function - cinergyt2_frontend_attach passes the
allocated dvb_frontend with adap->fe_adap[0].fe, but the check is
performed on adap->fe_adap[i].fe. At the same time, the adap in both
expressions should be the same data pointer.

Please correct me if you have any opinions with the above statements.

[1] dvb_usb_adapter_frontend_init:
https://elixir.bootlin.com/linux/latest/source/drivers/media/usb/dvb-usb/dvb-usb-dvb.c#L276

[2] cinergyt2_frontend_attach:
https://elixir.bootlin.com/linux/latest/source/drivers/media/usb/dvb-usb/cinergyT2-core.c#L68

--
My best regards to you.

     No System Is Safe!
     Dongliang Mu

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-24 15:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 15:06 Is this a bug between dvb_usb_adapter_frontend_init and cinergyt2_frontend_attach? 慕冬亮

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).