From patchwork Sun Apr 28 00:06:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namjae Jeon X-Patchwork-Id: 2497581 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5F620DF23A for ; Sun, 28 Apr 2013 00:07:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754750Ab3D1AHE (ORCPT ); Sat, 27 Apr 2013 20:07:04 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:58945 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752770Ab3D1AHD (ORCPT ); Sat, 27 Apr 2013 20:07:03 -0400 Received: by mail-pd0-f181.google.com with SMTP id q10so679546pdj.26 for ; Sat, 27 Apr 2013 17:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=DZF3qzcFlSCAGbdNCt49UzL/+feo2f3LJEbvZmCKuac=; b=daOz4sXMu4HDUaCsWXfFCyzGj+YVS+uyy5u1CUdhK+F8Oagmem76CASXo4fjRzvp6s Q4S3EQlIPbJL4Fgj6vGVJjCRvMY8zIdMh6AtSvBuGz72AWvHaJBJl5h2R5HOCGd++bdM Cl/RvKq2SMJhadcT6MX8jbtkRYkylodvObM/2bfSnYYArcjm9EAJ5DFHIW//q2OePZkG qVj0X4jE9QQIUq4BtOE/BJFdS0rTs21mN/istj0uwOE7JTIcD4bWLB5BMI6zvgdxewAF s+nbrIuEQP9TtRurBq4rLNSNa62/DXhreN6mr0JJXZgAkvNddMp6wxJCZg52JTejOiHU 4B9Q== X-Received: by 10.66.178.5 with SMTP id cu5mr37517622pac.16.1367107622057; Sat, 27 Apr 2013 17:07:02 -0700 (PDT) Received: from linkinjeon-Aspire-One-522.kornet ([121.143.184.70]) by mx.google.com with ESMTPSA id aa8sm19014162pad.14.2013.04.27.17.07.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Apr 2013 17:07:01 -0700 (PDT) From: Namjae Jeon To: cjb@laptop.org Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Namjae Jeon , Namjae Jeon , Vivek Trivedi Subject: [PATCH] mmc: fix refcount leak in power_ro_lock_show Date: Sun, 28 Apr 2013 09:06:49 +0900 Message-Id: <1367107609-2586-1-git-send-email-linkinjeon@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Namjae Jeon when user does cat /sys/block/mmcblk0boot0/ro_lock_until_next_power_on power_ro_lock_show increments md->usage by calling mmc_blk_get but it forgets to call mmc_blk_put to restore md->usage Signed-off-by: Namjae Jeon Signed-off-by: Vivek Trivedi --- drivers/mmc/card/block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index e12a03c..ae8e1de 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -201,6 +201,7 @@ static ssize_t power_ro_lock_show(struct device *dev, locked = 1; ret = snprintf(buf, PAGE_SIZE, "%d\n", locked); + mmc_blk_put(md); return ret; }