Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1850017rwi; Thu, 3 Nov 2022 09:43:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76B6jTAy2S9tvj9gcHE4W9CPFEQhC7HvahPLpnMla7MSTdWNNLRkB1EccwcygKOQTWGKNW X-Received: by 2002:a17:906:cc10:b0:7ad:d776:8b7a with SMTP id ml16-20020a170906cc1000b007add7768b7amr20761815ejb.508.1667493834403; Thu, 03 Nov 2022 09:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667493834; cv=none; d=google.com; s=arc-20160816; b=CkYDXqTdumDhYbgmxdAkgmamqYPyCm09DmyL13p7I8oitFivgEzQOlAuckph7PNyzK XCzqtTHEfaK9ynZ4XQ/GuR1OTZMliS6h2jUXlrD73uzQQMbAajC07jVu0h4jKhkJMnf/ KHejGSgTYgzO4ZMbU6oPlAkpOt4gyK/R4OTd8DMpQ7IyMgo8xhYn8edwr9XWkCQJvCP2 Vdw46mSfrivuoHG0s3aaR2z/BPrQvgnCbh87FhzHHZWo08V18qcr3zTCkTy5zzHnO51O bJfsj6G3nQAa9F1s1N1E0ys4wxRdDQIm754ZGJI/BjvkDviirRj8ew/jyneCJqYsbuaD fWYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=uapCnbyfL3pCVP4AvW8fdp30U5ZI5ZfMovF3wagOIvs=; b=UzI2+a4Nk3U/RHfg3vWgM69l69QEBITwGsM97XLtxXZk/4rPFcjz1oJur5y+SqQh9v uQKfhtDYzkJ6HJQy3/xebn3yE6zMvhdhMyNLevJgDiXAgtEd+AJdIKQcWg4c21NzEtCr 2c2HMfa1hgD4v5kmEJhjgPpyCiLYo+pmqjZ14RBY8xxnmfUF8RkLY/XiRFzyl6BqmYZk JOJynzI4w/kj5ojmnMSpQ7Tk44LpOZCX0DK+un+hEP+OI8ys2jT2e+sMuyXjiX09dojo EkvgFaQyl49SvqIECQpmf/1rW8clcglZB46qhQH+HtimdxL4D4geSUdEGB6bovj4GYmP 0UKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r2-20020a50c002000000b00463a583166asi1617707edb.197.2022.11.03.09.43.30; Thu, 03 Nov 2022 09:43:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231997AbiKCPWY convert rfc822-to-8bit (ORCPT + 97 others); Thu, 3 Nov 2022 11:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231796AbiKCPWX (ORCPT ); Thu, 3 Nov 2022 11:22:23 -0400 Received: from mail.inka.de (mail.inka.de [IPv6:2a04:c9c7:0:1073:217:a4ff:fe3b:e77c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D3242AD6; Thu, 3 Nov 2022 08:22:22 -0700 (PDT) Received: from mail3.berkhan-weisser.de ([2a03:4000:54:b9a::4]) by mail.inka.de with esmtpsa id 1oqc2r-005OkF-4U; Thu, 03 Nov 2022 16:22:17 +0100 Received: from 127.0.0.1 (helo=localhost.localdomain) by mail3.berkhan-weisser.de with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1oqc2q-0056qL-Hz; Thu, 03 Nov 2022 16:22:16 +0100 Message-ID: Subject: Re: NULL pointer dereferences in hid-mcp2221 From: Enrik Berkhan To: Benjamin Tissoires , Randy Dunlap Cc: Sven =?ISO-8859-1?Q?Z=FChlsdorf?= , Rishi Gupta , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 03 Nov 2022 16:22:15 +0100 In-Reply-To: <20221103121645.jott66kltaz6bljq@mail.corp.redhat.com> References: <79152feb-bcbc-9e3e-e776-13170ae4ef40@vigem.de> <20221103121645.jott66kltaz6bljq@mail.corp.redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 On Thu, 2022-11-03 at 13:16 +0100, Benjamin Tissoires wrote: > On Nov 02 2022, Randy Dunlap wrote: > > Hi-- > > > > [adding linux-input mailing list] > > > > On 10/25/22 00:39, Sven Zühlsdorf wrote: > > > Hi, > > > > > > I've run into two NULL pointer dereferences when loading the MCP2221 driver. > > > Initially I observed them running the kernel used by yocto kirkstone > > > (currently 5.15.68) but can reproduce them with a vanilla 6.1-rc1 as well. > > > All line numbers below are for hid-mcp2221.c, taken from 6.1-rc1. > > > > > > The first one was easy to identify, in mcp2221_probe line 874 `hdev->hidraw` > > > was NULL since I compiled the kernel without CONFIG_HIDRAW enabled. Should > > > CONFIG_HID_MCP2221 perhaps depend on or imply CONFIG_HIDRAW? > > > > Looks to me like it should. Hopefully the HID people can chime in here. > > I actually don't see why this driver (and hid-cp2112.c FWIW) should > depend on hidraw. To me, the reference to hidraw is just a nicer logging > message, but I have a hard time understanding how hidraw should be > involved in the driver, and if it were, how it could not break > everything. > > So IMO, we should probably change that line from the 2 drivers and > replace the hidraw part with the hid->id number which is unique. Exactly. See also https://lore.kernel.org/linux-input/20220926202239.16379-2-Enrik.Berkhan@inka.de/ Cheers, Enrik