From patchwork Mon Aug 29 21:56:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Szmigiero X-Patchwork-Id: 1110982 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7TLuD3v007621 for ; Mon, 29 Aug 2011 21:56:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754799Ab1H2V4L (ORCPT ); Mon, 29 Aug 2011 17:56:11 -0400 Received: from moh1-ve2.go2.pl ([193.17.41.132]:52079 "EHLO moh1-ve2.go2.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754505Ab1H2V4K (ORCPT ); Mon, 29 Aug 2011 17:56:10 -0400 Received: from moh1-ve2.go2.pl (unknown [10.0.0.132]) by moh1-ve2.go2.pl (Postfix) with ESMTP id 54E621065173 for ; Mon, 29 Aug 2011 23:56:05 +0200 (CEST) Received: from unknown (unknown [10.0.0.142]) by moh1-ve2.go2.pl (Postfix) with SMTP for ; Mon, 29 Aug 2011 23:56:05 +0200 (CEST) Received: from 89-79-111-58.dynamic.chello.pl [89.79.111.58] by poczta.o2.pl with ESMTP id KQSrCf; Mon, 29 Aug 2011 23:56:04 +0200 Message-ID: <4E5C0AF1.3090606@o2.pl> Date: Mon, 29 Aug 2011 23:56:01 +0200 From: Maciej Szmigiero User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110715 Thunderbird/5.0 MIME-Version: 1.0 To: Guennadi Liakhovetski , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [V4L2]decrement struct v4l2_device refcount on device unregister X-O2-Trust: 2, 65 X-O2-SPF: neutral Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 29 Aug 2011 21:56:14 +0000 (UTC) commit bedf8bcf6b4f90a6e31add3721a2e71877289381 introduced reference counting for struct v4l2_device. In v4l2_device_register() a call to kref_init() initializes reference count to 1, but in v4l2_device_unregister() there is no corresponding decrement. End result is that reference count never reaches zero and v4l2_device_release() is never called, not even on videodev module unload. Fix this by adding reference counter decrement to v4l2_device_unregister(). Resending due to spurious newlines around the patch in previous message. Signed-off-by: Maciej Szmigiero --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index c72856c..eb39af9 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c @@ -131,6 +131,8 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev) } #endif } + + v4l2_device_put(v4l2_dev); } EXPORT_SYMBOL_GPL(v4l2_device_unregister);