From: Niels de Vos <ndevos@redhat.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>,
Alan Cox <alan@linux.intel.com>,
Greg Kroah-Hartman <gregkh@suse.de>,
Joe Krahn <krahn@niehs.nih.gov>, Andrew Morton <akpm@google.com>,
Rich.Liu@ite.com.tw, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] parport_pc: release IO region properly if unsupported ITE887x card is found
Date: Thu, 06 Oct 2011 17:48:56 +0100 [thread overview]
Message-ID: <4E8DDBF8.6080905@redhat.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1110061654280.31654@pobox.suse.cz>
On 10/06/2011 04:38 PM, Jiri Kosina wrote:
> sio_ite_8872_probe() bails out if it detects no-parallel (1S, 2S) or unknown
> card.
>
> It doesn't call release_region() on the previously allocated resource though.
> This causes
>
> (a) leak of the resource
> (b) kernel oops when parport module is removed and /proc/ioports is read. This
> is because the string that has been associated to the IO port region
> is a static char array inside the already removed module.
>
> Let's call release_region() properly before baling out.
>
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> ---
> drivers/parport/parport_pc.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
> index d1cdb94..d0b597b 100644
> --- a/drivers/parport/parport_pc.c
> +++ b/drivers/parport/parport_pc.c
> @@ -2595,14 +2595,17 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
> break;
> case 0x6:
> printk(KERN_INFO "parport_pc: ITE8873 found (1S)\n");
> + release_region(inta_addr[i], 32);
> return 0;
> case 0x8:
> printk(KERN_INFO "parport_pc: ITE8874 found (2S)\n");
> + release_region(inta_addr[i], 32);
> return 0;
> default:
> printk(KERN_INFO "parport_pc: unknown ITE887x\n");
> printk(KERN_INFO "parport_pc: please mail 'lspci -nvv' "
> "output to Rich.Liu@ite.com.tw\n");
> + release_region(inta_addr[i], 32);
> return 0;
> }
>
Looks good to me, now release_region() is now consistent through the
whole of sio_ite_8872_probe().
Also verified that this is not an issue in drivers/tty/serial/8250_pci.c
where a similar logic for the same chip is used.
Acked-by: Niels de Vos <ndevos@redhat.com>
prev parent reply other threads:[~2011-10-06 17:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-06 15:38 [PATCH] parport_pc: release IO region properly if unsupported ITE887x card is found Jiri Kosina
2011-10-06 16:48 ` Niels de Vos [this message]
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=4E8DDBF8.6080905@redhat.com \
--to=ndevos@redhat.com \
--cc=Rich.Liu@ite.com.tw \
--cc=akpm@google.com \
--cc=alan@linux.intel.com \
--cc=bjorn.helgaas@hp.com \
--cc=gregkh@suse.de \
--cc=jkosina@suse.cz \
--cc=krahn@niehs.nih.gov \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.