Re: [RFC] FC Transport : Async Events via netlink interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks good, comments below.

James Smart <James.Smart@xxxxxxxxxx> wrote:
> +static void
> +fc_send_event(struct fc_nl_user *nluser, struct fc_nl_event *event)
> +{
> +	struct sk_buff *skb;
> +	struct nlmsghdr	*nlh;
> +	struct fc_nl_event *evt;
> +	const char *name, *fn;
> +	u32 len = NLMSG_SPACE(sizeof(*event));
> +	int err;
> +
> +	skb = alloc_skb(len, GFP_KERNEL);
> +	if (!skb) {
> +		err = -ENOBUFS;
> +		fn = "alloc_skb";
> +		goto send_fail;
> +	}
> +
> +	nlh = nlmsg_put(skb, nluser->pid, 0, FC_TRANSPORT_MSG,
> +			len - sizeof(*nlh), 0);
> +	if (!nlh) {
> +		err = -ENOBUFS;
> +		fn = "nlmsg_put";
> +		goto send_fail;
> +	}
> +	evt = NLMSG_DATA(nlh);
> +	memcpy(evt, event, sizeof(*event));
> +
> +	err = nlmsg_unicast(fc_nl_sock, skb, nluser->pid);
> +	if (err < 0) {
> +		fn = "nlmsg_unicast";
> +		goto send_fail;
> +	}

Is there some reason that you are not using nlmsg_multicast. The caller of
this function is somewhat simulating the function of multicast.

> +
> +	return;
> +
> +send_fail:
> +	name = get_fc_host_event_code_name(event->event_code);
> +	printk(KERN_WARNING
> +		"%s: Dropped Event to PID %d : %s data 0x%08x : %s : err %d\n",
> +		__FUNCTION__, nluser->pid, (name) ? name : "<unknown>",
> +		event->event_data, fn, err);
> +	return;
> +}

In the send_fail case it looks like you leak skbs. Do you need to add a
call to nlmsg_free or kfree_skb?


-andmike
--
Michael Anderson
andmike@xxxxxxxxxx
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux