Re: rtl8139.c lacks a free_irq().

Donald Becker (becker@cesdis1.gsfc.nasa.gov)
Wed, 14 Jul 1999 14:33:26 -0400 (EDT)


On Wed, 14 Jul 1999, Daniel Kobras wrote:

> The Realtek 8139 driver in 2.3.11pre4 (driver version 1.07) is missing a
> free_irq() in case the kmalloc()s in rtl8129_open() fail. The patch below
> applies to 2.3.11pre4, a similar fix is required in 2.2.x (driver version
> 1.04).
...
> tp->rx_ring = kmalloc(RX_BUF_LEN + 16, GFP_KERNEL);
> if (tp->tx_bufs == NULL || tp->rx_ring == NULL) {
> + free_irq(dev->irq, dev);
> if (tp->tx_bufs)

Yes, nominally this appears to be a bug.
But the kmalloc(... GFP_KERNEL); should never fail. It might hang forever
waiting for memory, but it won't fail.
The check is here is only to prevent disaster should the semantics of
GFP_KERNEL change.

[[ Hmmm, now why do I have a kfree() there, if it's just a last-ditch check.
Errrrmmm... uhmmmm.. ]]

Donald Becker becker@cesdis.gsfc.nasa.gov
USRA-CESDIS, Center of Excellence in Space Data and Information Sciences.
Code 930.5, Goddard Space Flight Center, Greenbelt, MD. 20771
301-286-0882 http://cesdis.gsfc.nasa.gov/people/becker/whoiam.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/