[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130705044137.GB10744@adam-laptop>
Date: Fri, 5 Jul 2013 12:41:37 +0800
From: Adam Lee <adam.lee@...onical.com>
To: Yang Bai <hamo.by@...il.com>, linux-bluetooth@...r.kernel.org,
Wen-chien Jesse Sung <jesse.sung@...onical.com>,
AceLan Kao <acelan.kao@...onical.com>,
Tedd Ho-Jeong An <tedd.an@...el.com>,
Anthony Wong' <anthony.wong@...onical.com>,
Marcel Holtmann <marcel@...tmann.org>,
Gustavo Padovan <gustavo@...ovan.org>,
Johan Hedberg <johan.hedberg@...il.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] btusb: fix overflow return values
On Fri, Jul 05, 2013 at 10:59:47AM +0800, Adam Lee wrote:
> On Fri, Jul 05, 2013 at 10:37:07AM +0800, Yang Bai wrote:
> > The return value of btusb_setup_intel is compared with 0. Code as:
> >
> > drivers/bluetooth/btusb.c:
> > static int btusb_probe(struct usb_interface *intf,
> > const struct usb_device_id *id)
> > if (id->driver_info & BTUSB_INTEL)
> > hdev->setup = btusb_setup_intel;
> >
> > net/bluetooth/hci_core.c:
> > int hci_dev_open(__u16 dev)
> > if (hdev->setup && test_bit(HCI_SETUP, &hdev->dev_flags))
> > ret = hdev->setup(hdev);
> >
> > if (!ret) {
>
> Yes, for btusb_setup_intel(), the return value is compared with number
> "0", doesn't break the judgement.
>
> But it still overflows stack without this fix.
And what if the lower 32bits of PTR_ERR() are all "0"? :D
> > On Thu, Jul 4, 2013 at 8:43 PM, Adam Lee <adam.lee@...onical.com> wrote:
> >
> > PTR_ERR() returns a long type value, but btusb_setup_intel() and
> > btusb_setup_intel_patching() should return an int type value.
> >
> > This bug makes the judgement "if (ret < 0)" not working on x86_64
> > architecture systems, leading to failure as below, even panic.
--
Regards,
Adam Lee
Hardware Enablement
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists