LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: linux-usb-devel@lists.sourceforge.net, greg@kroah.com,
	linux-kernel@vger.kernel.org, vitalivanov@gmail.com,
	netwiz@crc.id.au
Subject: Re: USB: FIx locks and urb->status in adutux
Date: Wed, 24 Oct 2007 16:49:12 +0200	[thread overview]
Message-ID: <200710241649.13257.oliver@neukum.org> (raw)
In-Reply-To: <20071023185302.5ce9d187.zaitcev@redhat.com>

Am Mittwoch 24 Oktober 2007 schrieb Pete Zaitcev:
> Oliver, thanks for the inftdata catch. I also fixed the sleep_on.

But you are leaving a function while still on a waitqueue left on the stack.
Here's a patch on top of yours.

	Regards
		Oliver

----

--- work/drivers/usb/misc/adutux.c.alt	2007-10-24 16:36:02.000000000 +0200
+++ work/drivers/usb/misc/adutux.c	2007-10-24 16:36:06.000000000 +0200
@@ -567,19 +567,21 @@ static ssize_t adu_write(struct file *fi
 
 	retval = mutex_lock_interruptible(&dev->mtx);
 	if (retval)
-		goto exit_nolock;
+		goto exit_nolock_intr;
 
 	/* verify that the device wasn't unplugged */
 	if (dev->udev == NULL) {
+		mutex_unlock(&dev->mtx);
 		retval = -ENODEV;
 		err("No device or device unplugged %d", retval);
-		goto exit;
+		goto exit_nolock_intr;
 	}
 
 	/* verify that we actually have some data to write */
 	if (count == 0) {
+		mutex_unlock(&dev->mtx);
 		dbg(1," %s : write request of 0 bytes", __FUNCTION__);
-		goto exit;
+		goto exit_nolock_intr;
 	}
 
 	add_wait_queue(&dev->write_wait, &waita);
@@ -649,13 +651,14 @@ static ssize_t adu_write(struct file *fi
 			bytes_written += bytes_to_write;
 		}
 	}
-	remove_wait_queue(&dev->write_wait, &waita);
 
 	retval = bytes_written;
 
 exit:
 	mutex_unlock(&dev->mtx);
 exit_nolock:
+	remove_wait_queue(&dev->write_wait, &waita);
+exit_nolock_intr:
 
 	dbg(2," %s : leave, return value %d", __FUNCTION__, retval);
 

  parent reply	other threads:[~2007-10-24 14:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-23  3:34 Pete Zaitcev
2007-10-23  9:38 ` [linux-usb-devel] " Oliver Neukum
2007-10-23 21:38   ` Pete Zaitcev
2007-10-24 14:04     ` Oliver Neukum
2007-10-24  1:53   ` Pete Zaitcev
2007-10-24 14:09     ` Vitaliy Ivanov
2007-10-25  3:20       ` Pete Zaitcev
2007-10-25  3:25       ` Pete Zaitcev
     [not found]         ` <200710251403.48688.oliver@neukum.org>
2007-10-25 16:38           ` Pete Zaitcev
2007-10-29 18:04         ` Vitaliy Ivanov
2007-10-30  4:24           ` Pete Zaitcev
2007-10-30 13:09             ` Vitaliy Ivanov
2007-10-30 21:54               ` Pete Zaitcev
2007-10-31 11:54                 ` Vitaliy Ivanov
2007-10-31 22:01                   ` Pete Zaitcev
2007-11-01  9:06                     ` Vitaliy Ivanov
2007-11-01 17:28                       ` Pete Zaitcev
2007-10-24 14:49     ` Oliver Neukum [this message]
2007-10-24 21:25       ` Greg KH
2007-10-26  9:57         ` Vitaliy Ivanov

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=200710241649.13257.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=netwiz@crc.id.au \
    --cc=vitalivanov@gmail.com \
    --cc=zaitcev@redhat.com \
    --subject='Re: USB: FIx locks and urb->status in adutux' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).