ucc_geth: fixes for ucc_geth_memclean
authorNicu Ioan Petru <ionut.nicu@freescale.com>
Fri, 13 Apr 2007 06:26:29 +0000 (01:26 -0500)
committerJeff Garzik <jeff@garzik.org>
Sat, 28 Apr 2007 15:01:05 +0000 (11:01 -0400)
commit3a8205ead4dc4b05fbc164eeb852b8f8921d11d3
treed78277465c1a5bfc31f2855145da5715ed2648f3
parentd5b9049df25f38b3eaf3af48d494b0747aae4349
ucc_geth: fixes for ucc_geth_memclean

The ucc_geth_memclean function can be called before the Tx BD rings, Rx
BD rings and associated socket buffers are allocated (for example if
ucc_fast_init fails). The current code doesn't check if p_tx_bd_ring[i]
is null, generating a kernel panic when trying to free the associated
socket buffers.

The function can also fail when accessing the uninitialized list_head
structures ugeth->group_hash_q and ugeth->ind_hash_q. In the current
implementation the list heads are initialized only when
maxGroupAddrInHash and maxIndAddrInHash are positive values, although I
think it's better to always initialize them.

Signed-off-by: Ionut Nicu <ionut.nicu@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/ucc_geth.c