All of lore.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: "Michael Büsch" <mb@bu3sch.de>
Cc: John W Linville <linville@tuxdriver.com>,
	b43-dev@lists.infradead.org, linux-wireless@vger.kernel.org
Subject: [RFC/RFT] ssb: Attempt to recover from SPROM CRC error
Date: Thu, 02 Dec 2010 19:09:40 -0600	[thread overview]
Message-ID: <4CF84354.1090803@lwfinger.net> (raw)
In-Reply-To: <1291328154.13801.0.camel@maggie>

On 12/02/2010 04:15 PM, Michael B?sch wrote:
> On Thu, 2010-12-02 at 10:36 -0600, Larry Finger wrote: 
>> Current code defaults to SPROM revision 1 if there is a CRC error. In at
>> least one known case, most of the corrupt contents are reasonable and
>> it is possible to extract the correct MAC address and TX power settings
>> from what is read. With this patch, an attempt is made to match the
>> apparent revision number with certain SPROM signatures. For those revisions
>> without such a feature, a reasonable guess is made. If the apparent
>> revision is invalid, or if the signature does not match, the previous
>> behavior is kept.
>>
>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>> ---
>>
>> John,
>>
>> Could you please test this patch with your card?
>>
>> Thanks,
>>
>> Larry
>> ---
>>
>> Index: linux-2.6/drivers/ssb/pci.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/ssb/pci.c
>> +++ linux-2.6/drivers/ssb/pci.c
>> @@ -620,6 +620,7 @@ static int ssb_pci_sprom_get(struct ssb_
>>  	const struct ssb_sprom *fallback;
>>  	int err = -ENOMEM;
>>  	u16 *buf;
>> +	u16 revision;
>>  
>>  	if (!ssb_is_sprom_available(bus)) {
>>  		ssb_printk(KERN_ERR PFX "No SPROM available!\n");
>> @@ -671,6 +672,50 @@ static int ssb_pci_sprom_get(struct ssb_
>>  			}
>>  			ssb_printk(KERN_WARNING PFX "WARNING: Invalid"
>>  				   " SPROM CRC (corrupt SPROM)\n");
>> +			/* At this point, we have a faulty SPROM image.
>> +			 * In case only part of it is corrupt, try to
>> +			 * determine what rev we might have */
>> +			revision = buf[SSB_SPROMSIZE_WORDS_R4 - 1] & 0x00FF;
> 
> I think this could possibly overrun the buffer, or did I get something
> wrong?

At this point, we have gotten a CRC error with the small SPROM and expanded the
memory for the 440 byte size, and gotten a second CRC error. This test will be
OK here.

Larry

WARNING: multiple messages have this Message-ID (diff)
From: Larry Finger <Larry.Finger@lwfinger.net>
To: "Michael Büsch" <mb@bu3sch.de>
Cc: John W Linville <linville@tuxdriver.com>,
	b43-dev@lists.infradead.org, linux-wireless@vger.kernel.org
Subject: Re: [RFC/RFT] ssb: Attempt to recover from SPROM CRC error
Date: Thu, 02 Dec 2010 19:09:40 -0600	[thread overview]
Message-ID: <4CF84354.1090803@lwfinger.net> (raw)
In-Reply-To: <1291328154.13801.0.camel@maggie>

On 12/02/2010 04:15 PM, Michael Büsch wrote:
> On Thu, 2010-12-02 at 10:36 -0600, Larry Finger wrote: 
>> Current code defaults to SPROM revision 1 if there is a CRC error. In at
>> least one known case, most of the corrupt contents are reasonable and
>> it is possible to extract the correct MAC address and TX power settings
>> from what is read. With this patch, an attempt is made to match the
>> apparent revision number with certain SPROM signatures. For those revisions
>> without such a feature, a reasonable guess is made. If the apparent
>> revision is invalid, or if the signature does not match, the previous
>> behavior is kept.
>>
>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>> ---
>>
>> John,
>>
>> Could you please test this patch with your card?
>>
>> Thanks,
>>
>> Larry
>> ---
>>
>> Index: linux-2.6/drivers/ssb/pci.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/ssb/pci.c
>> +++ linux-2.6/drivers/ssb/pci.c
>> @@ -620,6 +620,7 @@ static int ssb_pci_sprom_get(struct ssb_
>>  	const struct ssb_sprom *fallback;
>>  	int err = -ENOMEM;
>>  	u16 *buf;
>> +	u16 revision;
>>  
>>  	if (!ssb_is_sprom_available(bus)) {
>>  		ssb_printk(KERN_ERR PFX "No SPROM available!\n");
>> @@ -671,6 +672,50 @@ static int ssb_pci_sprom_get(struct ssb_
>>  			}
>>  			ssb_printk(KERN_WARNING PFX "WARNING: Invalid"
>>  				   " SPROM CRC (corrupt SPROM)\n");
>> +			/* At this point, we have a faulty SPROM image.
>> +			 * In case only part of it is corrupt, try to
>> +			 * determine what rev we might have */
>> +			revision = buf[SSB_SPROMSIZE_WORDS_R4 - 1] & 0x00FF;
> 
> I think this could possibly overrun the buffer, or did I get something
> wrong?

At this point, we have gotten a CRC error with the small SPROM and expanded the
memory for the 440 byte size, and gotten a second CRC error. This test will be
OK here.

Larry

  reply	other threads:[~2010-12-03  1:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02 16:36 [RFC/RFT] ssb: Attempt to recover from SPROM CRC error Larry Finger
2010-12-02 17:55 ` Rafał Miłecki
2010-12-02 17:55   ` Rafał Miłecki
2010-12-02 17:59 ` Rafał Miłecki
2010-12-02 17:59   ` Rafał Miłecki
2010-12-02 22:15 ` Michael Büsch
2010-12-02 22:15   ` Michael Büsch
2010-12-03  1:09   ` Larry Finger [this message]
2010-12-03  1:09     ` Larry Finger

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=4CF84354.1090803@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=b43-dev@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mb@bu3sch.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.