Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: linux@audioscience.com
To: patch@alsa-project.org
Cc: tiwai@suse.de,
	Eliot Blennerhassett <eblennerhassett@audioscience.com>,
	alsa-devel@alsa-project.org,
	Eliot Blennerhassett <eliot@zaphod.clear.net.nz>
Subject: [PATCH - asihpi 2/3] Include adapter buffer alloc inside adapter mutex
Date: Thu, 21 Aug 2008 13:29:55 +1200	[thread overview]
Message-ID: <1219282196-20834-2-git-send-email-linux@audioscience.com> (raw)
In-Reply-To: <1219282196-20834-1-git-send-email-linux@audioscience.com>

From: Eliot Blennerhassett <eliot@zaphod.(none)>


Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>

diff --git a/pci/asihpi/hpioctl.c b/pci/asihpi/hpioctl.c
index 27a273a..8222178 100644
--- a/pci/asihpi/hpioctl.c
+++ b/pci/asihpi/hpioctl.c
@@ -159,6 +159,9 @@ long asihpi_hpi_ioctl(
 			return 0;
 		}
 
+		if (mutex_lock_interruptible(&adapters[nAdapter].mutex))
+			return -EINTR;
+
 		/* Dig out any pointers embedded in the message.  */
 		switch (hm.wFunction) {
 		case HPI_SUBSYS_CREATE_ADAPTER:
@@ -216,9 +219,6 @@ long asihpi_hpi_ioctl(
 			break;
 		}
 
-		if (mutex_lock_interruptible(&adapters[nAdapter].mutex))
-			return -EINTR;
-
 		if (wrflag == 0) {
 			uncopied_bytes =
 				copy_from_user(pa->pBuffer, ptr, size);
@@ -246,11 +246,10 @@ long asihpi_hpi_ioctl(
 	/* on return response size must be set */
 	if (!hr.wSize)
 		return -EFAULT;
-
-	/* Copy the response back to user space.  */
 	uncopied_bytes = copy_to_user(phr, &hr, sizeof(hr));
 	if (uncopied_bytes)
 		return -EFAULT;
+
 	return 0;
 }
 
-- 
1.5.4.3

  reply	other threads:[~2008-08-21  1:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21  1:29 [PATCH - asihpi 1/3] Fix format in portable way linux
2008-08-21  1:29 ` linux [this message]
2008-08-21  1:29   ` [PATCH - asihpi 3/3] Add support for ASI50xx SSX (multichannel) mode linux
2008-08-21  9:08 ` [PATCH - asihpi 1/3] Fix format in portable way Takashi Iwai

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=1219282196-20834-2-git-send-email-linux@audioscience.com \
    --to=linux@audioscience.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=eblennerhassett@audioscience.com \
    --cc=eliot@zaphod.clear.net.nz \
    --cc=patch@alsa-project.org \
    --cc=tiwai@suse.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