Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp860234pxb; Wed, 6 Apr 2022 02:17:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGCWhoQHHSnWRJArdlVZB+hxm8mzSkB3L/4iRzRL80lGmP1yMrXoIgff/1rJdcVBKlSAOx X-Received: by 2002:a63:4c45:0:b0:399:5505:a285 with SMTP id m5-20020a634c45000000b003995505a285mr6533874pgl.600.1649236645945; Wed, 06 Apr 2022 02:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649236645; cv=none; d=google.com; s=arc-20160816; b=F0rEgU+uIcUFCblQG6gL6dAyqjXxEf7Vg95UdrCs/mzyO9Bxo+RRoCL0IZFAGhhodB HXJN/CBsvRAM06c3RBwe+gBEq4TSHV5gkaIYZQ1OSgXeplm6xrZY/XNAbZ4Yp6k3kzzG tfD3Fhi6DW5Mr+mVKzhNyrmYD/LzSP/lVKuUmN/MnoWh5ar/udkXy3t4f7gPzaIWSXvN aPMC+ujyzgleFhKNgFOl3hA3UfQDkuiGcRI1lZDiylU6cpqFkI2EfQKW00MTDJfiH/cZ Xt54phiaro9HejqW7Vfkx6rtNiVhbFVYHEt+vP8HfNlh/xYRFkKNecX9AgY4Q3zPRQk7 flyw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OfcDUEK+anIK2NfGvQmlBN3XGpHaHpISozBt5B7Uv08=; b=k5sCMNfFUPobeFedRhSSOLTASk068O5Hn5hUS7/Pispi8ORIysieyTS0l9NI8KYZVy TZFhPU0qEg+VJgWEnL3udPkh8wtEK4iex9BJXOP/d9zE+MX4LEkyhzUYvO75DHO8EtV6 kxk5NgXhS4pvady3NH+6NRaDvSKC5qQo/idT7mdKsIYXKahIie6xp5QfNHuI7c/ffLv+ LWjDRQ4mOrU/yvjGuT7c8NQ5oeNg9AVuDWb5zz7OiLWmiIEdG3flH0JjswL3gAOZ3Sk/ UvOqvfpTVEWePZwy4+whPYo9A4U2HZ21WxY4x9qiocL9hSsQvI82JLJp+w9MGk2p8dOs ZU7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=USSNu4Bo; 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=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x28-20020a63485c000000b0038171f9ea0asi14352723pgk.113.2022.04.06.02.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 02:17:25 -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=@linuxfoundation.org header.s=korg header.b=USSNu4Bo; 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=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BC03B531484; Wed, 6 Apr 2022 01:03:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1845888AbiDFCBy (ORCPT + 99 others); Tue, 5 Apr 2022 22:01:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352546AbiDEKEm (ORCPT ); Tue, 5 Apr 2022 06:04:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB9ABB092; Tue, 5 Apr 2022 02:53:24 -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 dfw.source.kernel.org (Postfix) with ESMTPS id DBAED61776; Tue, 5 Apr 2022 09:53:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1F2FC385A1; Tue, 5 Apr 2022 09:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152403; bh=GsAv312AdYmmt1e+wMqZIwMIBSqRjZ1+lgs4z1QfSXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=USSNu4Bod1eaqCo08HDcfGP5gfnunAqIMRtsKJYp2KMD4r4m8shGb2Gz4OupzRZmD hZKcjtDSs1NeoSMbyNYKqydngxzr/NQlxmryj1TDbdn6ZQVy1c4c4Ml6KMqKiRAFvS AAymp4Lj7bG4Uo0TP7WkRazbKJgR0sMCyYvuO65I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzkaller , Dongliang Mu , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 764/913] media: hdpvr: initialize dev->worker at hdpvr_register_videodev Date: Tue, 5 Apr 2022 09:30:26 +0200 Message-Id: <20220405070402.732951313@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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