]> git.hungrycats.org Git - linux/commitdiff
netlink: fix unaligned access in nla_get_be64()
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 16 Mar 2010 13:30:44 +0000 (13:30 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 1 Apr 2010 23:02:09 +0000 (16:02 -0700)
[ Upstream commit f5d410f2ea7ba340f11815a56e05b9fa9421c421 ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/net/netlink.h

index a63b2192ac1cdf83dfc636ba362e58bd5da8b9ad..668ad04a9171e2fdc3dc65bc97f87a0eb40c06c6 100644 (file)
@@ -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;
 }
 
 /**