mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Nelson <james4765@cwazy.co.uk>
To: linux-kernel@vger.kernel.org
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	James Nelson <james4765@cwazy.co.uk>
Subject: [PATCH 2.4] lcd: fix memory leak in lcd_ioctl()
Date: Thu, 27 Jan 2005 18:25:09 -0600	[thread overview]
Message-ID: <20050128002508.23839.95066.57216@localhost.localdomain> (raw)
In-Reply-To: <20050128002501.23839.78981.57374@localhost.localdomain>

This patch fixes a memory leak in the FLASH_Burn ioctl for the Cobalt LCD interface driver.

Signed-off-by: James Nelson <james4765@gmail.com>

diff -purN --exclude='*~' linux-2.4.29-original/drivers/char/lcd.c linux-2.4.29/drivers/char/lcd.c
--- linux-2.4.29-original/drivers/char/lcd.c	2005-01-27 18:46:42.085690494 -0500
+++ linux-2.4.29/drivers/char/lcd.c	2005-01-27 18:49:38.011310971 -0500
@@ -434,8 +434,10 @@ static int lcd_ioctl(struct inode *inode
 		save_flags(flags);
 		for (i=0; i<FLASH_SIZE; i=i+128) {
 
-		        if(copy_from_user(rom, display.RomImage + i, 128))
+		        if(copy_from_user(rom, display.RomImage + i, 128)) {
+			   kfree(rom);
 			   return -EFAULT;
+			}
 			burn_addr = kFlashBase + i;
 			cli();
 			for ( index = 0; index < ( 128 ) ; index++ ) 

  reply	other threads:[~2005-01-28  0:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-28  0:25 [PATCH 2.4] lcd: Add checks to CAP_SYS_ADMIN to potentially dangerous ioctl's James Nelson
2005-01-28  0:25 ` James Nelson [this message]
2005-01-29 16:26   ` [PATCH 2.4] lcd: fix memory leak in lcd_ioctl() Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050128002508.23839.95066.57216@localhost.localdomain \
    --to=james4765@cwazy.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®