From 76a0c0e7d2bef3e06d736c337c82971885904148 Mon Sep 17 00:00:00 2001 From: haad Date: Wed, 9 Sep 2009 22:38:49 +0000 Subject: Fix bug in kmem_alloc/kmem_free of params string. Params string was allocated with length DM_MAX_PARAMS_SIZE and released with strlen + 1 size. Disable KM_NOSLEEP allocation because we do not need them here there is nothing critical in ioctl part of dm driver. Bug reported by jak@. --- sys/dev/dm/dm_target_linear.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/dev/dm/dm_target_linear.c') diff --git a/sys/dev/dm/dm_target_linear.c b/sys/dev/dm/dm_target_linear.c index 33bf191e67e..fb59c9332e5 100644 --- a/sys/dev/dm/dm_target_linear.c +++ b/sys/dev/dm/dm_target_linear.c @@ -1,4 +1,4 @@ -/* $NetBSD: dm_target_linear.c,v 1.6 2009/08/16 11:02:24 yamt Exp $ */ +/* $NetBSD: dm_target_linear.c,v 1.7 2009/09/09 22:38:49 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ dm_target_linear_init(dm_dev_t *dmv, void **target_config, prop_dictionary_t dic aprint_debug("Linear target init function called %s--%"PRIu64"!!\n", device, offset); - if ((tlc = kmem_alloc(sizeof(dm_target_linear_config_t), KM_NOSLEEP)) + if ((tlc = kmem_alloc(sizeof(dm_target_linear_config_t), KM_SLEEP)) == NULL) return 1; @@ -109,7 +109,7 @@ dm_target_linear_status(void *target_config) aprint_debug("Linear target status function called\n"); - if ((params = kmem_alloc(DM_MAX_PARAMS_SIZE, KM_NOSLEEP)) == NULL) + if ((params = kmem_alloc(DM_MAX_PARAMS_SIZE, KM_SLEEP)) == NULL) return NULL; aprint_normal("%s %"PRIu64, tlc->pdev->name, tlc->offset); -- cgit