netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netdev@vger.kernel.org
Cc: kaber@trash.net, davem@davemloft.net
Subject: [PATCH 3/3] netlink: fix unaligned access in nla_get_be64()
Date: Wed, 17 Mar 2010 00:30:44 +0100	[thread overview]
Message-ID: <20100316233044.4185.69099.stgit@decadence> (raw)
In-Reply-To: <20100316232247.4185.19426.stgit@decadence>

This patch fixes a unaligned access in nla_get_be64() that was
introduced by myself in a17c859849402315613a0015ac8fbf101acf0cc1.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/net/netlink.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/net/netlink.h b/include/net/netlink.h
index a63b219..668ad04 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -945,7 +945,11 @@ static inline u64 nla_get_u64(const struct nlattr *nla)
  */
 static inline __be64 nla_get_be64(const struct nlattr *nla)
 {
-	return *(__be64 *) nla_data(nla);
+	__be64 tmp;
+
+	nla_memcpy(&tmp, nla, sizeof(tmp));
+
+	return tmp;
 }
 
 /**


  parent reply	other threads:[~2010-03-16 23:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 23:29 [PATCH 0/3] several minor Netlink fixes Pablo Neira Ayuso
2010-03-16 23:29 ` [PATCH 1/3] netlink: fix NETLINK_RECV_NO_ENOBUFS in netlink_set_err() Pablo Neira Ayuso
2010-03-17  0:04   ` Pablo Neira Ayuso
2010-03-17 15:26   ` Patrick McHardy
2010-03-17 16:17     ` Pablo Neira Ayuso
2010-03-18 13:02       ` Patrick McHardy
2010-03-18 16:34         ` Pablo Neira Ayuso
2010-03-18 16:46           ` Patrick McHardy
2010-03-18 17:01             ` Pablo Neira Ayuso
2010-03-18 17:22               ` Patrick McHardy
2010-03-19  0:24                 ` Pablo Neira Ayuso
2010-03-20 21:30                   ` David Miller
2010-03-22 15:38                     ` Patrick McHardy
2010-03-16 23:30 ` [PATCH 2/3] netfilter: ctnetlink: fix reliable event delivery if message building fails Pablo Neira Ayuso
2010-03-16 23:30 ` Pablo Neira Ayuso [this message]
2010-03-20  5:44   ` [PATCH 3/3] netlink: fix unaligned access in nla_get_be64() David Miller

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=20100316233044.4185.69099.stgit@decadence \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --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).