From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49C5824FBE8 for ; Tue, 25 Feb 2025 03:42:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740454968; cv=none; b=EjfXK9NNRJhT2IaibRUsfV1SC30cTCm8RcCR1rUjF7Rnu0OTANnbqsqfkKdo+MAsHRIeamPmy2kxketnk871ATFnU5mrhJq+20ybV5d/NTRNU+MolPYznnxvbBFen2wAfSk7AHd//tqVnUhFzL9E28w/OG4HXq4vkHRPiwtBHLk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740454968; c=relaxed/simple; bh=H+RyLfFamXo1oAGjUqvJZhcQXerEfcHPpC15CMvkWnk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=H2CZKE9wjOzWK49GhjPsm6WHvLaCRlnkM5FoTI0JY136sDbSMNhfE52/wE5Rj77iFnstU9Swc5bIZj8rT/FohNlEOBsapscGWznb1+C2kqUaH9u5oO5KBadgHq3FgXyoxRQ7SWmSlsLAG9m2zxpw3Fo4f1SO3EFxu9LXmeRPKx4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=PBEmxPNj; arc=none smtp.client-ip=95.215.58.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="PBEmxPNj" Date: Tue, 25 Feb 2025 03:42:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1740454954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9afZ+NqTLgZXLQIzPGVnqR+tzegyYgOtZzHHZW/wF2c=; b=PBEmxPNjhz6LPVmwSdF4iTOOk+6D43wZb4Gt6sdGtIY9OPHp6VF6ODgHepIUHMZSwMjckq oDo8txB3t0S9MWzIhPks8UV+zIpgHCvS+pYVtIh+YTJAEoQ8/PlEOQXou9bLuAYSY6l3fo lfq3v0ddWuZ58ugt1znbO82wQRoMldU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Jason Gunthorpe Cc: Parav Pandit , Leon Romanovsky , Maher Sanalla , "linux-rdma@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] RDMA/core: fix a NULL-pointer dereference in hw_stat_device_show() Message-ID: References: <20250221020555.4090014-1-roman.gushchin@linux.dev> <20250221174347.GA314593@nvidia.com> <20250224151127.GT50639@nvidia.com> <20250224233004.GD520155@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250224233004.GD520155@nvidia.com> X-Migadu-Flow: FLOW_OUT On Mon, Feb 24, 2025 at 07:30:04PM -0400, Jason Gunthorpe wrote: > On Mon, Feb 24, 2025 at 11:22:29PM +0000, Roman Gushchin wrote: > > On Mon, Feb 24, 2025 at 03:16:46PM +0000, Parav Pandit wrote: > > > > > > > > > > From: Jason Gunthorpe > > > > Sent: Monday, February 24, 2025 8:41 PM > > > > > > > > On Sat, Feb 22, 2025 at 06:34:21PM +0000, Parav Pandit wrote: > > > > > ib_setup_device_attrs() should be merged to ib_setup_port_attrs() by > > > > > renaming ib_setup_port_attrs() to be generic. To utilize the group > > > > > initialization ib_setup_port_attrs() needs to move up before > > > > > device_add(). > > > > > > > > It needs more than that, somehow you have to maintain two groups list or > > > > somehow remove the coredev->dev.groups assignment.. > > > > > > > I was thinking that if both device and port attr setup is done in > > > same function, there is knowledge of is_full_dev that can be used > > > for device level hw_stats setup. (similar to how its done at port > > > level). > > > > Given that there is a bit of discussion on how to move forward with this, > > can we please merge the trivial fix in the mean time? (Just sent out v2 with > > the fixed commit log). > > Well, the issue now is the ABI break > > If the right answer is to remove the sysfs entirely then it doesn't > make sense to make it work in the stable and LTS kernels since that > would create users. Currently it is fully broken so there are no > users. Can we say that so certainly after it is fixed? It's a good point. Ok, then we need something like this (obviously, coded more nicely): diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 0ded91f056f3..6998907fc779 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -956,6 +956,7 @@ static int add_one_compat_dev(struct ib_device *device, ret = device_add(&cdev->dev); if (ret) goto add_err; + device->groups[2] = NULL; ret = ib_setup_port_attrs(cdev); if (ret) goto port_err;