[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#412749: linux-image-2.6.18-4-sparc64: Kernel unaligned access in eth1394_reset_priv



Package: linux-image-2.6.18-4-sparc64
Version: 2.6.18.dfsg.1-11
Severity: normal
Tags: patch

The eth1394 module is affected by an unaligned access problem:

$ dmesg |grep unaligned
Kernel unaligned access at TPC[101940c8] ether1394_reset_priv+0x2c/0xb8 [eth1394]

This problem is fixed in Linux 2.6.20, patch attached.

ciao,
    ema
--- linux-source-2.6.18/drivers/ieee1394/eth1394.c.old	2007-02-26 23:07:21.000000000 +0100
+++ linux-source-2.6.18/drivers/ieee1394/eth1394.c	2007-02-27 21:25:02.000000000 +0100
@@ -65,6 +65,7 @@
 #include <asm/uaccess.h>
 #include <asm/delay.h>
 #include <asm/semaphore.h>
+#include <asm/unaligned.h>
 #include <net/arp.h>
 
 #include "csr1212.h"
@@ -491,7 +492,7 @@
 	int i;
 	struct eth1394_priv *priv = netdev_priv(dev);
 	struct hpsb_host *host = priv->host;
-	u64 guid = *((u64*)&(host->csr.rom->bus_info_data[3]));
+	u64 guid = get_unaligned((u64*)&(host->csr.rom->bus_info_data[3]));
 	u16 maxpayload = 1 << (host->csr.max_rec + 1);
 	int max_speed = IEEE1394_SPEED_MAX;
 
@@ -894,6 +895,7 @@
 		u16 maxpayload;
 		struct eth1394_node_ref *node;
 		struct eth1394_node_info *node_info;
+		__be64 guid;
 
 		/* Sanity check. MacOSX seems to be sending us 131 in this
 		 * field (atleast on my Panther G5). Not sure why. */
@@ -902,8 +904,9 @@
 
 		maxpayload = min(eth1394_speedto_maxpayload[sspd], (u16)(1 << (max_rec + 1)));
 
+		guid = get_unaligned(&arp1394->s_uniq_id);
 		node = eth1394_find_node_guid(&priv->ip_node_list,
-					      be64_to_cpu(arp1394->s_uniq_id));
+					      be64_to_cpu(guid));
 		if (!node) {
 			return 0;
 		}
@@ -1675,8 +1678,9 @@
 		if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF])
 			priv->bc_dgl++;
 	} else {
+		__be64 guid = get_unaligned((u64 *)eth->h_dest);
 		node = eth1394_find_node_guid(&priv->ip_node_list,
-					      be64_to_cpu(*(u64*)eth->h_dest));
+					      be64_to_cpu(guid));
 		if (!node) {
 			ret = -EAGAIN;
 			goto fail;

Attachment: signature.asc
Description: Digital signature


Reply to: