From: Leon Romanovsky <leon@kernel.org>
To: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
Chiara Meiohas <cmeiohas@nvidia.com>,
linux-rdma@vger.kernel.org, Yishai Hadas <yishaih@nvidia.com>
Subject: Re: [PATCH rdma-next 1/6] RDMA/uverbs: Introduce UCAP (User CAPabilities) API
Date: Wed, 5 Mar 2025 11:55:11 +0200 [thread overview]
Message-ID: <20250305095511.GI1955273@unreal> (raw)
In-Reply-To: <CAH-L+nPoVOMHq-hzAVBXa5-8Ehc75qg0pP4mBnYtT8qH7zNUpg@mail.gmail.com>
On Wed, Mar 05, 2025 at 02:01:13PM +0530, Kalesh Anakkur Purayil wrote:
> On Wed, Feb 26, 2025 at 7:50 PM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > From: Chiara Meiohas <cmeiohas@nvidia.com>
> >
> > Implement a new User CAPabilities (UCAP) API to provide fine-grained
> > control over specific firmware features.
> >
> > This approach offers more granular capabilities than the existing Linux
> > capabilities, which may be too generic for certain FW features.
> >
> > This mechanism represents each capability as a character device with
> > root read-write access. Root processes can grant users special
> > privileges by allowing access to these character devices (e.g., using
> > chown).
> >
> > UCAP character devices are located in /dev/infiniband and the class path
> > is /sys/class/infiniband_ucaps.
> >
> > Signed-off-by: Chiara Meiohas <cmeiohas@nvidia.com>
> > Reviewed-by: Yishai Hadas <yishaih@nvidia.com>
> > Signed-off-by: Leon Romanovsky <leon@kernel.org>
> > ---
> > drivers/infiniband/core/Makefile | 3 +-
> > drivers/infiniband/core/ucaps.c | 255 ++++++++++++++++++++++++++
> > drivers/infiniband/core/uverbs_main.c | 2 +
> > include/rdma/ib_ucaps.h | 25 +++
> > 4 files changed, 284 insertions(+), 1 deletion(-)
> > create mode 100644 drivers/infiniband/core/ucaps.c
> > create mode 100644 include/rdma/ib_ucaps.h
<...>
> > + device_initialize(&ucap->dev);
> > + ucap->dev.class = &ucaps_class;
> > + ucap->dev.devt = MKDEV(MAJOR(ucaps_base_dev), type);
> > + ucap->dev.release = ucap_dev_release;
> > + dev_set_name(&ucap->dev, ucap_names[type]);
> > +
> > + cdev_init(&ucap->cdev, &ucaps_cdev_fops);
> > + ucap->cdev.owner = THIS_MODULE;
> > +
> > + ret = cdev_device_add(&ucap->cdev, &ucap->dev);
> > + if (ret)
> > + goto err_device;
> Memory leak in the error path, need to free ucap here?
It is done through call to put_device(&ucap->dev) below.
This is how device is freed after device_initialize().
<...>
> > +err_device:
> > + put_device(&ucap->dev);
> > +unlock:
> > + mutex_unlock(&ucaps_mutex);
> > + return ret;
> > +}
> > +EXPORT_SYMBOL(ib_create_ucap);
<...>
> > + ucaps_list[type] = NULL;
> > + cdev_device_del(&ucap->cdev, &ucap->dev);
> > + put_device(&ucap->dev);
> need to free ucap here
Same as above.
Thanks
next prev parent reply other threads:[~2025-03-05 9:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 14:17 [PATCH rdma-next 0/6] Introduce UCAP API and usage in mlx5 Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 1/6] RDMA/uverbs: Introduce UCAP (User CAPabilities) API Leon Romanovsky
2025-03-04 13:18 ` Jason Gunthorpe
2025-03-04 13:44 ` Leon Romanovsky
2025-03-04 14:30 ` Jason Gunthorpe
2025-03-04 14:44 ` Leon Romanovsky
2025-03-05 8:31 ` Kalesh Anakkur Purayil
2025-03-05 9:55 ` Leon Romanovsky [this message]
2025-03-05 10:08 ` Kalesh Anakkur Purayil
2025-03-05 11:41 ` Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 2/6] RDMA/mlx5: Create UCAP char devices for supported device capabilities Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 3/6] RDMA/uverbs: Add support for UCAPs in context creation Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 4/6] RDMA/mlx5: Check enabled UCAPs when creating ucontext Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 5/6] RDMA/mlx5: Expose RDMA TRANSPORT flow table types to userspace Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 6/6] docs: infiniband: document the UCAP API Leon Romanovsky
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=20250305095511.GI1955273@unreal \
--to=leon@kernel.org \
--cc=cmeiohas@nvidia.com \
--cc=jgg@nvidia.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=linux-rdma@vger.kernel.org \
--cc=yishaih@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.