netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] veth: Enforce minimum size of VETH_INFO_PEER
@ 2012-02-15 14:09 Thomas Graf
  2012-02-15 19:59 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Graf @ 2012-02-15 14:09 UTC (permalink / raw)
  To: davem; +Cc: netdev, Thomas Graf

VETH_INFO_PEER carries struct ifinfomsg plus optional IFLA
attributes. A minimal size of sizeof(struct ifinfomsg) must be
enforced or we may risk accessing that struct beyond the limits
of the netlink message.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
---
 drivers/net/veth.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 49f4667..4a34028 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -422,7 +422,9 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
 	unregister_netdevice_queue(peer, head);
 }
 
-static const struct nla_policy veth_policy[VETH_INFO_MAX + 1];
+static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = {
+	[VETH_INFO_PEER]	= { .len = sizeof(struct ifinfomsg) },
+};
 
 static struct rtnl_link_ops veth_link_ops = {
 	.kind		= DRV_NAME,
-- 
1.7.7.6

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

* Re: [PATCH] veth: Enforce minimum size of VETH_INFO_PEER
  2012-02-15 14:09 [PATCH] veth: Enforce minimum size of VETH_INFO_PEER Thomas Graf
@ 2012-02-15 19:59 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-02-15 19:59 UTC (permalink / raw)
  To: tgraf; +Cc: netdev

From: Thomas Graf <tgraf@suug.ch>
Date: Wed, 15 Feb 2012 15:09:46 +0100

> VETH_INFO_PEER carries struct ifinfomsg plus optional IFLA
> attributes. A minimal size of sizeof(struct ifinfomsg) must be
> enforced or we may risk accessing that struct beyond the limits
> of the netlink message.
> 
> Signed-off-by: Thomas Graf <tgraf@suug.ch>

Applied and queued up for -stable, thanks Thomas.

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

end of thread, other threads:[~2012-02-15 20:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-15 14:09 [PATCH] veth: Enforce minimum size of VETH_INFO_PEER Thomas Graf
2012-02-15 19:59 ` David Miller

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).