public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@redhat.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Subject: One more unlock missing in error case
Date: Sat, 04 Feb 2006 09:23:36 -0800	[thread overview]
Message-ID: <43E4E318.1030304@redhat.com> (raw)

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

This patch is needed to in addition to the other unlocking fix which is
already applied.  It should be obvious that the system will deadlock in
case this isn't done.

(Andrew, I once again used a goto in the third error case because the
common code is again larger.)

Signed-Off-By: Ulrich Drepper <drepper@redhat.com>

--- fs/namei.c	2006-02-01 09:29:49.000000000 -0800
+++ fs/namei.c-new	2006-02-04 09:18:02.000000000 -0800
@@ -1096,6 +1096,7 @@

 		file = fget_light(dfd, &fput_needed);
 		if (!file) {
+			read_unlock(&current->fs->lock);
 			retval = -EBADF;
 			goto out_fail;
 		}
@@ -1104,15 +1105,15 @@

 		if (!S_ISDIR(dentry->d_inode->i_mode)) {
 			retval = -ENOTDIR;
+		unlock_fail:
 			fput_light(file, fput_needed);
+			read_unlock(&current->fs->lock);
 			goto out_fail;
 		}

 		retval = file_permission(file, MAY_EXEC);
-		if (retval) {
-			fput_light(file, fput_needed);
-			goto out_fail;
-		}
+		if (retval)
+			goto unlock_fail;

 		nd->mnt = mntget(file->f_vfsmnt);
 		nd->dentry = dget(dentry);


-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

             reply	other threads:[~2006-02-04 17:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-04 17:23 Ulrich Drepper [this message]
2006-02-05  0:08 ` One more unlock missing in error case Andrew Morton
2006-02-05  0:49   ` Ulrich Drepper
2006-02-05  1:46   ` Adrian Bunk

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=43E4E318.1030304@redhat.com \
    --to=drepper@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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