The paper investigates on fairness of utilities between uplink and downlink traffic flows in IEEE 802.11 Wireless Local Area Networks (WLAN) with an infrastructure mode. We propose a cognitive resource allocation scheme to tackle the fairness problem. The proposed scheme is cognitive by using neural networks to on-line learn the nonlinear function between the adopted Medium Access Control (MAC) parameters and the corresponding throughput. Thus, the learned knowledge can be exploited to adjust MAC parameters dynamically toward the utility fairness between uplink and downlink flows. Simulations results demonstrate that our adaptive scheme can effectively provide fair uplink and downlink utilities in a varying heterogeneous WLAN environment.