netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@infradead.org>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: Greg Rose <gregory.v.rose@intel.com>,
	netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [RFC V2 PATCH] rtnetlink: Fix problem with buffer allocation
Date: Wed, 15 Feb 2012 09:08:14 -0500	[thread overview]
Message-ID: <20120215140814.GA29673@canuck.infradead.org> (raw)
In-Reply-To: <1329253993.2443.30.camel@bwh-desktop>

On Tue, Feb 14, 2012 at 09:13:13PM +0000, Ben Hutchings wrote:
> > +		struct rtattr *ext_req;
> > +		u32 *ext_req_data;
> > +		req = (struct rtnl_req_extended *)cb->nlh;
> > +		ext_req = (struct rtattr *)&req->ext;
> > +		if (ext_req->rta_type == IFLA_EXT_MASK) {
> > +			ext_req_data = RTA_DATA(ext_req);
> > +			ext_filter_mask = *ext_req_data;
> > +		}
> > +	}
> 
> We cannot trust a flag to tell us what the length of the message is.  We
> have to check the value of nlmsg_len (which netlink has already
> validated as being within the skb length and >= our declared request
> header length).  I think that makes the flag redundant.
> 
> In fact, I think we should really use nlmsg_parse() here.  That might be
> overkill when there's only a single valid attribute; I don't know.

I think it's worth the effort. You get all the validation for free. And
please use the netlink interface in <net/netlink.h>, the rtattr based
interface has been deprecated a while ago.

  parent reply	other threads:[~2012-02-15 14:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-12 19:13 [RFC V2 PATCH] rtnetlink: Fix problem with buffer allocation Greg Rose
2012-02-13 17:28 ` Stephen Hemminger
2012-02-13 18:24   ` Rose, Gregory V
2012-02-14 21:13 ` Ben Hutchings
2012-02-14 21:27   ` Rose, Gregory V
2012-02-14 21:31     ` David Miller
2012-02-14 21:41       ` Rose, Gregory V
2012-02-14 21:48         ` David Miller
2012-02-14 21:51           ` Rose, Gregory V
2012-02-15 14:08   ` Thomas Graf [this message]
2012-02-15 16:32     ` Rose, Gregory V
2012-02-14 21:22 ` David Miller
2012-02-14 21:34   ` Rose, Gregory V

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=20120215140814.GA29673@canuck.infradead.org \
    --to=tgraf@infradead.org \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=gregory.v.rose@intel.com \
    --cc=netdev@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).