Re: PATCH: prism2_remove_proc fix (Prism2 Host AP - new release 2002-04-21)

From: Jouni Malinen (
Date: 2002-04-22 15:26:52 UTC

On Mon, Apr 22, 2002 at 02:05:15PM +0200, Reyk Floeter wrote:

> this version works fine, but there is a null pointer exception after
> some loads/unloads. i tried the following test script with 2 prism2.5
> pci cards and the kernel segfaulted after about 12 cycles:

I was unable to crash my test setup yesterday with a similar script (however, I was using only one Prism2.5 card). Anyway, now that you sent a patch for this, I found the bug that is probably causing these crashes.

> - remove_proc_entry(local->dev->name, prism2_proc);
> + remove_proc_entry(local->dev->name, local->proc);

That is not correct. wlan# directory is in prism2_proc, not in local->proc (which, actually, is the wlan# directory).

The crash was caused due to incorrect unregister order used in hostap_pci.o and hostap_plx.o (hostap_cs.o used correct order). Module cleanup first removed /proc/net/prism2 directory (prism2_proc) and only after that different function tried to remove /proc/net/prism2/wlan# directory and its contents. At this point, prism2_proc was not pointing to valid data anymore.

The attached patch fixes exit routine order in PCI and PLX versions. In addition, it adds some extra verification routines to prism2_proc.c (these should not be needed, but better be a bit too careful than miss something).

I tested the modified driver with two Prism2.5 cards and your script. I did not notice any problems during 100 rounds.

Jouni Malinen                                            PGP id EFC895FA

This archive was generated by hypermail 2.1.4.