From patchwork Wed Oct 4 21:50:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 9985681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3006F602B8 for ; Wed, 4 Oct 2017 21:51:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2247D28C24 for ; Wed, 4 Oct 2017 21:51:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15AA928C2B; Wed, 4 Oct 2017 21:51:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A363328C2A for ; Wed, 4 Oct 2017 21:50:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751364AbdJDVu4 (ORCPT ); Wed, 4 Oct 2017 17:50:56 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:40268 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751326AbdJDVuz (ORCPT ); Wed, 4 Oct 2017 17:50:55 -0400 Received: from lanttu.localdomain (lanttu-e.localdomain [192.168.1.64]) by hillosipuli.retiisi.org.uk (Postfix) with ESMTP id 2BBA4600DE; Thu, 5 Oct 2017 00:50:52 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: niklas.soderlund@ragnatech.se, maxime.ripard@free-electrons.com, hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, pavel@ucw.cz, sre@kernel.org, =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH v15 03/32] v4l: async: fix unbind error in v4l2_async_notifier_unregister() Date: Thu, 5 Oct 2017 00:50:22 +0300 Message-Id: <20171004215051.13385-4-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171004215051.13385-1-sakari.ailus@linux.intel.com> References: <20171004215051.13385-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Niklas Söderlund The call to v4l2_async_cleanup() will set sd->asd to NULL so passing it to notifier->unbind() have no effect and leaves the notifier confused. Call the unbind() callback prior to cleaning up the subdevice to avoid this. Signed-off-by: Niklas Söderlund Signed-off-by: Sakari Ailus Reviewed-by: Sebastian Reichel Acked-by: Hans Verkuil --- drivers/media/v4l2-core/v4l2-async.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 21c748bf3a7b..ca281438a0ae 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -206,11 +206,11 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) list_del(¬ifier->list); list_for_each_entry_safe(sd, tmp, ¬ifier->done, async_list) { - v4l2_async_cleanup(sd); - if (notifier->unbind) notifier->unbind(notifier, sd, sd->asd); + v4l2_async_cleanup(sd); + list_move(&sd->async_list, &subdev_list); } @@ -268,11 +268,11 @@ void v4l2_async_unregister_subdev(struct v4l2_subdev *sd) list_add(&sd->asd->list, ¬ifier->waiting); - v4l2_async_cleanup(sd); - if (notifier->unbind) notifier->unbind(notifier, sd, sd->asd); + v4l2_async_cleanup(sd); + mutex_unlock(&list_lock); } EXPORT_SYMBOL(v4l2_async_unregister_subdev);