From: Mike Anderson <andmike@us.ibm.com>
To: James Smart <James.Smart@Emulex.Com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [RFC] FC Transport : Async Events via netlink interface
Date: Tue, 18 Apr 2006 09:01:21 -0700 [thread overview]
Message-ID: <20060418160121.GA2707@us.ibm.com> (raw)
In-Reply-To: <1145306661.4151.0.camel@localhost.localdomain>
Looks good, comments below.
James Smart <James.Smart@Emulex.Com> 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@us.ibm.com
next prev parent reply other threads:[~2006-04-18 16:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-17 20:44 [RFC] FC Transport : Async Events via netlink interface James Smart
2006-04-18 16:01 ` Mike Anderson [this message]
2006-04-19 12:52 ` James Smart
2006-04-19 12:57 ` [RFC] Netlink and user-space buffer pointers James Smart
2006-04-19 16:22 ` Patrick McHardy
2006-04-19 17:08 ` James Smart
2006-04-19 17:16 ` Patrick McHardy
2006-04-19 16:26 ` Stephen Hemminger
2006-04-19 17:05 ` James Smart
2006-04-19 21:32 ` Mike Christie
2006-04-20 14:33 ` James Smart
2006-04-20 17:45 ` Mike Christie
2006-04-20 17:52 ` Mike Christie
2006-04-20 17:58 ` Mike Christie
2006-04-20 20:03 ` James Smart
2006-04-20 20:35 ` Mike Christie
2006-04-20 20:40 ` Mike Christie
2006-04-20 21:41 ` Mike Christie
2006-04-20 21:51 ` Mike Christie
2006-04-20 23:07 ` Mike Christie
2006-04-20 23:44 ` Andrew Vasquez
2006-04-20 20:18 ` Douglas Gilbert
2006-04-19 14:59 ` [RFC] FC Transport : Async Events via netlink interface Matthew Wilcox
2006-04-19 16:11 ` James Smart
-- strict thread matches above, loose matches on Subject: below --
2006-04-17 22:46 Moore, Eric
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=20060418160121.GA2707@us.ibm.com \
--to=andmike@us.ibm.com \
--cc=James.Smart@Emulex.Com \
--cc=linux-scsi@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).