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-next>] [day] [month] [year] [list]
Date:	Tue, 7 Jan 2014 17:57:23 -0800
From:	Muthu Kumar <muthu.lkml@...il.com>
To:	Jens Axboe <axboe@...nel.dk>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [block:for-3.14/core]: bio_endio: Warn and free bio if bi_end_io is
 not set.

Jens,
In bio_endio if bio doesn't have bi_end_io (should be an error case),
we set bio to NULL and continue silently without freeing the bio. It
would be good to have a WARN and free the bio to avoid memory leak.

If you agree, here is the patch.

---------
bio_endio: Warn and free bio if bi_end_io is not set

Signed-off-by: Muthukumar Ratty <muthur@...il.com>
--------
 fs/bio.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/fs/bio.c b/fs/bio.c
index 75c49a3..581806d 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1768,8 +1768,15 @@ void bio_endio(struct bio *bio, int error)
             bio_put(bio);
             bio = parent;
         } else {
-            if (bio->bi_end_io)
+            if (likely(bio->bi_end_io)) {
                 bio->bi_end_io(bio, error);
+            } else {
+                char dev_name[BDEVNAME_SIZE];
+                WARN(1, "bio_endio: bio for device %s without endio\n",
+                        bio->bi_bdev ? bdevname(bio->bi_bdev,
dev_name) : "(unknown)");
+                bio_put(bio);
+            }
+
             bio = NULL;
         }
     }

---------------
--
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