From patchwork Thu Apr 18 21:35:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2462711 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 65D8B3FCA5 for ; Thu, 18 Apr 2013 21:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936554Ab3DRVgu (ORCPT ); Thu, 18 Apr 2013 17:36:50 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:58969 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936362Ab3DRVf5 (ORCPT ); Thu, 18 Apr 2013 17:35:57 -0400 Received: from axis700.grange (dslb-088-077-162-170.pools.arcor-ip.net [88.77.162.170]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MYLUv-1TyKg10Mnx-00UqH1; Thu, 18 Apr 2013 23:35:56 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id CE8ED40BB6; Thu, 18 Apr 2013 23:35:54 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1USwUk-0005dI-Gg; Thu, 18 Apr 2013 23:35:54 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Guennadi Liakhovetski Subject: [PATCH 04/24] V4L2: fix Oops on rmmod path Date: Thu, 18 Apr 2013 23:35:25 +0200 Message-Id: <1366320945-21591-5-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1366320945-21591-1-git-send-email-g.liakhovetski@gmx.de> References: <1366320945-21591-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:XRS1w7szlH6e15C7j1kDJ9CJroiZKpcxgBMkcx33Inj jmuM4ygdFydXapTr2CcHp706/EXYEL4k7EKBdN7ZiLPJQkuUf4 FdeAQlLWibjUiVUyfMM9/N6xKeXnlxjpngUO1S9dee61zJJnq8 i/BUvS47PtAUTc+LQxEWmeVSVd9eKl3/6HEfWnVnJNgolMFWOc in8LFRSNmps2PCYX9OF+ms/wBgPTtLLQSF5hUijBwZy6XgVrMd ivyhMSxLvsFRkDep+whUDh8jd01dZ6GPccDL0/PcFxDm4T2y46 3u6Ksr6qwKrRV67Yy8fN6LuRcyyfn7P4n58tuLGSkebPSiphRj C0fwc7wwzQkMU1y0yJzDh65OuVkT62sxzuF+bulOkiy9xiht14 uCbJr5wy6kz8w== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org v4l2_async_cleanup() clears the sd->dev pointer, avoid dereferencing it in v4l2_async_unregister(). Signed-off-by: Guennadi Liakhovetski --- drivers/media/v4l2-core/v4l2-async.c | 18 ++++++------------ 1 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 98db2e0..5d6b428 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -123,16 +123,6 @@ static void v4l2_async_cleanup(struct v4l2_async_subdev_list *asdl) sd->dev = NULL; } -static void v4l2_async_unregister(struct v4l2_async_subdev_list *asdl) -{ - struct v4l2_subdev *sd = v4l2_async_to_subdev(asdl); - - v4l2_async_cleanup(asdl); - - /* If we handled USB devices, we'd have to lock the parent too */ - device_release_driver(sd->dev); -} - int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev, struct v4l2_async_notifier *notifier) { @@ -203,9 +193,13 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) list_for_each_entry_safe(asdl, tmp, ¬ifier->done, list) { if (dev) { struct v4l2_subdev *sd = v4l2_async_to_subdev(asdl); - dev[i++] = get_device(sd->dev); + dev[i] = get_device(sd->dev); } - v4l2_async_unregister(asdl); + v4l2_async_cleanup(asdl); + + /* If we handled USB devices, we'd have to lock the parent too */ + if (dev) + device_release_driver(dev[i++]); if (notifier->unbind) notifier->unbind(notifier, asdl);