public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: torvalds@osdl.org, akpm@osdl.org, rdunlap@xenotime.net,
	mst@mellanox.co.il, linux-kernel@vger.kernel.org
Cc: bunk@stusta.de, pavel@suse.cz, len.brown@intel.com,
	linux-acpi@vger.kernel.org, linux-pm@osdl.org,
	martin@lorenz.eu.org
Subject: [PATCH 2.6.19-rc3] (1/2) fix bd_claim_by_kobject error handling
Date: Mon, 30 Oct 2006 16:23:45 -0500	[thread overview]
Message-ID: <45466D61.5070701@ce.jp.nec.com> (raw)

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

Hi,

Excuse me for the long Cc list.
I kept people in the thread below in Cc.
http://marc.theaimsgroup.com/?l=linux-kernel&m=116221664710826&w=2

The patch below fixes bd_claim_by_kobject to release bdev correctly
in case that bd_claim succeeds but following add_bd_holder fails.

If it happens, the caller takes it didn't bd_claim() where actually
it did. The bdev becomes no longer bd_claim-able from others.
I don't have any reproducible test case for it but it's a bug.
The bug is introduced in 2.6.18-rc1-mm2 and now in 2.6.19-rc3.

Please consider to apply.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America

[-- Attachment #2: fix-bd_claim_by_kobject-error-handling.patch --]
[-- Type: text/x-patch, Size: 732 bytes --]

The patch below fixes bd_claim_by_kobject to release bdev correctly
in case that bd_claim succeeds but following add_bd_holder fails.

 fs/block_dev.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>

--- linux-2.6.orig/fs/block_dev.c	2006-10-30 10:07:16.000000000 -0500
+++ linux-2.6/fs/block_dev.c	2006-10-30 15:38:21.000000000 -0500
@@ -751,8 +751,11 @@ static int bd_claim_by_kobject(struct bl
 
 	mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_PARTITION);
 	res = bd_claim(bdev, holder);
-	if (res == 0)
+	if (res == 0) {
 		res = add_bd_holder(bdev, bo);
+		if (res)
+			bd_release(bdev);
+	}
 	if (res)
 		free_bd_holder(bo);
 	mutex_unlock(&bdev->bd_mutex);

                 reply	other threads:[~2006-10-30 21:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=45466D61.5070701@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.com \
    --cc=akpm@osdl.org \
    --cc=bunk@stusta.de \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@osdl.org \
    --cc=martin@lorenz.eu.org \
    --cc=mst@mellanox.co.il \
    --cc=pavel@suse.cz \
    --cc=rdunlap@xenotime.net \
    --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