mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: pageexec@freemail.hu
To: linux1394-devel@lists.sourceforge.net,
	Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux-kernel@vger.kernel.org, stable@kernel.org
Subject: Re: [PATCH 2/6] firewire: ohci: fix Self ID Count register mask (safeguard against buffer overflow)
Date: Mon, 07 Sep 2009 20:56:30 +0200	[thread overview]
Message-ID: <4AA5575E.6620.3D14E038@pageexec.freemail.hu> (raw)
In-Reply-To: <tkrat.e40ffd9ba52485e5@s5r6.in-berlin.de>

On 6 Sep 2009 at 18:49, Stefan Richter wrote:

added stable as .30 is affected, possibly older kernels as well, i didn't check.

> The selfIDSize field of Self ID Count is 9 bits wide, and we are only
> interested in the high 8 bits.  Fix the mask accordingly.  The
> previously too large mask didn't do damage though because the next few
> bits in the register are reserved and therefore zero with presently
> existing hardware.

unless something prevents one from creating a malicious device,
i wouldn't be so sure about all existing hw ;).

> Also, check for the maximum possible self ID count of 252 (according to
> OHCI 1.1 clause 11.2 and IEEE 1394a-2000 clause 4.3.4.1, i.e. up to four
> self IDs of up to 63 nodes, even though IEEE 1394 up to edition 2008
> defines only up to three self IDs per node).  More than 252 self IDs
> would only happen if the self ID receive DMA unit malfunctioned, which
> would likely be caught by other self ID buffer checks.  However, check
> it early to be sure.  More than 253 quadlets would overflow the Topology
> Map CSR.
> 
> Reported-By: PaX Team
> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> ---
>  drivers/firewire/ohci.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.31-rc9/drivers/firewire/ohci.c
> ===================================================================
> --- linux-2.6.31-rc9.orig/drivers/firewire/ohci.c
> +++ linux-2.6.31-rc9/drivers/firewire/ohci.c
> @@ -1279,8 +1279,8 @@ static void bus_reset_tasklet(unsigned l
>  	 * the inverted quadlets and a header quadlet, we shift one
>  	 * bit extra to get the actual number of self IDs.
>  	 */
> -	self_id_count = (reg >> 3) & 0x3ff;
> -	if (self_id_count == 0) {
> +	self_id_count = (reg >> 3) & 0xff;
> +	if (self_id_count == 0 || self_id_count > 252) {
>  		fw_notify("inconsistent self IDs\n");
>  		return;
>  	}
> 
> -- 
> Stefan Richter
> -=====-==--= =--= --==-
> http://arcgraph.de/sr/
> 
> 




  reply	other threads:[~2009-09-07 20:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-06 16:46 [PATCH 0/6] firewire: minor fixes and cleanups Stefan Richter
2009-09-06 16:48 ` [PATCH 1/6] firewire: core: reduce stack usage in bus reset tasklet Stefan Richter
2009-09-07 19:02   ` pageexec
2009-09-07 19:15     ` Stefan Richter
2009-09-07 21:24       ` Stefan Richter
2009-09-06 16:49 ` [PATCH 2/6] firewire: ohci: fix Self ID Count register mask (safeguard against buffer overflow) Stefan Richter
2009-09-07 18:56   ` pageexec [this message]
2009-09-07 19:28     ` Stefan Richter
2009-09-06 16:49 ` [PATCH 3/6] firewire: core: header file cleanup Stefan Richter
2009-09-06 16:50 ` [PATCH 4/6] firewire: core: fix race with parallel PCI device probe Stefan Richter
2009-09-06 16:50 ` [PATCH 5/6] firewire: reduce some memsets Stefan Richter
2009-09-06 16:51 ` [PATCH 6/6] firewire: sbp2: fix status reception Stefan Richter

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=4AA5575E.6620.3D14E038@pageexec.freemail.hu \
    --to=pageexec@freemail.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=stable@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

all inboxes | Powered by JetHome®