Received: by 2002:a05:6a10:3150:0:0:0:0 with SMTP id m16csp2134780pxc; Wed, 30 Mar 2022 20:25:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwivzHABfRN5FjR6av654D1seecCoDvs57z9JzAhNbckTLAfW7AeLTOI2I6qNjzBD6IjXTQ X-Received: by 2002:a63:185c:0:b0:381:10:2843 with SMTP id 28-20020a63185c000000b0038100102843mr8866680pgy.433.1648697146480; Wed, 30 Mar 2022 20:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648697146; cv=none; d=google.com; s=arc-20160816; b=aKtm1qn/TnFCIsN6hBnR0eBmz19E0DdPt2YAXtXnOE11qY/bKYmbdFYik7n3AQzyt9 UUA78ScI39Zf8zr6Nh3/k8WpCBtvdj983cB7mB+e7hA55g8IwNYr4OmWRrrIFEDZaE69 7+b5z5GbgQ5Lx8A9lrJuR20Zvm/u6Ou4REb66k3pcbpmri7ZblBUXBcNf8QF7rJn0+ex XFVk6Il5InkKZrsYrLHMFYDELAawWm8AHdhueBqPmUr4id0iWhRT+bSdMzjdLorBafFb ZH18MzXSyJCF63nB/NcwPpHeL+k1VVxwN6VsutxwXWcBkGluiNDxvkfC7iYWIidxtsLw 7J1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OfcDUEK+anIK2NfGvQmlBN3XGpHaHpISozBt5B7Uv08=; b=KARaooesUxBNzhMFCZ5fMDT041s/FTPnX2KzrQo+tioGL6Gz8L9/8EZe3ACK9yIqfh XVDT4A04T6ltQ7t51+w1uudQCrfuQVHxPhyu35f5Xrc5NT0b4uiU4Zv54Hna1NHVf+Lr IsfWNXASGjA+dNcroEOIcX1MXKCVODX4IZoBkzYoSNnKQ54PQp2fv2HjhMSdRp/M1soy je/QfvF5pjzcoBewVgC8Exxpw7fSZfZIsX1+XjjLVSt0VRspzz/v0Jv2HlqeMLOAYuTF yZVvVIINvIux7z0yiG2Vpeogfo0DTupk3m0CzEwCi79JtFxJ4EFk4yY2zIVKr3uwpsvt pN7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X9xu+y6V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d18-20020a170902aa9200b0015448e01af7si21724390plr.96.2022.03.30.20.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 20:25:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X9xu+y6V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66776116288; Wed, 30 Mar 2022 19:53:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242023AbiC3MB7 (ORCPT + 99 others); Wed, 30 Mar 2022 08:01:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344868AbiC3Lxn (ORCPT ); Wed, 30 Mar 2022 07:53:43 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA51B27CE11; Wed, 30 Mar 2022 04:49:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 89FADCE1D41; Wed, 30 Mar 2022 11:49:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08E2AC340EE; Wed, 30 Mar 2022 11:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648640988; bh=GsAv312AdYmmt1e+wMqZIwMIBSqRjZ1+lgs4z1QfSXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X9xu+y6VWuXV9ZmcN3M3V4VJtZI/9kjMYAUi6cMZz2Ul8zjNiG6YkPt2uncKWD7iX K7If6I6HZZ0XnSvPVzjnveLkMZUGt46xa3rZlR+AdYPguXuFhVgW5Ji0fEG5s7VoN0 epeR9srQQO7oMAZqsYF6QcYFcTufVySGQLzblFZmUKCiIFIAYbZMN+0MjR5MnejRfW 2Py/WBb2KUueOpGtWHB5c3rbcerhfeZpWtskRC3kEPDV3f4GEY1/eztHKXPMKQA+JE kL6VWBwc1s4ax0u1pLH2ipD4q5A+fKoT5oriBzpa42z5/ez0RX0XoEICmCCSrv3UzF D0bK2igOwKrnA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dongliang Mu , syzkaller , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , hverkuil@xs4all.nl, linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 49/59] media: hdpvr: initialize dev->worker at hdpvr_register_videodev Date: Wed, 30 Mar 2022 07:48:21 -0400 Message-Id: <20220330114831.1670235-49-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220330114831.1670235-1-sashal@kernel.org> References: <20220330114831.1670235-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dongliang Mu [ Upstream commit 07922937e9a580825f9965c46fd15e23ba5754b6 ] hdpvr_register_videodev is responsible to initialize a worker in hdpvr_device. However, the worker is only initialized at hdpvr_start_streaming other than hdpvr_register_videodev. When hdpvr_probe does not initialize its worker, the hdpvr_disconnect will encounter one WARN in flush_work.The stack trace is as follows: hdpvr_disconnect+0xb8/0xf2 drivers/media/usb/hdpvr/hdpvr-core.c:425 usb_unbind_interface+0xbf/0x3a0 drivers/usb/core/driver.c:458 __device_release_driver drivers/base/dd.c:1206 [inline] device_release_driver_internal+0x22a/0x230 drivers/base/dd.c:1237 bus_remove_device+0x108/0x160 drivers/base/bus.c:529 device_del+0x1fe/0x510 drivers/base/core.c:3592 usb_disable_device+0xd1/0x1d0 drivers/usb/core/message.c:1419 usb_disconnect+0x109/0x330 drivers/usb/core/hub.c:2228 Fix this by moving the initialization of dev->worker to the starting of hdpvr_register_videodev Reported-by: syzkaller Signed-off-by: Dongliang Mu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/hdpvr/hdpvr-video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c index 563128d11731..60e57e0f1927 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -308,7 +308,6 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev) dev->status = STATUS_STREAMING; - INIT_WORK(&dev->worker, hdpvr_transmit_buffers); schedule_work(&dev->worker); v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, @@ -1165,6 +1164,9 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, bool ac3 = dev->flags & HDPVR_FLAG_AC3_CAP; int res; + // initialize dev->worker + INIT_WORK(&dev->worker, hdpvr_transmit_buffers); + dev->cur_std = V4L2_STD_525_60; dev->width = 720; dev->height = 480; -- 2.34.1