From: tang.junhui@zte.com.cn
To: agk@redhat.com, snitzer@redhat.com
Cc: zhang.kai16@zte.com.cn, dm-devel@redhat.com,
"tang.junhui" <tang.junhui@zte.com.cn>
Subject: [PATCH] dm mpath: add check for count of groups to avoid wild pointer access
Date: Thu, 3 Nov 2016 18:49:30 +0800 [thread overview]
Message-ID: <1478170170-4748-1-git-send-email-tang.junhui@zte.com.cn> (raw)
From: "tang.junhui" <tang.junhui@zte.com.cn>
pg is not assigned to a group address when count of multipath groups
is zero in bypass_pg_num(), then it is used in bypass_pg(), which may
cause wild pointer access.
Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
---
drivers/md/dm-mpath.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index d376dc8..8c1359c 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1084,7 +1084,7 @@ static int switch_pg_num(struct multipath *m, const char *pgstr)
char dummy;
if (!pgstr || (sscanf(pgstr, "%u%c", &pgnum, &dummy) != 1) || !pgnum ||
- (pgnum > m->nr_priority_groups)) {
+ !m->nr_priority_groups || (pgnum > m->nr_priority_groups)) {
DMWARN("invalid PG number supplied to switch_pg_num");
return -EINVAL;
}
--
2.8.1.windows.1
next reply other threads:[~2016-11-03 10:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 10:49 tang.junhui [this message]
2016-11-03 15:24 ` dm mpath: add check for count of groups to avoid wild pointer access Mike Snitzer
2016-11-04 4:11 ` 答复: " tang.junhui
2016-11-04 4:37 [PATCH] " tang.junhui
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=1478170170-4748-1-git-send-email-tang.junhui@zte.com.cn \
--to=tang.junhui@zte.com.cn \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=snitzer@redhat.com \
--cc=zhang.kai16@zte.com.cn \
/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.