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 505C5C433EF for ; Wed, 15 Jun 2022 17:53:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358266AbiFORxi (ORCPT ); Wed, 15 Jun 2022 13:53:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358262AbiFORxg (ORCPT ); Wed, 15 Jun 2022 13:53:36 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ABE823168 for ; Wed, 15 Jun 2022 10:53:34 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 84CC768AFE; Wed, 15 Jun 2022 19:53:30 +0200 (CEST) Date: Wed, 15 Jun 2022 19:53:30 +0200 From: Christoph Hellwig To: Greg Kroah-Hartman Cc: Will McVicker , "Rafael J. Wysocki" , Tejun Heo , kernel-team@android.com, Christoph Hellwig , linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] sysfs: fix sysfs_kf_seq_show null pointer dereference Message-ID: <20220615175330.GA26653@lst.de> References: <20220614172401.3010509-1-willmcvicker@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 14, 2022 at 07:28:31PM +0200, Greg Kroah-Hartman wrote: > On Tue, Jun 14, 2022 at 05:24:01PM +0000, Will McVicker wrote: > > When the kobj->ktype is null, > > How can that happen? What in-tree code does that? Yes, I'd be really curious how we arrived there. I we ever end in this case we're having a major problem, as all the sysfs files should go through sysfs_add_file_mode_ns, which already derferences kobj->ktype->sysfs_ops directly. I.e. for this to happen kobj->ktype must have been cleared on a live file, or someone must have bypassed sysfs_add_file_mode_ns.