Skip to content

Commit

Permalink
isicom: fix buffer allocation
Browse files Browse the repository at this point in the history
Fix the rather strange buffer management on open that turned up while auditing
for BKL dependencies.

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Apr 30, 2008
1 parent fb100b6 commit 8cd6451
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/char/isicom.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,15 +813,13 @@ static int isicom_setup_port(struct isi_port *port)
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);
Expand Down

0 comments on commit 8cd6451

Please sign in to comment.