From: Pavel Machek <pavel@ucw.cz>
To: pali.rohar@gmail.com, sre@debian.org, sre@ring0.de,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
tony@atomide.com, khilman@kernel.org, aaro.koskinen@iki.fi,
ivo.g.dimitrov.75@gmail.com, linux-bluetooth@vger.kernel.org,
marcel@holtmann.org
Subject: Re: [PATCH] bluetooth: Add hci_h4p driver
Date: Tue, 20 Jan 2015 22:49:22 +0100 [thread overview]
Message-ID: <20150120214922.GA21262@amd> (raw)
In-Reply-To: <20150120082850.GA27162@t440s.lan>
On Tue 2015-01-20 10:28:50, Johan Hedberg wrote:
> Hi Pavel,
>
> On Tue, Dec 23, 2014, Pavel Machek wrote:
> > + while (1) {
> > + int cmd, len;
> > +
> > + fw_pos += cmd_len;
> > +
> > + if (fw_pos >= fw_entry->size)
> > + break;
> > +
> > + if (fw_pos + 2 > fw_entry->size) {
> > + dev_err(info->dev, "Corrupted firmware image\n");
> > + err = -EMSGSIZE;
> > + break;
> > + }
> > +
> > + cmd_len = fw_entry->data[fw_pos++];
> > + cmd_len += fw_entry->data[fw_pos++] << 8;
> > + if (cmd_len == 0)
> > + break;
> > +
> > + if (fw_pos + cmd_len > fw_entry->size) {
> > + dev_err(info->dev, "Corrupted firmware image\n");
> > + err = -EMSGSIZE;
> > + break;
> > + }
> > +
> > + /* Skip first two packets */
> > + if (++num <= 2)
> > + continue;
> > +
> > + /* Note that this is timing-critical. If sending packets takes too
> > + * long, initialization will fail.
> > + */
> > + cmd = fw_entry->data[fw_pos+1];
> > + cmd += fw_entry->data[fw_pos+2] << 8;
> > + len = fw_entry->data[fw_pos+3];
> > +
> > + skb = __hci_cmd_sync(info->hdev, cmd, len, fw_entry->data+fw_pos+4, 500);
> > + if (IS_ERR(skb)) {
> > + dev_err(info->dev, "...sending cmd %x len %d failed %ld\n",
> > + cmd, len, PTR_ERR(skb));
> > + err = -EIO;
> > + break;
> > + }
> > + }
>
> Looks like the code is leaking skb when __hci_cmd_sync() succeeds.
Fixed, thanks!
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
WARNING: multiple messages have this Message-ID (diff)
From: pavel@ucw.cz (Pavel Machek)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] bluetooth: Add hci_h4p driver
Date: Tue, 20 Jan 2015 22:49:22 +0100 [thread overview]
Message-ID: <20150120214922.GA21262@amd> (raw)
In-Reply-To: <20150120082850.GA27162@t440s.lan>
On Tue 2015-01-20 10:28:50, Johan Hedberg wrote:
> Hi Pavel,
>
> On Tue, Dec 23, 2014, Pavel Machek wrote:
> > + while (1) {
> > + int cmd, len;
> > +
> > + fw_pos += cmd_len;
> > +
> > + if (fw_pos >= fw_entry->size)
> > + break;
> > +
> > + if (fw_pos + 2 > fw_entry->size) {
> > + dev_err(info->dev, "Corrupted firmware image\n");
> > + err = -EMSGSIZE;
> > + break;
> > + }
> > +
> > + cmd_len = fw_entry->data[fw_pos++];
> > + cmd_len += fw_entry->data[fw_pos++] << 8;
> > + if (cmd_len == 0)
> > + break;
> > +
> > + if (fw_pos + cmd_len > fw_entry->size) {
> > + dev_err(info->dev, "Corrupted firmware image\n");
> > + err = -EMSGSIZE;
> > + break;
> > + }
> > +
> > + /* Skip first two packets */
> > + if (++num <= 2)
> > + continue;
> > +
> > + /* Note that this is timing-critical. If sending packets takes too
> > + * long, initialization will fail.
> > + */
> > + cmd = fw_entry->data[fw_pos+1];
> > + cmd += fw_entry->data[fw_pos+2] << 8;
> > + len = fw_entry->data[fw_pos+3];
> > +
> > + skb = __hci_cmd_sync(info->hdev, cmd, len, fw_entry->data+fw_pos+4, 500);
> > + if (IS_ERR(skb)) {
> > + dev_err(info->dev, "...sending cmd %x len %d failed %ld\n",
> > + cmd, len, PTR_ERR(skb));
> > + err = -EIO;
> > + break;
> > + }
> > + }
>
> Looks like the code is leaking skb when __hci_cmd_sync() succeeds.
Fixed, thanks!
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2015-01-20 21:49 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-23 13:02 [PATCH] bluetooth: Add hci_h4p driver Pavel Machek
2014-12-23 13:02 ` Pavel Machek
2014-12-23 13:02 ` Pavel Machek
2015-01-18 12:02 ` Pavel Machek
2015-01-18 12:02 ` Pavel Machek
2015-01-19 21:36 ` Marcel Holtmann
2015-01-19 21:36 ` Marcel Holtmann
2015-01-20 17:36 ` Pavel Machek
2015-01-20 17:36 ` Pavel Machek
2015-01-20 18:34 ` Marcel Holtmann
2015-01-20 18:34 ` Marcel Holtmann
2015-01-21 11:01 ` Pavel Machek
2015-01-21 11:01 ` Pavel Machek
2015-01-21 11:01 ` Pavel Machek
2015-01-21 11:46 ` Pali Rohár
2015-01-21 11:46 ` Pali Rohár
2015-01-21 11:46 ` Pali Rohár
2015-01-20 8:28 ` Johan Hedberg
2015-01-20 8:28 ` Johan Hedberg
2015-01-20 21:49 ` Pavel Machek [this message]
2015-01-20 21:49 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2014-12-13 22:37 Pavel Machek
2014-12-20 20:23 ` [PATCH] " Pavel Machek
2014-12-20 20:23 ` Pavel Machek
2014-12-20 20:23 ` Pavel Machek
2014-12-20 20:43 ` Paul Bolle
2014-12-20 20:43 ` Paul Bolle
2014-12-20 23:35 ` Marcel Holtmann
2014-12-20 23:35 ` Marcel Holtmann
2014-12-23 12:00 ` Pavel Machek
2014-12-23 12:00 ` Pavel Machek
2014-12-23 12:41 ` Pavel Machek
2014-12-23 12:41 ` Pavel Machek
2013-09-20 19:01 [PATCH] Bluetooth: " Pali Rohár
2013-10-17 20:25 ` Pali Rohár
2013-10-17 22:11 ` Marcel Holtmann
[not found] ` <201310180739.47841@pali>
2013-10-18 8:56 ` Marcel Holtmann
2013-10-18 10:30 ` Pali Rohár
2013-10-24 16:41 ` Pali Rohár
2013-10-24 18:41 ` Joe Perches
2013-10-26 19:28 ` Pali Rohár
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=20150120214922.GA21262@amd \
--to=pavel@ucw.cz \
--cc=aaro.koskinen@iki.fi \
--cc=ivo.g.dimitrov.75@gmail.com \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=pali.rohar@gmail.com \
--cc=sre@debian.org \
--cc=sre@ring0.de \
--cc=tony@atomide.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 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.