Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp413902pxb; Thu, 19 Aug 2021 02:33:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJLafctLgsoc+fmRpQ5GE/9GUm663VhFjXoYMmj6VN9GPgWODn8BHBy1aJvajLh3RtteRP X-Received: by 2002:a17:906:9747:: with SMTP id o7mr14770734ejy.486.1629365624215; Thu, 19 Aug 2021 02:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629365624; cv=none; d=google.com; s=arc-20160816; b=jJyoln1ClhG3SWbetV4nXMknz9VO8WparJISoGYafRiJ9bkvhrV0FWNYSOW13xlI0E dKuEU1xDB4eDYAUr+O2CxeRDznEPuoQ2mZPnyJgUMrgkzT3XUn9wwCOH8/4pTB27/EE1 QHBBZesdEzpNp7p0opOo4ikHzOyg7YjLlLC4oyWXg86S2r22QFG+rGoecLnmi8Fy8f3G /eli71a14tH4fCVpYFe3dhhHyMmKlWYntTlqqIpfx+2zHD8vv1D2LBcx9K9MzsSOgsAm c4tG60NOpVCHxHLIkj7pL97DU5n7Pug1bRHg9cu7evG/jM/lz9ui9t+p7syXbIywbKab Bqfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=7E4XK/pyvKGm5VQwd7JG0gyZWpWLDZvtzVPwABZJCIs=; b=Be0UK8UzK2QJ0V91EPYww1zVUUOAlwPmkmbu+I6uIzn8rkjqV0KMHwV0KVm7UcRpCa 1fmAQqWxvN8uIYJev7e6TQ+fY/oL+xNGwheRyaDcSgGRUeo5MPiIfgtWt24bqiAMpuHP f+YaoUiWFnj8cwaTWrHSLJ8FegpjfU01ynWk5AO8UfRrq/kyTrhDjmylVSVeBe/LULF0 Hju7A2jtoJjJVMCi1dEclnsjIqc2MyptcejdFwKI8Ts32Uu7PuRVmIdBe6Ukahy9Mvgk wLph2Z/QWMjEh0nvQ1kiNvRIfnZITtHSgAt+B4RxQeb1aEHRf1mmDA88lFxWORnGLBkm ZQZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t4rs7bq+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si2734083edq.156.2021.08.19.02.33.21; Thu, 19 Aug 2021 02:33:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t4rs7bq+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237269AbhHSJcP (ORCPT + 99 others); Thu, 19 Aug 2021 05:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229745AbhHSJcP (ORCPT ); Thu, 19 Aug 2021 05:32:15 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B7A7C061575; Thu, 19 Aug 2021 02:31:39 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id k5so11498354lfu.4; Thu, 19 Aug 2021 02:31:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7E4XK/pyvKGm5VQwd7JG0gyZWpWLDZvtzVPwABZJCIs=; b=t4rs7bq+PLF3d/NjGO/H8jkBiLnvRhusMVSaM3TjBSwtkI+RieuQCm9XKFWGBh88yS x5/L7fNVmFd89zlqmI0UosrT/PkKdPNybkPqIILKeqOvpEphI7QFzMt5YvV5L1T6B33C +ezc2MMyeuEuNszdXYap1LbS1UXTqer8J0Efx6tUkQipNED4GiCyXTON85L2liKJghQE 5W7i2CZPXPw3P4Bm4EUBT7zoQ7CzWIFV02ZhL3SCqsw7zAqx6+/F+CybK/mPMiVBZCu4 mzdWqSW46t76u3hP0loYgYOn8h+q++itgJItDLOt2gifmW8D9pXeVHDn0z4SnIwau0pH Bg2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7E4XK/pyvKGm5VQwd7JG0gyZWpWLDZvtzVPwABZJCIs=; b=ivDu2p9yRm+YnimqBaYfXoucJY8qxlNVsMidl4CWzRyeD4lo2oYRyl1R+88rhzsSs2 E3+gVq5L4+Oo5FCG93iEORYsjCoPWNwt9uCD34G9eGtjDFU62wLxH/40U4Y9FP+IqhZH 7DjDq2UERfB23oQgj3hrQEwnJARNSUOejJbMPd/fCZubcHe5r/AVPZHUddct3tmU6OA+ iiM7lJRyd8auaF+uiM+Bl7E/C2PEQDjHOex0yZXwEg5KnYBT+wRaRi1lBtRkTQBT9Tre ztbOEXySibOW9JOJsSEGIn26xYhc3xD1HQ6epyxQIugRABqCbm/3RXHYfpc8/DtJZAh6 LwPw== X-Gm-Message-State: AOAM531bvXqnj42K+XyACVmwU4r9Afm81a+Mbf4e+QqrF8enzTDlrItj JsgtxjK4GS28TihjLgMipU4= X-Received: by 2002:a05:6512:3487:: with SMTP id v7mr9763988lfr.302.1629365497464; Thu, 19 Aug 2021 02:31:37 -0700 (PDT) Received: from [192.168.1.11] ([46.235.66.127]) by smtp.gmail.com with ESMTPSA id u12sm249811lfo.86.2021.08.19.02.31.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Aug 2021 02:31:37 -0700 (PDT) Subject: Re: [PATCH] media: mxl111sf: change mutex_init() location To: Sean Young Cc: mkrufky@linuxtv.org, mchehab@kernel.org, crope@iki.fi, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+5ca0bf339f13c4243001@syzkaller.appspotmail.com References: <20210730213829.2909-1-paskripkin@gmail.com> <20210815083755.GA1827@gofer.mess.org> <7ee99788-d9a5-0a38-ed02-51d9b42ebc11@gmail.com> <80648833-5f5a-0811-a281-0dba87938d3c@gmail.com> <20210819092908.GA27679@gofer.mess.org> From: Pavel Skripkin Message-ID: Date: Thu, 19 Aug 2021 12:31:35 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210819092908.GA27679@gofer.mess.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/19/21 12:29 PM, Sean Young wrote: > On Sun, Aug 15, 2021 at 12:06:16PM +0300, Pavel Skripkin wrote: >> On 8/15/21 11:49 AM, Pavel Skripkin wrote: >> > On 8/15/21 11:37 AM, Sean Young wrote: >> > > On Sat, Jul 31, 2021 at 12:38:29AM +0300, Pavel Skripkin wrote: >> > > > Syzbot reported, that mxl111sf_ctrl_msg() uses uninitialized >> > > > mutex. The problem was in wrong mutex_init() location. >> > > > >> > > > Previous mutex_init(&state->msg_lock) call was in ->init() function, but >> > > > dvb_usbv2_init() has this order of calls: >> > > > >> > > > dvb_usbv2_init() >> > > > dvb_usbv2_adapter_init() >> > > > dvb_usbv2_adapter_frontend_init() >> > > > props->frontend_attach() >> > > > >> > > > props->init() >> > > > >> > > > Since mxl111sf_frontend_attach_atsc_mh() calls mxl111sf_ctrl_msg() >> > > > internally we need to initialize state->msg_lock in it to make lockdep >> > > > happy. >> > > >> > > What about the other frontends like mxl111sf_frontend_attach_dvbt? They >> > > no longer initialize the mutex. >> > > >> > Good point. I see, that all other frontends also call >> > mxl111sf_ctrl_msg() inside ->frontend_attach() call. >> > >> > I think, that fixing dvb-usb core is not good idea, so, I will add >> > mutex_init() call inside all frontends, which use mxl111sf_init(). >> > >> > What do you think about it? >> > >> > >> >> >> Something like this should work. Helper is just to not copy-paste code >> parts. Build tested against v5.14-rc5 > > How about creating a dvb_usb_device_properties probe function and > initializing the mutex init there? > > Sounds reasonable. Will do it in v2, thank you! With regards, Pavel Skripkin