public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Jaswinder Singh <jaswinder@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	kernel-janitors <kernel-janitors@vger.kernel.org>,
	kernelnewbies <kernelnewbies@nl.linux.org>,
	linux-scsi@vger.kernel.org, hch@infradead.org
Subject: Re: [PATCH] advansys: use request_firmware
Date: Sat, 12 Jul 2008 10:29:21 -0600	[thread overview]
Message-ID: <20080712162921.GZ14894@parisc-linux.org> (raw)
In-Reply-To: <1215770322.2733.12.camel@jaswinder.satnam>

On Fri, Jul 11, 2008 at 03:28:42PM +0530, Jaswinder Singh wrote:
> ???this is a first draft; please be kind :)

Hi Jaswinder, I wondered when you were going to get around to advansys
;-)  My concern is:

> -/* Microcode buffer is kept after initialization for error recovery. */
[...]
> +	err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev);
> +	if (err) {
> +		printk(KERN_ERR "Failed to load image \"%s\" err %d\n",
> +		       fwname, err);
> +		return err;
> +	}
> +	if (fw->size < 4) {
> +		printk(KERN_ERR "Bogus length %d in image \"%s\"\n",
> +		       fw->size, fwname);
> +		release_firmware(fw);
> +		return -EINVAL;
> +	}
> +	chksum = (fw->data[3] << 24) | (fw->data[2] << 16) |
> +		 (fw->data[1] << 8) | fw->data[0];
> +	ASC_DBG(1, "_asc_mcode_chksum 0x%lx\n", (ulong)chksum);
> +	if (AscLoadMicroCode(iop_base, 0, &fw->data[4],
> +			     fw->size - 4) != chksum) {
>  		asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
>  		return warn_code;
>  	}
> +	release_firmware(fw);

You're calling release_firmware() here.  I don't know if that actually
frees the firmware when it's built-in, but if it does, then freeing the
firmware could cause the chip to stop working if it gets reset before
userspace is up.

If it is OK to call release_firmware here, then the error path is
missing a release_firmware() call.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  reply	other threads:[~2008-07-12 16:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-11  9:58 [PATCH] advansys: use request_firmware Jaswinder Singh
2008-07-12 16:29 ` Matthew Wilcox [this message]
2008-07-12 17:09   ` Jaswinder Singh
2008-07-14 14:50     ` Matthew Wilcox
2008-07-14 14:56       ` David Woodhouse
2008-07-14 15:15         ` Matthew Wilcox
2008-07-14 15:22           ` David Woodhouse
  -- strict thread matches above, loose matches on Subject: below --
2008-12-20 15:25 Jaswinder Singh
2008-12-20 15:32 ` Matthew Wilcox
2008-12-20 16:02   ` Jaswinder Singh
2009-01-10 15:20 David Woodhouse

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=20080712162921.GZ14894@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dwmw2@infradead.org \
    --cc=hch@infradead.org \
    --cc=jaswinder@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kernelnewbies@nl.linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.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