lkml.org 
[lkml]   [2008]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] isicom: Fix buffer allocation
Fix the rather strange buffer management on open that turned up while
auditing for BKL dependancies

Signed-off-by: Alan Cox <alan@redhat.com>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.25-mm1/drivers/char/isicom.c linux-2.6.25-mm1/drivers/char/isicom.c
--- linux.vanilla-2.6.25-mm1/drivers/char/isicom.c 2008-04-28 11:36:48.000000000 +0100
+++ linux-2.6.25-mm1/drivers/char/isicom.c 2008-04-14 10:56:25.000000000 +0100
@@ -813,15 +813,13 @@
return 0;
if (!port->xmit_buf) {
/* Relies on BKL */
- void *xmit_buf = (void *)get_zeroed_page(GFP_KERNEL);
-
- if (xmit_buf == NULL)
+ unsigned long page = get_zeroed_page(GFP_KERNEL);
+ if (page == 0)
return -ENOMEM;
- if (port->xmit_buf) {
- free_page((unsigned long)xmit_buf);
- return -ERESTARTSYS;
- }
- port->xmit_buf = xmit_buf;
+ if (port->xmit_buf)
+ free_page(page);
+ else
+ port->xmit_buf = (unsigned char *) page;
}

spin_lock_irqsave(&card->card_lock, flags);

\
 
 \ /
  Last update: 2008-04-29 15:27    [W:0.191 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site