From: Tilman Schmidt <tilman@imap.cc>
To: Dan Carpenter <error27@gmail.com>
Cc: Hansjoerg Lipp <hjlipp@web.de>,
Karsten Keil <isdn@linux-pingi.de>,
"David S. Miller" <davem@davemloft.net>,
Tejun Heo <tj@kernel.org>, Joe Perches <joe@perches.com>,
gigaset307x-common@lists.sourceforge.net, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] isdn: gigaset: use after free
Date: Sun, 08 Aug 2010 12:55:45 +0000 [thread overview]
Message-ID: <4C5EA951.9040106@imap.cc> (raw)
In-Reply-To: <20100806082126.GT9031@bicker>
[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]
Am 06.08.2010 10:21 schrieb Dan Carpenter:
> I moved the kfree(cb) below the dereferences.
Thanks for finding and fixing that bug.
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Tilman Schmidt <tilman@imap.cc>
> diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
> index 0ded364..707d9c9 100644
> --- a/drivers/isdn/gigaset/bas-gigaset.c
> +++ b/drivers/isdn/gigaset/bas-gigaset.c
> @@ -1914,11 +1914,13 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
> * The next command will reopen the AT channel automatically.
> */
> if (cb->len == 3 && !memcmp(cb->buf, "+++", 3)) {
> - kfree(cb);
> rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT);
> if (cb->wake_tasklet)
> tasklet_schedule(cb->wake_tasklet);
> - return rc < 0 ? rc : cb->len;
> + if (!rc)
> + rc = cb->len;
> + kfree(cb);
> + return rc;
> }
>
> spin_lock_irqsave(&cs->cmdlock, flags);
--
Tilman Schmidt E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Tilman Schmidt <tilman@imap.cc>
To: Dan Carpenter <error27@gmail.com>
Cc: Hansjoerg Lipp <hjlipp@web.de>,
Karsten Keil <isdn@linux-pingi.de>,
"David S. Miller" <davem@davemloft.net>,
Tejun Heo <tj@kernel.org>, Joe Perches <joe@perches.com>,
gigaset307x-common@lists.sourceforge.net, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] isdn: gigaset: use after free
Date: Sun, 08 Aug 2010 14:55:45 +0200 [thread overview]
Message-ID: <4C5EA951.9040106@imap.cc> (raw)
In-Reply-To: <20100806082126.GT9031@bicker>
[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]
Am 06.08.2010 10:21 schrieb Dan Carpenter:
> I moved the kfree(cb) below the dereferences.
Thanks for finding and fixing that bug.
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Tilman Schmidt <tilman@imap.cc>
> diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
> index 0ded364..707d9c9 100644
> --- a/drivers/isdn/gigaset/bas-gigaset.c
> +++ b/drivers/isdn/gigaset/bas-gigaset.c
> @@ -1914,11 +1914,13 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
> * The next command will reopen the AT channel automatically.
> */
> if (cb->len == 3 && !memcmp(cb->buf, "+++", 3)) {
> - kfree(cb);
> rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT);
> if (cb->wake_tasklet)
> tasklet_schedule(cb->wake_tasklet);
> - return rc < 0 ? rc : cb->len;
> + if (!rc)
> + rc = cb->len;
> + kfree(cb);
> + return rc;
> }
>
> spin_lock_irqsave(&cs->cmdlock, flags);
--
Tilman Schmidt E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
next prev parent reply other threads:[~2010-08-08 12:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-06 8:21 [patch] isdn: gigaset: use after free Dan Carpenter
2010-08-06 8:21 ` Dan Carpenter
2010-08-08 6:04 ` David Miller
2010-08-08 6:04 ` David Miller
2010-08-08 12:55 ` Tilman Schmidt [this message]
2010-08-08 12:55 ` Tilman Schmidt
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=4C5EA951.9040106@imap.cc \
--to=tilman@imap.cc \
--cc=davem@davemloft.net \
--cc=error27@gmail.com \
--cc=gigaset307x-common@lists.sourceforge.net \
--cc=hjlipp@web.de \
--cc=isdn@linux-pingi.de \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tj@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.