Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] drbd_nl.c:drbd_adm_prepare() indexes drbd_genl_ops[] by cmd number
@ 2019-05-31 19:01 David Butterfield
  2019-06-03  9:21 ` Lars Ellenberg
       [not found] ` <cf05cd9c-687f-6264-0bc3-aefa90c91b3a@gmail.com>
  0 siblings, 2 replies; 9+ messages in thread
From: David Butterfield @ 2019-05-31 19:01 UTC (permalink / raw)
  To: drbd-dev

(Is this the right place to send comments on the source code such as this one?)

In drbd_nl.c:

  static int drbd_adm_prepare(struct drbd_config_context *adm_ctx,
  	struct sk_buff *skb, struct genl_info *info, unsigned flags)
  {
  	struct drbd_genlmsghdr *d_in = info->userhdr;
  	const u8 cmd = info->genlhdr->cmd;
  	int err;
  
  	memset(adm_ctx, 0, sizeof(*adm_ctx));
  
+ 	//XXX I do not think you can find the ops for a command number by indexing this array.
+ 	//XXX The array is unordered and packed.  I think it must search like genl_get_cmd().
  	/*
  	 * genl_rcv_msg() only checks if commands with the GENL_ADMIN_PERM flag
  	 * set have CAP_NET_ADMIN; we also require CAP_SYS_ADMIN for
  	 * administrative commands.
  	 */
  	if ((drbd_genl_ops[cmd].flags & GENL_ADMIN_PERM) &&
  	    drbd_security_netlink_recv(skb, CAP_SYS_ADMIN))
  		return -EPERM;
  
  	adm_ctx->reply_skb = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
  	if (!adm_ctx->reply_skb) {
  		err = -ENOMEM;
  		goto fail;
  	}

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

end of thread, other threads:[~2019-06-24 15:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-31 19:01 [Drbd-dev] drbd_nl.c:drbd_adm_prepare() indexes drbd_genl_ops[] by cmd number David Butterfield
2019-06-03  9:21 ` Lars Ellenberg
     [not found] ` <cf05cd9c-687f-6264-0bc3-aefa90c91b3a@gmail.com>
     [not found]   ` <CANr6vz8kxacCYSb38G464Y2c1xw1ZqZAddN45LTwEcnE_Y2dsA@mail.gmail.com>
2019-06-04  8:18     ` David Butterfield
2019-06-04  9:41       ` Lars Ellenberg
2019-06-04  9:49         ` Lars Ellenberg
2019-06-05 15:57       ` [Drbd-dev] history uuids misaligned within device_statistics David Butterfield
2019-06-12 13:58         ` Lars Ellenberg
2019-06-18  6:16           ` David Butterfield
2019-06-24 15:35             ` Lars Ellenberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox