Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Device-mapper Development (http://www.linux-archive.org/device-mapper-development/)
-   -   dm persistent data: handle space map checker creation failure (http://www.linux-archive.org/device-mapper-development/675530-dm-persistent-data-handle-space-map-checker-creation-failure.html)

Mike Snitzer 06-21-2012 06:57 PM

dm persistent data: handle space map checker creation failure
 
If CONFIG_DM_DEBUG_SPACE_MAPS is enabled and dm_sm_checker_create()
fails, dm_tm_create_internal() would still return success even though it
cleaned up all resources it was supposed to have created.

Fix the space map checker code to return an appropriate ERR_PTR and have
dm_sm_disk_create() and dm_tm_create_internal() check for it with IS_ERR.

Reported-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
---
drivers/md/persistent-data/dm-space-map-checker.c | 24 ++++++++++----------
drivers/md/persistent-data/dm-space-map-disk.c | 8 +++++-
.../md/persistent-data/dm-transaction-manager.c | 8 +++++-
3 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/drivers/md/persistent-data/dm-space-map-checker.c b/drivers/md/persistent-data/dm-space-map-checker.c
index 50ed53b..6d7c832 100644
--- a/drivers/md/persistent-data/dm-space-map-checker.c
+++ b/drivers/md/persistent-data/dm-space-map-checker.c
@@ -343,25 +343,25 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm)
int r;
struct sm_checker *smc;

- if (!sm)
- return NULL;
+ if (IS_ERR_OR_NULL(sm))
+ return ERR_PTR(-EINVAL);

smc = kmalloc(sizeof(*smc), GFP_KERNEL);
if (!smc)
- return NULL;
+ return ERR_PTR(-ENOMEM);

memcpy(&smc->sm, &ops_, sizeof(smc->sm));
r = ca_create(&smc->old_counts, sm);
if (r) {
kfree(smc);
- return NULL;
+ return ERR_PTR(r);
}

r = ca_create(&smc->counts, sm);
if (r) {
ca_destroy(&smc->old_counts);
kfree(smc);
- return NULL;
+ return ERR_PTR(r);
}

smc->real_sm = sm;
@@ -371,7 +371,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm)
ca_destroy(&smc->counts);
ca_destroy(&smc->old_counts);
kfree(smc);
- return NULL;
+ return ERR_PTR(r);
}

r = ca_commit(&smc->old_counts, &smc->counts);
@@ -379,7 +379,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm)
ca_destroy(&smc->counts);
ca_destroy(&smc->old_counts);
kfree(smc);
- return NULL;
+ return ERR_PTR(r);
}

return &smc->sm;
@@ -391,25 +391,25 @@ struct dm_space_map *dm_sm_checker_create_fresh(struct dm_space_map *sm)
int r;
struct sm_checker *smc;

- if (!sm)
- return NULL;
+ if (IS_ERR_OR_NULL(sm))
+ return ERR_PTR(-EINVAL);

smc = kmalloc(sizeof(*smc), GFP_KERNEL);
if (!smc)
- return NULL;
+ return ERR_PTR(-ENOMEM);

memcpy(&smc->sm, &ops_, sizeof(smc->sm));
r = ca_create(&smc->old_counts, sm);
if (r) {
kfree(smc);
- return NULL;
+ return ERR_PTR(r);
}

r = ca_create(&smc->counts, sm);
if (r) {
ca_destroy(&smc->old_counts);
kfree(smc);
- return NULL;
+ return ERR_PTR(r);
}

smc->real_sm = sm;
diff --git a/drivers/md/persistent-data/dm-space-map-disk.c b/drivers/md/persistent-data/dm-space-map-disk.c
index fc469ba..c3ebf76 100644
--- a/drivers/md/persistent-data/dm-space-map-disk.c
+++ b/drivers/md/persistent-data/dm-space-map-disk.c
@@ -290,7 +290,13 @@ struct dm_space_map *dm_sm_disk_create(struct dm_transaction_manager *tm,
dm_block_t nr_blocks)
{
struct dm_space_map *sm = dm_sm_disk_create_real(tm, nr_blocks);
- return dm_sm_checker_create_fresh(sm);
+ struct dm_space_map *smc = dm_sm_checker_create_fresh(sm);
+
+ if (IS_ERR(smc) && !IS_ERR_OR_NULL(sm))
+ dm_sm_destroy(sm);
+ sm = smc;
+
+ return sm;
}
EXPORT_SYMBOL_GPL(dm_sm_disk_create);

diff --git a/drivers/md/persistent-data/dm-transaction-manager.c b/drivers/md/persistent-data/dm-transaction-manager.c
index 02bf78e..e5604b3 100644
--- a/drivers/md/persistent-data/dm-transaction-manager.c
+++ b/drivers/md/persistent-data/dm-transaction-manager.c
@@ -347,8 +347,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm,
}

*sm = dm_sm_checker_create(inner);
- if (!*sm)
+ if (IS_ERR(*sm)) {
+ r = PTR_ERR(*sm);
goto bad2;
+ }

} else {
r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location,
@@ -367,8 +369,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm,
}

*sm = dm_sm_checker_create(inner);
- if (!*sm)
+ if (IS_ERR(*sm)) {
+ r = PTR_ERR(*sm);
goto bad2;
+ }
}

return 0;
--
1.7.4.4

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


Thu Jun 21 21:30:01 2012
Return-Path: <centos-bounces@centos.org>
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
eagle542.startdedicated.com
X-Spam-Level:
X-Spam-Status: No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,
T_RP_MATCHES_RCVD autolearn=ham version=3.3.1
X-Original-To: tom@linux-archive.org
Delivered-To: tom-linux-archive.org@eagle542.startdedicated.com
Received: from mail.centos.org (mail.centos.org [72.26.200.202])
by eagle542.startdedicated.com (Postfix) with ESMTP id 9BFD220E033C
for <tom@linux-archive.org>; Thu, 21 Jun 2012 21:06:19 +0200 (CEST)
Received: from mail.centos.org (voxeldev.centos.org [127.0.0.1])
by mail.centos.org (Postfix) with ESMTP id 8C0F86F664;
Thu, 21 Jun 2012 15:06:14 -0400 (EDT)
X-Original-To: centos@centos.org
Delivered-To: centos@centos.org
Received: from mail.infoline.su (mail.infoline.su [83.217.192.4])
by mail.centos.org (Postfix) with ESMTP id 3A14E67AD0
for <centos@centos.org>; Thu, 21 Jun 2012 15:06:12 -0400 (EDT)
Received: from angara.iproducts.test (unknown [89.169.57.139])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(No client certificate requested)
by mail.infoline.su (Postfix) with ESMTP id C83EB1140A
for <centos@centos.org>; Thu, 21 Jun 2012 23:06:12 +0400 (MSK)
Received: from localhost ([127.0.0.1] helo=test1.iproducts.test)
by angara.iproducts.test with esmtp (Exim 4.63)
(envelope-from <nevis2us@infoline.su>) id 1Shmhn-0006M6-J6
for centos@centos.org; Thu, 21 Jun 2012 23:06:12 +0400
MIME-Version: 1.0
Date: Thu, 21 Jun 2012 22:06:11 +0300
From: =?UTF-8?Q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0= B4=D1=80_?=
=?UTF-8?Q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=D0=BE=D0= B2?=
<nevis2us@infoline.su>
To: <centos@centos.org>
In-Reply-To: <CAOZy0e=gJZUDaM8stVWZrhy0wq3dDQAFYQzJehDHCU08QRKy Mw@mail.gmail.com>
References: <CAOZy0e=gJZUDaM8stVWZrhy0wq3dDQAFYQzJehDHCU08QRKy Mw@mail.gmail.com>
Message-ID: <3963bb44a127cd6436da6c64852b37bd@test1.iproducts. test>
X-Sender: nevis2us@infoline.su
User-Agent: Roundcube Webmail/0.5.1
Subject: Re: [CentOS] basic auth fails
X-BeenThere: centos@centos.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: CentOS mailing list <centos@centos.org>
List-Id: CentOS mailing list <centos.centos.org>
List-Unsubscribe: <http://lists.centos.org/mailman/listinfo/centos>,
<mailto:centos-request@centos.org?subject=unsubscribe>
List-Archive: <http://lists.centos.org/pipermail/centos>
List-Post: <mailto:centos@centos.org>
List-Help: <mailto:centos-request@centos.org?subject=help>
List-Subscribe: <http://lists.centos.org/mailman/listinfo/centos>,
<mailto:centos-request@centos.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: centos-bounces@centos.org
Errors-To: centos-bounces@centos.org

> I've setup apache basic auth on by web server to protect my nagios
> site. It's been working just fine, but suddenly it stopped accepting
> passwords even tho they are being typed in correctly. I was wondering
> if I could get some advice on how to troubleshoot this?

Check permissions and selinux context of the auth file.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


All times are GMT. The time now is 07:07 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.