public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roman Gushchin <roman.gushchin@linux.dev>
To: Parav Pandit <parav@mellanox.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	Maher Sanalla <msanalla@nvidia.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] RDMA/core: fix a NULL-pointer dereference in hw_stat_device_show()
Date: Wed, 26 Feb 2025 03:41:04 +0000	[thread overview]
Message-ID: <Z76NUKn6SCrrw1vt@google.com> (raw)
In-Reply-To: <CY8PR12MB71952D004721897B816B1385DCC32@CY8PR12MB7195.namprd12.prod.outlook.com>

On Tue, Feb 25, 2025 at 04:34:11AM +0000, Parav Pandit wrote:
> 
> 
> > From: Roman Gushchin <roman.gushchin@linux.dev>
> > Sent: Tuesday, February 25, 2025 9:12 AM
> > 
> > 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 <jgg@nvidia.com>
> > > > > > 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):
> > 
> Yes, this is my suggestion too in little more detail at [1].
> 
> [1] https://lore.kernel.org/linux-rdma/20250224233109.GE520155@nvidia.com/T/#m43a5974cad17566080eeb64c6d5327aad4f0a852

I tried to implement what you suggested, but apparently it's complicated.
You can't call ib_setup_port_attrs() before device_add() because
kobject_init_and_add() fails. Maybe an option is to add "hw_counters"
dynamically similar to ports, Idk.

Anyway, sent a slightly different version, please, take a look.

Thanks!

  reply	other threads:[~2025-02-26  3:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21  2:05 [PATCH] RDMA/core: fix a NULL-pointer dereference in hw_stat_device_show() Roman Gushchin
2025-02-21  3:14 ` Parav Pandit
2025-02-21  4:25   ` Roman Gushchin
2025-02-21  4:34     ` Parav Pandit
2025-02-21  4:49       ` Roman Gushchin
2025-02-21  8:03         ` Parav Pandit
2025-02-21 20:02           ` Roman Gushchin
2025-02-22 18:36             ` Parav Pandit
2025-02-22 20:50               ` Roman Gushchin
2025-02-21 17:43       ` Jason Gunthorpe
2025-02-22 18:34         ` Parav Pandit
2025-02-24 15:11           ` Jason Gunthorpe
2025-02-24 15:16             ` Parav Pandit
2025-02-24 23:22               ` Roman Gushchin
2025-02-24 23:30                 ` Jason Gunthorpe
2025-02-25  3:42                   ` Roman Gushchin
2025-02-25  4:34                     ` Parav Pandit
2025-02-26  3:41                       ` Roman Gushchin [this message]
2025-02-25 13:16                     ` Jason Gunthorpe
2025-02-26  3:37                       ` Roman Gushchin
2025-02-24 23:31               ` Jason Gunthorpe
2025-02-25 10:38                 ` Parav Pandit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z76NUKn6SCrrw1vt@google.com \
    --to=roman.gushchin@linux.dev \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=msanalla@nvidia.com \
    --cc=parav@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox