From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@fb.com>, linux-block@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>,
Josef Bacik <jbacik@fb.com>, Ming Lei <ming.lei@redhat.com>
Subject: [PATCH] block: nbd: fix double free
Date: Fri, 28 Apr 2017 12:29:42 +0800 [thread overview]
Message-ID: <20170428042942.6567-1-ming.lei@redhat.com> (raw)
Looks it is a typo, just fix it, otherwise the following
warning can be trigerred:
[ming@VM]$sudo rmmod nbd
[sudo] password for ming:
==================================================================
BUG: KASAN: use-after-free in nbd_cleanup+0x115/0x18e [nbd] at addr ffff88024ca539b0
Read of size 8 by task rmmod/2079
Object at ffff88024ca53900, in cache kmalloc-256 size: 256
Allocated:
PID = 1414
Freed:
PID = 2079
Memory state around the buggy address:
ffff88024ca53880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88024ca53900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88024ca53980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88024ca53a00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff88024ca53a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Fixes: c6a4759ea0c9(nbd: add device refcounting)
Cc: Josef Bacik <jbacik@fb.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
drivers/block/nbd.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 5583dc4ff941..fa44a6fce4cb 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -2110,7 +2110,6 @@ static void __exit nbd_cleanup(void)
if (refcount_read(&nbd->refs) != 2)
printk(KERN_ERR "nbd: possibly leaking a device\n");
nbd_put(nbd);
- nbd_put(nbd);
}
idr_destroy(&nbd_index_idr);
--
2.9.3
next reply other threads:[~2017-04-28 4:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 4:29 Ming Lei [this message]
2017-04-28 13:00 ` [PATCH] block: nbd: fix double free Josef Bacik
2017-04-28 15:27 ` Ming Lei
2017-04-28 15:29 ` Josef Bacik
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=20170428042942.6567-1-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=axboe@fb.com \
--cc=hch@infradead.org \
--cc=jbacik@fb.com \
--cc=linux-block@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).