lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1268432082.2802.401.camel@mulgrave.site>
Date:	Fri, 12 Mar 2010 16:14:42 -0600
From:	James Bottomley <James.Bottomley@...e.de>
To:	Jani Nikula <ext-jani.1.nikula@...ia.com>
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	linux-scsi <linux-scsi@...r.kernel.org>
Subject: Re: [PATCH] enclosure: fix error path - actually return ERR_PTR()
 on error

On Fri, 2010-03-12 at 15:50 +0200, Jani Nikula wrote:
> Signed-off-by: Jani Nikula <ext-jani.1.nikula@...ia.com>
> 
> ---
> 
> NOTE: I'm afraid I'm unable to test this; please consider this more a
> bug report than a complete patch.

It's a good bug report, thanks.  It looks like there's an unreleased
cdev pointer along that path too, so this should be the final fix.

James

---

diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index 1eac626..68e4cd7 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -284,8 +284,11 @@ enclosure_component_register(struct enclosure_device *edev,
 	cdev->groups = enclosure_groups;
 
 	err = device_register(cdev);
-	if (err)
-		ERR_PTR(err);
+	if (err) {
+		ecomp->number = -1;
+		put_device(cdev);
+		return ERR_PTR(err);
+	}
 
 	return ecomp;
 }



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ