From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759897AbcAKWn5 (ORCPT ); Mon, 11 Jan 2016 17:43:57 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:50717 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758738AbcAKWnz (ORCPT ); Mon, 11 Jan 2016 17:43:55 -0500 From: Shaohua Li To: CC: , Subject: [PATCH] blkcg: put module reference Date: Mon, 11 Jan 2016 14:43:52 -0800 Message-ID: X-Mailer: git-send-email 2.4.6 X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-01-11_13:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org get_gendisk(and get_disk) increases module reference, but put_disk doesn't decrease the reference. The module reference really should be decreased in put_disk(), but there are a lot of cases drivers do alloc_disk/put_disk. Before the put_disk usages are cleaned up, this is easiest fix. Signed-off-by: Shaohua Li --- block/blk-cgroup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 5a37188..58744ad 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -804,6 +804,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, if (!disk) return -ENODEV; if (part) { + module_put(disk->fops->owner); put_disk(disk); return -ENODEV; } @@ -820,6 +821,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, ret = PTR_ERR(blkg); rcu_read_unlock(); spin_unlock_irq(disk->queue->queue_lock); + module_put(disk->fops->owner); put_disk(disk); /* * If queue was bypassing, we should retry. Do so after a @@ -853,6 +855,7 @@ void blkg_conf_finish(struct blkg_conf_ctx *ctx) { spin_unlock_irq(ctx->disk->queue->queue_lock); rcu_read_unlock(); + module_put(ctx->disk->fops->owner); put_disk(ctx->disk); } EXPORT_SYMBOL_GPL(blkg_conf_finish); -- 2.4.6