From: Kinglong Mee <kinglongmee@gmail.com>
To: Steve Dickson <SteveD@redhat.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
Christoph Hellwig <hch@infradead.org>,
kinglongmee@gmail.com
Subject: [PATCH] blkmapd: Fix infinite loop when reading serial
Date: Thu, 28 May 2015 12:04:07 +0800 [thread overview]
Message-ID: <556693B7.6040501@gmail.com> (raw)
If (dev_id->ids & 0xf) < current_id, must updates pos when continue.
Otherwise an infinite loop.
No other places use the pos value, just move to the top of while.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
utils/blkmapd/device-inq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/utils/blkmapd/device-inq.c b/utils/blkmapd/device-inq.c
index c5bf71f..6b56b67 100644
--- a/utils/blkmapd/device-inq.c
+++ b/utils/blkmapd/device-inq.c
@@ -196,6 +196,8 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
while (pos < (len - devid_len)) {
dev_id = (struct bl_dev_id *)&(dev_root->data[pos]);
+ pos += (dev_id->len + devid_len);
+
if ((dev_id->ids & 0xf) < current_id)
continue;
switch (dev_id->ids & 0xf) {
@@ -226,7 +228,6 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
}
if (current_id == 3)
break;
- pos += (dev_id->len + devid_len);
}
out:
if (!serial_out)
--
2.4.1
next reply other threads:[~2015-05-28 4:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 4:04 Kinglong Mee [this message]
2015-06-26 23:12 ` [PATCH] blkmapd: Fix infinite loop when reading serial Kinglong Mee
2015-06-30 18:18 ` Steve Dickson
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=556693B7.6040501@gmail.com \
--to=kinglongmee@gmail.com \
--cc=SteveD@redhat.com \
--cc=hch@infradead.org \
--cc=linux-nfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.