projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bccab6a
)
dm stats: fix divide by zero if 'number_of_areas' arg is zero
author
Mikulas Patocka
<mpatocka@redhat.com>
Fri, 5 Jun 2015 13:50:42 +0000
(09:50 -0400)
committer
Mike Snitzer
<snitzer@redhat.com>
Wed, 17 Jun 2015 16:40:39 +0000
(12:40 -0400)
If the number_of_areas argument was zero the kernel would crash on
div-by-zero. Add better input validation.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # v3.12+
drivers/md/dm-stats.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/md/dm-stats.c
b/drivers/md/dm-stats.c
index 492fe6a5ebf2ad5c7178157a1c48a73f390a071d..d1fd31a6dd1ab50112d80d48cd1328841b65ccdd 100644
(file)
--- a/
drivers/md/dm-stats.c
+++ b/
drivers/md/dm-stats.c
@@
-792,6
+792,8
@@
static int message_stats_create(struct mapped_device *md,
return -EINVAL;
if (sscanf(argv[2], "/%u%c", &divisor, &dummy) == 1) {
+ if (!divisor)
+ return -EINVAL;
step = end - start;
if (do_div(step, divisor))
step++;