From patchwork Sat Oct 29 08:06:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1316 Return-Path: Received: from nm17.bullet.mail.ukl.yahoo.com (nm17.bullet.mail.ukl.yahoo.com [217.146.183.191]) by open-mesh.org (Postfix) with SMTP id 0E66560084D for ; Sat, 29 Oct 2011 10:07:38 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.208] by nm17.bullet.mail.ukl.yahoo.com with NNFMP; 29 Oct 2011 08:07:37 -0000 Received: from [77.238.184.78] by tm1.bullet.mail.ukl.yahoo.com with NNFMP; 29 Oct 2011 08:07:37 -0000 Received: from [127.0.0.1] by smtp147.mail.ukl.yahoo.com with NNFMP; 29 Oct 2011 08:07:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1319875657; bh=pKWZ7BJwo8EVWXOyZvVCYTxjJxEkJTmeGJtZmOC+Vbg=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=wzHeEtjSwhQ+CRr/oXTvwJUnlMAfyLccBT5X/yNL64ahpAw7sH4wQFy+ZT+cjJAbzKj6Jj72IDN7mFj9JFL8dRClQ2Q0yDZgBrOhDJdchtV57uOSrzsxzNnN1uleIt9z8axBo/9Ep9p9KdtpseprtZUr6QuEalhZz9ytgRLXkno= X-Yahoo-Newman-Id: 729906.91738.bm@smtp147.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: xaYUiPgVM1lNlsaKNp6UgHi9eoSYKkFYeefE_9RGM6NUKf. RsJtLilj_MUlEDWEyrTyGJJn_I1n41thHO2BBHgObfI6lkDVYLY8LzPg7w.X BGZVLaGyV0KSynjzpsPCdLasCoHfTTz3SC2BSq2hdT_ZD6Ww8gcW4WlgIXMB eBwbOJTWD61ATTH.OFYA5_hTKUJt_r.ATdEqfEUBsvsng0Qbi4fFkz.j6ExZ HlzSfoy.SU7rCksoE0Vpduyy_.5ztNH0f07CjTAOc6Jgwc1yjBdNs7_2VYkw _YgsrXnPXPk.l..w.cp0LRSJ0MPxIOLZ1k8NFEUrLB8vWtd7QmtL20BVyMNm 8zqCTstEhmR2Af1KD1T4OUdbBOIaY7PhTMm3894YMl54fed6.kDnkS.k- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@78.46.248.235 with plain) by smtp147.mail.ukl.yahoo.com with SMTP; 29 Oct 2011 08:07:36 +0000 GMT From: Marek Lindner To: davem@davemloft.net Date: Sat, 29 Oct 2011 10:06:46 +0200 Message-Id: <1319875606-7794-4-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1319875606-7794-1-git-send-email-lindner_marek@yahoo.de> References: <1319875606-7794-1-git-send-email-lindner_marek@yahoo.de> Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner , stable@kernel.org Subject: [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: unify hash_entry field position in tt_local/global_entry X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Oct 2011 08:07:38 -0000 From: Antonio Quartulli Function tt_response_fill_table() actually uses a tt_local_entry pointer to iterate either over the local or the global table entries (it depends on the what hash table is passed as argument). To iterate over such entries the hlist_for_each_entry_rcu() macro has to access their "hash_entry" field which MUST be at the same position in both the tt_global/local_entry structures. Reported-by: Simon Wunderlich Signed-off-by: Antonio Quartulli Signed-off-by: Marek Lindner --- net/batman-adv/types.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 1ae3557..ab8d0fe 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h @@ -224,22 +224,22 @@ struct socket_packet { struct tt_local_entry { uint8_t addr[ETH_ALEN]; + struct hlist_node hash_entry; unsigned long last_seen; uint16_t flags; atomic_t refcount; struct rcu_head rcu; - struct hlist_node hash_entry; }; struct tt_global_entry { uint8_t addr[ETH_ALEN]; + struct hlist_node hash_entry; /* entry in the global table */ struct orig_node *orig_node; uint8_t ttvn; uint16_t flags; /* only TT_GLOBAL_ROAM is used */ unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */ atomic_t refcount; struct rcu_head rcu; - struct hlist_node hash_entry; /* entry in the global table */ }; struct tt_change_node {