public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: matthieu castet <castet.matthieu@free.fr>
To: Greg KH <greg@kroah.com>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-usb-devel@lists.sourceforge.net,
	usbatm@lists.infradead.org,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH]  Eagle and ADI 930 usb adsl modem driver
Date: Tue, 08 Nov 2005 00:02:30 +0100	[thread overview]
Message-ID: <436FDD06.607@free.fr> (raw)
In-Reply-To: <436FD4C1.8020402@free.fr>

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

matthieu castet wrote:
> Hi,
> 
> here the corrected version of ueagle-atm.
> 
> The comments of Adrew Morton and Greg KH have been applied.
> We also fix a bug in the check_dsp routine (reported on our mailling 
> list) and kill some unsued code.
> 
> 
> Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
> 
Could you add this fix ?

More care on loading firmware, take into account fw->size can't be zero.

thanks

Matthieu


Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ueagle-atm-hotfix.patch --]
[-- Type: text/x-patch; name="ueagle-atm-hotfix.patch", Size: 1405 bytes --]

--- linux-2.6.14/drivers/usb/atm/ueagle-atm.c	(révision 175)
+++ linux-2.6.14b/drivers/usb/atm/ueagle-atm.c	(copie de travail)
@@ -426,14 +426,14 @@
 
 	pfw = fw_entry->data;
 	size = fw_entry->size;
+	if (size < 4)
+		goto err_fw_corrupted;
 
 	crc = FW_GET_LONG(pfw);
 	pfw += 4;
 	size -= 4;
-	if (crc32_be(0, pfw, size) != crc) {
-		uea_err(usb, "firmware is corrupted\n");
-		goto err;
-	}
+	if (crc32_be(0, pfw, size) != crc)
+		goto err_fw_corrupted;
 
 	/*
 	 * Start to upload formware : send reset
@@ -446,9 +446,14 @@
 		goto err;
 	}
 
-	while (size > 0) {
+	while (size > 3) {
 		u8 len = FW_GET_BYTE(pfw);
 		u16 add = FW_GET_WORD(pfw + 1);
+
+		size -= len + 3;
+		if (size < 0)
+			goto err_fw_corrupted;
+
 		ret = uea_send_modem_cmd(usb, add, len, pfw + 3);
 		if (ret < 0) {
 			uea_err(usb, "uploading firmware data failed "
@@ -456,9 +461,11 @@
 			goto err;
 		}
 		pfw += len + 3;
-		size -= len + 3;
 	}
 
+	if (size != 0)
+		goto err_fw_corrupted;
+
 	/*
 	 * Tell the modem we finish : de-assert reset
 	 */
@@ -469,6 +476,11 @@
 	else
 		uea_info(usb, "firmware uploaded\n");
 
+	uea_leaves(usb);
+	return;
+
+err_fw_corrupted:
+	uea_err(usb, "firmware is corrupted\n");
 err:
 	uea_leaves(usb);
 }
@@ -522,10 +534,6 @@
 	u32 pageoffset;
 	unsigned int i, j, p, pp;
 
-	/* enough space for pagecount? */
-	if (len < 1)
-		return 1;
-
 	pagecount = FW_GET_BYTE(dsp);
 	p = 1;
 

      reply	other threads:[~2005-11-07 23:02 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-29 22:37 [PATCH] Eagle and ADI 930 usb adsl modem driver matthieu castet
2005-10-31 23:58 ` Andrew Morton
2005-11-01 12:40   ` Duncan Sands
2005-11-01 13:04     ` David Woodhouse
2005-11-01 13:12       ` Marco d'Itri
2005-11-02  7:42       ` Duncan Sands
2005-11-02  7:45         ` David Woodhouse
2005-11-02  8:02           ` Duncan Sands
2005-11-02 10:46       ` Roman Kagan
2005-11-02 11:01         ` Duncan Sands
2005-11-01 13:49     ` matthieu castet
2005-11-02  5:29       ` Andrew Morton
2005-11-02 22:27         ` Greg KH
2005-11-02  7:45       ` Duncan Sands
2005-11-01 14:08   ` matthieu castet
2005-11-02  5:34     ` Andrew Morton
2005-11-02  7:47     ` Duncan Sands
2005-11-01 22:45 ` Greg KH
2005-11-02  7:54   ` Duncan Sands
2005-11-02  8:03     ` Greg KH
2005-11-02  8:45       ` [linux-usb-devel] " Oliver Neukum
2005-11-02  8:52         ` Duncan Sands
2005-11-02 21:39           ` Greg KH
2005-11-02 21:37         ` Greg KH
2005-11-02 15:56   ` Alan Stern
2005-11-02 20:15   ` matthieu castet
2005-11-02 21:18     ` matthieu castet
2005-11-07 17:47       ` Greg KH
2005-11-06 18:44     ` matthieu castet
2005-11-07 17:47       ` Greg KH
2005-11-07 17:46     ` Greg KH
2005-11-07 18:47       ` matthieu castet
2005-11-07 22:27       ` matthieu castet
2005-11-07 23:02         ` matthieu castet [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=436FDD06.607@free.fr \
    --to=castet.matthieu@free.fr \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=usbatm@lists.infradead.org \
    /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