From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F4B1C433FE for ; Thu, 3 Nov 2022 16:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231854AbiKCQOE (ORCPT ); Thu, 3 Nov 2022 12:14:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230099AbiKCQOB (ORCPT ); Thu, 3 Nov 2022 12:14:01 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D81E1C0; Thu, 3 Nov 2022 09:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=tdo3PoFWUzGf2zhyiSfmr4AcdFeNXBeJH5MJ1etixbU=; b=I+oWoydgq5bfBQSi/2S3SyITm2 K5kvHHY7kjckNY6l6vqJOefMAS7k4SbnkPLIrNwXziQ4ykar0+NUQTfsKSGzSvlKpBO4BKCMa9XSb jZSLVZwqVQr2V9LacDyZJsYjlnyobSN8gah0rTcS7Drfa3uP8ucfiZ3uQfivY0J/HBaRdEQwOqYHh iYvaqxEjIoLgAxm0ephiy7p/3MkNWN/vn3rPHhIrf/MLpKtRJizjGVBnZ5+4o/vwDzKx1eEsIwO9x TVKbVeXH6v7fa60AMrPUGibKQ8ThkVlW+GgYmp5gqYtEd3FHmSV9TzSvRfH+pp/OveZl0YDajH66W RaES/0Cg==; Received: from [2601:1c2:d80:3110::a2e7] by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqcqp-000cKF-61; Thu, 03 Nov 2022 16:13:55 +0000 Message-ID: Date: Thu, 3 Nov 2022 09:13:54 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: NULL pointer dereferences in hid-mcp2221 Content-Language: en-US To: Enrik Berkhan , Benjamin Tissoires Cc: =?UTF-8?Q?Sven_Z=c3=bchlsdorf?= , Rishi Gupta , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org References: <79152feb-bcbc-9e3e-e776-13170ae4ef40@vigem.de> <20221103121645.jott66kltaz6bljq@mail.corp.redhat.com> From: Randy Dunlap In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/3/22 08:22, Enrik Berkhan wrote: > 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/ Great. Thanks. -- ~Randy