Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

isicom: fix buffer allocation

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>

authored by

Alan Cox and committed by
Linus Torvalds
8cd64518 fb100b6e

+6 -8
+6 -8
drivers/char/isicom.c
··· 813 813 return 0; 814 814 if (!port->xmit_buf) { 815 815 /* Relies on BKL */ 816 - void *xmit_buf = (void *)get_zeroed_page(GFP_KERNEL); 817 - 818 - if (xmit_buf == NULL) 816 + unsigned long page = get_zeroed_page(GFP_KERNEL); 817 + if (page == 0) 819 818 return -ENOMEM; 820 - if (port->xmit_buf) { 821 - free_page((unsigned long)xmit_buf); 822 - return -ERESTARTSYS; 823 - } 824 - port->xmit_buf = xmit_buf; 819 + if (port->xmit_buf) 820 + free_page(page); 821 + else 822 + port->xmit_buf = (unsigned char *) page; 825 823 } 826 824 827 825 spin_lock_irqsave(&card->card_lock, flags);