From: Andrew Morton <akpm@osdl.org>
To: "Om Narasimhan" <om.turyx@gmail.com>
Cc: "Yoichi Yuasa" <yoichi_yuasa@tripeaks.co.jp>,
linux-kernel@vger.kernel.org,
Dominik Brodowski <linux@dominikbrodowski.net>
Subject: Re: fixed PCMCIA au1000_generic.c potential crash.
Date: Sun, 8 Oct 2006 13:55:36 -0700 [thread overview]
Message-ID: <20061008135536.07b60db6.akpm@osdl.org> (raw)
In-Reply-To: <6b4e42d10610071626v22ca2dafpd88d689429313a98@mail.gmail.com>
On Sat, 7 Oct 2006 16:26:40 -0700
"Om Narasimhan" <om.turyx@gmail.com> wrote:
> Please find the corrected patch.
The patch is wordwrapped, has spaces replaced by tabs and each version is
subtly different from its predecessor. This confuses me.
Please confirm that the below is the appropriate and final patch, thanks.
From: "Om Narasimhan" <om.turyx@gmail.com>
The previous code did something like,
if (error) goto out_err;
....
do {
struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
del_timer_sync(&skt->poll_timer);
pcmcia_unregister_socket(&skt->socket);
out_err:
flush_scheduled_work();
ops->hw_shutdown(skt);
i--;
} while (i > 0)
.....
- On the error path, skt would not contain a valid value for the first
iteration (skt is masked by uninitialized automatic skt)
- Does not do hw_shutdown() for 0th element of PCMCIA_SOCKET
Signed-off-by: Om Narasimhan <om.turyx@gmail.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: "Yoichi Yuasa" <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
drivers/pcmcia/au1000_generic.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff -puN drivers/pcmcia/au1000_generic.c~pcmcia-au1000_generic-fix drivers/pcmcia/au1000_generic.c
--- a/drivers/pcmcia/au1000_generic.c~pcmcia-au1000_generic-fix
+++ a/drivers/pcmcia/au1000_generic.c
@@ -351,6 +351,7 @@ struct skt_dev_info {
int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr)
{
struct skt_dev_info *sinfo;
+ struct au1000_pcmcia_socket *skt;
int ret, i;
sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL);
@@ -365,7 +366,7 @@ int au1x00_pcmcia_socket_probe(struct de
* Initialise the per-socket structure.
*/
for (i = 0; i < nr; i++) {
- struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
+ skt = PCMCIA_SOCKET(i);
memset(skt, 0, sizeof(*skt));
skt->socket.resource_ops = &pccard_static_ops;
@@ -438,17 +439,19 @@ int au1x00_pcmcia_socket_probe(struct de
dev_set_drvdata(dev, sinfo);
return 0;
- do {
- struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
+
+out_err:
+ flush_scheduled_work();
+ ops->hw_shutdown(skt);
+ while (i-- > 0) {
+ skt = PCMCIA_SOCKET(i);
del_timer_sync(&skt->poll_timer);
pcmcia_unregister_socket(&skt->socket);
-out_err:
flush_scheduled_work();
ops->hw_shutdown(skt);
- i--;
- } while (i > 0);
+ }
kfree(sinfo);
out:
return ret;
_
next prev parent reply other threads:[~2006-10-08 20:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-07 23:26 Om Narasimhan
2006-10-08 20:55 ` Andrew Morton [this message]
2006-10-09 20:01 ` Om Narasimhan
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=20061008135536.07b60db6.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=om.turyx@gmail.com \
--cc=yoichi_yuasa@tripeaks.co.jp \
/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®