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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130207182526.GP2875@htj.dyndns.org>
Date:	Thu, 7 Feb 2013 10:25:26 -0800
From:	Tejun Heo <tj@...nel.org>
To:	akpm@...ux-foundation.org
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH 22.5/77] block/loop: fix error return value in loop_add()

If queue or disk allocation fails, loop_add() returns @err, which is
cleared to zero by idr allocation by that point.  Reset @err to
-ENOMEM before the allocations so that we return -ENOMEM instead of 0
on alloc failure.

Signed-off-by: Tejun Heo <tj@...nel.org>
Cc: Jens Axboe <axboe@...nel.dk>
Cc: stable@...r.kernel.org
---
Hey, guys.

I was going through the conversions one more time and noticed this
existing bug.  We're returning 0 on alloc failure.  It seems the worst
which can come out of this is userland misled to believe a loop device
has been created when in fact it failed.  This can be routed
separately but it probably is easier to route with other changes.

Thanks!

 drivers/block/loop.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1649,6 +1649,7 @@ static int loop_add(struct loop_device *
 	if (err < 0)
 		goto out_free_dev;
 
+	err = -ENOMEM;
 	lo->lo_queue = blk_alloc_queue(GFP_KERNEL);
 	if (!lo->lo_queue)
 		goto out_free_dev;
--
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