Messages in this thread | | | Date | Thu, 15 Jul 1999 00:29:13 +0200 (CEST) | From | Daniel Kobras <> | Subject | Re: rtl8139.c lacks a free_irq(). |
| |
On Wed, 14 Jul 1999, Donald Becker wrote:
> 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.
While this is probably true for Linux proper, I came across this glitch running a Mach kernel that uses the Linux net drivers through a glue layer. The glue layer currently can only handle kmalloc()s up to 64K minus a few bytes, so given the default rx buffer size of 64K, the kmalloc actually will _always_ fail.
> [[ Hmmm, now why do I have a kfree() there, if it's just a last-ditch check. > Errrrmmm... uhmmmm.. ]]
Because you're such a nice guy who writes code that behaves well even on different OSs than the one it was supposed to run on??? ;-)
Regards,
Daniel.
- 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/
| |