All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm-statistics: better argument validation
@ 2015-06-05 13:50 Mikulas Patocka
  2015-06-05 14:34 ` Mike Snitzer
  0 siblings, 1 reply; 2+ messages in thread
From: Mikulas Patocka @ 2015-06-05 13:50 UTC (permalink / raw)
  To: Mike Snitzer, Alasdair G. Kergon; +Cc: dm-devel

If the number_of_areas argument was zero, the kernel would crash on
div-by-zero. This patch fixes it.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org	# v3.12+

---
 drivers/md/dm-stats.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-4.1-rc6/drivers/md/dm-stats.c
===================================================================
--- linux-4.1-rc6.orig/drivers/md/dm-stats.c	2015-06-05 15:39:58.000000000 +0200
+++ linux-4.1-rc6/drivers/md/dm-stats.c	2015-06-05 15:42:09.000000000 +0200
@@ -795,6 +795,8 @@ static int message_stats_create(struct m
 		return -EINVAL;
 
 	if (sscanf(argv[2], "/%u%c", &divisor, &dummy) == 1) {
+		if (!divisor)
+			return -EINVAL;
 		step = end - start;
 		if (do_div(step, divisor))
 			step++;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: dm-statistics: better argument validation
  2015-06-05 13:50 [PATCH] dm-statistics: better argument validation Mikulas Patocka
@ 2015-06-05 14:34 ` Mike Snitzer
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Snitzer @ 2015-06-05 14:34 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: dm-devel, Alasdair G. Kergon

On Fri, Jun 05 2015 at  9:50am -0400,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> If the number_of_areas argument was zero, the kernel would crash on
> div-by-zero. This patch fixes it.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Cc: stable@vger.kernel.org	# v3.12+
> 

I've applied this for 4.2.

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-05 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-05 13:50 [PATCH] dm-statistics: better argument validation Mikulas Patocka
2015-06-05 14:34 ` Mike Snitzer

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.