Linux Media Controller development
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux-media@vger.kernel.org, Henrik Kurelid <henrik@kurelid.se>
Subject: Re: [PATCH] firedtv: add parameter to fake ca_system_ids in CA_INFO
Date: Sat, 06 Mar 2010 11:43:49 -0300	[thread overview]
Message-ID: <4B926A25.3020801@infradead.org> (raw)
In-Reply-To: <4B92623C.2060302@s5r6.in-berlin.de>

Stefan Richter wrote:
> Mauro Carvalho Chehab wrote:
>> Stefan Richter wrote:
>>
>>> The Digital Everywhere firmware have the shortcoming that ca_info_enq and
>>> ca_info are not supported. This means that we can never retrieve the correct
>>> ca_system_id to present in the CI message CA_INFO. Currently the driver uses
>>> the application id retrieved using app_info_req and app_info, but this id
>>> only match the correct ca_system_id as given in ca_info in some cases.
>>> This patch adds a parameter to the driver in order for the user to override
>>> what will be returned in the CA_INFO CI message. Up to four ca_system_ids can
>>> be specified.
>>> This is needed for users with CAMs that have different manufacturer id and
>>> ca_system_id and that uses applications that take this into account, like
>>> MythTV.
>> This seems an ugly workaround. The better seems to patch MythTV to accept a different
>> CAM.
> 
> Ugly it is, for sure.  Can't comment on application-level solutions; if
> thats the proper layer at which to address this, then that would be
> preferable of course.

>From the report, this seems to be a requirement at application level. So, the fix should
be there.

Henrik, is there any reason why not patching MythTV?

> 
>>> +static int num_fake_ca_system_ids;
>> ...
>>> +		for (i = 0; i < num_fake_ca_system_ids; i++) {
>>> +			app_info[4 + i * 2] =
>>> +				(fake_ca_system_ids[i] >> 8) & 0xff;
>> ...
>>
>> NAK. If someone put an arbitrary high value for num_fake_ca_system_id's, it will write outside
>> the app_info array space, as the num_fake_ca_system_ids is not validated against the size
>> of app_info.
> 
> That's what I thought at first look at the patch too, but then I noticed
> that inlcude/linux/moduleparam.h and kernel/params.c properly track
> kparam_arry.max = ARRAY_SIZE(array).
> http://lxr.linux.no/#linux+v2.6.33/include/linux/moduleparam.h#L62
> http://lxr.linux.no/#linux+v2.6.33/include/linux/moduleparam.h#L213
> http://lxr.linux.no/#linux+v2.6.33/kernel/params.c#L351
> http://lxr.linux.no/#linux+v2.6.33/kernel/params.c#L296
> 
> So no danger here.
> 
>> Also, it makes no sense a negative value for this parameter.
> 
> I already posted an updated version of the patch which correctly defines
> num_fake_ca_system_ids as an unsigned long.

Ok. As app_info is char [256] (from ca_info::msg field), and kernel module avoids
the size of the array to be bigger than 4 (the sizeof the array), that's should be ok.

-- 

Cheers,
Mauro

      parent reply	other threads:[~2010-03-06 14:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-01 10:59 [PATCH] firedtv: correct version number and current/next in CA_PMT Stefan Richter
2010-03-01 11:03 ` [PATCH] firedtv: add parameter to fake ca_system_ids in CA_INFO Stefan Richter
2010-03-01 11:23   ` Stefan Richter
2010-03-01 11:56   ` [PATCH update] " Stefan Richter
2010-03-06 13:52   ` [PATCH] " Mauro Carvalho Chehab
2010-03-06 14:10     ` Stefan Richter
2010-03-06 14:14       ` Stefan Richter
2010-03-06 14:46         ` Mauro Carvalho Chehab
2010-03-06 14:43       ` Mauro Carvalho Chehab [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B926A25.3020801@infradead.org \
    --to=mchehab@infradead.org \
    --cc=henrik@kurelid.se \
    --cc=linux-media@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox