linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [compat-old PATCH 1/2] Fix wrong cast to ieee80211_local
@ 2008-09-26 14:19 Jiri Benc
  2008-09-26 14:20 ` [compat-old PATCH 2/2] Allow compilation on 2.6.22 Jiri Benc
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Benc @ 2008-09-26 14:19 UTC (permalink / raw)
  To: linux-wireless; +Cc: Luis R. Rodriguez

This fixes a kernel crash that was caused by using a wrong pointer for
ieee80211_local dereference in mq compat implementation.

Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

(The bug is described at http://wireless.kernel.org/en/users/Download/compat-wireless-old-2.6.22-bug)

 net/mac80211/mq_compat.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- cw.orig/net/mac80211/mq_compat.h
+++ cw/net/mac80211/mq_compat.h
@@ -22,7 +22,7 @@
  */
 
 #define IEEE80211_DEV_TO_LOCAL(dev) \
-	((struct ieee80211_local *)(IEEE80211_DEV_TO_SUB_IF(dev))->local)
+	((struct ieee80211_local *)(wdev_priv(dev->ieee80211_ptr)))
 
 /* This was stripped out after MQ patch for mac80211, let bring it
  * back to life */


-- 
Jiri Benc
SUSE Labs

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

* [compat-old PATCH 2/2] Allow compilation on 2.6.22
  2008-09-26 14:19 [compat-old PATCH 1/2] Fix wrong cast to ieee80211_local Jiri Benc
@ 2008-09-26 14:20 ` Jiri Benc
  2008-09-26 23:19   ` Luis R. Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Benc @ 2008-09-26 14:20 UTC (permalink / raw)
  To: linux-wireless; +Cc: Luis R. Rodriguez

This allows compilation of compat-wireless-old on 2.6.22 kernel. I suspect
some drivers don't work despite they compile, though.

Signed-off-by: Jiri Benc <jbenc@suse.cz>

---
 config.mk                              |    4 +++-
 drivers/net/wireless/libertas/if_usb.c |    2 ++
 include/net/compat.h                   |   17 +++++++++++++++++
 net/mac80211/wme.c                     |    2 +-
 4 files changed, 23 insertions(+), 2 deletions(-)

--- cw.orig/config.mk
+++ cw/config.mk
@@ -27,7 +27,6 @@ CONFIG_MAC80211=m
 ifeq ($(shell test -e $(KLIB_BUILD)/Makefile && echo yes),yes)
 KERNEL_SUBLEVEL = $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
 ifeq ($(shell test $(KERNEL_SUBLEVEL) -lt 23 && echo yes),yes)
-$(error "ERROR: There is a bug with compat-wireless on 2.6.22. Remove me if you want to fix me")
 CONFIG_MAC80211_QOS=y
 else
 
@@ -154,7 +153,10 @@ CONFIG_P54_PCI=m
 CONFIG_SSB_PCIHOST=y
 CONFIG_SSB_DRIVER_PCICORE=y
 CONFIG_SSB_B43_PCI_BRIDGE=y
+ifeq ($(shell test $(KERNEL_SUBLEVEL) -gt 22 && echo yes),yes)
+# b44 is not ported to 2.6.22
 CONFIG_B44=m
+endif
 
 CONFIG_RTL8180=m
 CONFIG_ADM8211=m
--- cw.orig/drivers/net/wireless/libertas/if_usb.c
+++ cw/drivers/net/wireless/libertas/if_usb.c
@@ -947,7 +947,9 @@ static struct usb_driver if_usb_driver =
 	.id_table = if_usb_table,
 	.suspend = if_usb_suspend,
 	.resume = if_usb_resume,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
 	.reset_resume = if_usb_resume,
+#endif
 };
 
 static int __init if_usb_init_module(void)
--- cw.orig/include/net/compat.h
+++ cw/include/net/compat.h
@@ -33,6 +33,7 @@
 
 #include <net/arp.h>
 #include <net/neighbour.h>
+#include <net/pkt_sched.h>
 
 #include <linux/compat_autoconf.h>
 
@@ -173,6 +174,22 @@ static inline int netif_is_multiqueue(co
 	return (!!(NETIF_F_MULTI_QUEUE & dev->features));
 }
 
+/* 2.6.23 fixed a bug in tcf_destroy_chain and the parameter changed */
+static inline void tcf_destroy_chain_compat(struct tcf_proto **fl)
+{
+	struct tcf_proto *tp;
+
+	while ((tp = *fl) != NULL) {
+		*fl = tp->next;
+		tp->ops->destroy(tp);
+		module_put(tp->ops->owner);
+		kfree(tp);
+	}
+}
+
+#else
+
+#define tcf_destroy_chain_compat tcf_destroy_chain
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) */
 
--- cw.orig/net/mac80211/wme.c
+++ cw/net/mac80211/wme.c
@@ -310,7 +310,7 @@ static void wme_qdiscop_destroy(struct Q
 	struct ieee80211_hw *hw = &local->hw;
 	int queue;
 
-	tcf_destroy_chain(&q->filter_list);
+	tcf_destroy_chain_compat(&q->filter_list);
 
 	for (queue = 0; queue < QD_NUM(hw); queue++) {
 		skb_queue_purge(&q->requeued[queue]);


-- 
Jiri Benc
SUSE Labs

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

* Re: [compat-old PATCH 2/2] Allow compilation on 2.6.22
  2008-09-26 14:20 ` [compat-old PATCH 2/2] Allow compilation on 2.6.22 Jiri Benc
@ 2008-09-26 23:19   ` Luis R. Rodriguez
  0 siblings, 0 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2008-09-26 23:19 UTC (permalink / raw)
  To: Jiri Benc; +Cc: linux-wireless@vger.kernel.org, Luis R. Rodriguez

On Fri, Sep 26, 2008 at 07:20:36AM -0700, Jiri Benc wrote:
> This allows compilation of compat-wireless-old on 2.6.22 kernel. I suspect
> some drivers don't work despite they compile, though.
> 
> Signed-off-by: Jiri Benc <jbenc@suse.cz>

Thanks patches pulled and new compat-wireless-old tarball regenerated.

  Luis

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

end of thread, other threads:[~2008-09-26 23:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-26 14:19 [compat-old PATCH 1/2] Fix wrong cast to ieee80211_local Jiri Benc
2008-09-26 14:20 ` [compat-old PATCH 2/2] Allow compilation on 2.6.22 Jiri Benc
2008-09-26 23:19   ` Luis R. Rodriguez

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