All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next 1/2] nbd: allow genl access outside init_net
@ 2023-02-24  2:13 Jakub Kicinski
  2023-02-24  2:13 ` [PATCH -next 2/2] nbd: use the structured req attr check Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jakub Kicinski @ 2023-02-24  2:13 UTC (permalink / raw)
  To: josef, axboe; +Cc: linux-block, nbd, Jakub Kicinski

NBD doesn't have much to do with networking, allow users outside
init_net to access the family.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/block/nbd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 592cfa8b765a..53e4bb754fd9 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -2325,6 +2325,7 @@ static struct genl_family nbd_genl_family __ro_after_init = {
 	.n_small_ops	= ARRAY_SIZE(nbd_connect_genl_ops),
 	.resv_start_op	= NBD_CMD_STATUS + 1,
 	.maxattr	= NBD_ATTR_MAX,
+	.netnsok	= 1,
 	.policy = nbd_attr_policy,
 	.mcgrps		= nbd_mcast_grps,
 	.n_mcgrps	= ARRAY_SIZE(nbd_mcast_grps),
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH -next 2/2] nbd: use the structured req attr check
  2023-02-24  2:13 [PATCH -next 1/2] nbd: allow genl access outside init_net Jakub Kicinski
@ 2023-02-24  2:13 ` Jakub Kicinski
  2023-03-02 18:29   ` Chaitanya Kulkarni
  2023-03-02 18:29 ` [PATCH -next 1/2] nbd: allow genl access outside init_net Chaitanya Kulkarni
  2023-03-08 14:36 ` Jens Axboe
  2 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2023-02-24  2:13 UTC (permalink / raw)
  To: josef, axboe; +Cc: linux-block, nbd, Jakub Kicinski

Use the macro for checking presence of required attributes.
It has the advantage of reporting to the user which attr
was missing in a machine-readable format (extack).

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/block/nbd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 53e4bb754fd9..c0b1611b9665 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1934,11 +1934,11 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
 			return -EINVAL;
 		}
 	}
-	if (!info->attrs[NBD_ATTR_SOCKETS]) {
+	if (GENL_REQ_ATTR_CHECK(info, NBD_ATTR_SOCKETS)) {
 		pr_err("must specify at least one socket\n");
 		return -EINVAL;
 	}
-	if (!info->attrs[NBD_ATTR_SIZE_BYTES]) {
+	if (GENL_REQ_ATTR_CHECK(info, NBD_ATTR_SIZE_BYTES)) {
 		pr_err("must specify a size in bytes for the device\n");
 		return -EINVAL;
 	}
@@ -2123,7 +2123,7 @@ static int nbd_genl_disconnect(struct sk_buff *skb, struct genl_info *info)
 	if (!netlink_capable(skb, CAP_SYS_ADMIN))
 		return -EPERM;
 
-	if (!info->attrs[NBD_ATTR_INDEX]) {
+	if (GENL_REQ_ATTR_CHECK(info, NBD_ATTR_INDEX)) {
 		pr_err("must specify an index to disconnect\n");
 		return -EINVAL;
 	}
@@ -2161,7 +2161,7 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info)
 	if (!netlink_capable(skb, CAP_SYS_ADMIN))
 		return -EPERM;
 
-	if (!info->attrs[NBD_ATTR_INDEX]) {
+	if (GENL_REQ_ATTR_CHECK(info, NBD_ATTR_INDEX)) {
 		pr_err("must specify a device to reconfigure\n");
 		return -EINVAL;
 	}
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -next 1/2] nbd: allow genl access outside init_net
  2023-02-24  2:13 [PATCH -next 1/2] nbd: allow genl access outside init_net Jakub Kicinski
  2023-02-24  2:13 ` [PATCH -next 2/2] nbd: use the structured req attr check Jakub Kicinski
@ 2023-03-02 18:29 ` Chaitanya Kulkarni
  2023-03-08 14:36 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Chaitanya Kulkarni @ 2023-03-02 18:29 UTC (permalink / raw)
  To: Jakub Kicinski, josef, axboe; +Cc: linux-block, nbd

On 2/23/23 18:13, Jakub Kicinski wrote:
> NBD doesn't have much to do with networking, allow users outside
> init_net to access the family.
> 
> Reviewed-by: Josef Bacik <josef@toxicpanda.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next 2/2] nbd: use the structured req attr check
  2023-02-24  2:13 ` [PATCH -next 2/2] nbd: use the structured req attr check Jakub Kicinski
@ 2023-03-02 18:29   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 5+ messages in thread
From: Chaitanya Kulkarni @ 2023-03-02 18:29 UTC (permalink / raw)
  To: Jakub Kicinski, josef, axboe; +Cc: linux-block, nbd

On 2/23/23 18:13, Jakub Kicinski wrote:
> Use the macro for checking presence of required attributes.
> It has the advantage of reporting to the user which attr
> was missing in a machine-readable format (extack).
> 
> Reviewed-by: Josef Bacik <josef@toxicpanda.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next 1/2] nbd: allow genl access outside init_net
  2023-02-24  2:13 [PATCH -next 1/2] nbd: allow genl access outside init_net Jakub Kicinski
  2023-02-24  2:13 ` [PATCH -next 2/2] nbd: use the structured req attr check Jakub Kicinski
  2023-03-02 18:29 ` [PATCH -next 1/2] nbd: allow genl access outside init_net Chaitanya Kulkarni
@ 2023-03-08 14:36 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2023-03-08 14:36 UTC (permalink / raw)
  To: josef, Jakub Kicinski; +Cc: linux-block, nbd


On Thu, 23 Feb 2023 18:13:00 -0800, Jakub Kicinski wrote:
> NBD doesn't have much to do with networking, allow users outside
> init_net to access the family.
> 
> 

Applied, thanks!

[1/2] nbd: allow genl access outside init_net
      commit: 6a650ef04718aff580d6b352c38ca839991fd3ae
[2/2] nbd: use the structured req attr check
      commit: d09b3a9ff6c6ef74298e19b22b362bc0a6e4e9dd

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-08 14:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24  2:13 [PATCH -next 1/2] nbd: allow genl access outside init_net Jakub Kicinski
2023-02-24  2:13 ` [PATCH -next 2/2] nbd: use the structured req attr check Jakub Kicinski
2023-03-02 18:29   ` Chaitanya Kulkarni
2023-03-02 18:29 ` [PATCH -next 1/2] nbd: allow genl access outside init_net Chaitanya Kulkarni
2023-03-08 14:36 ` Jens Axboe

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.