public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adam Lee <adam.lee@canonical.com>
To: Yang Bai <hamo.by@gmail.com>
Cc: linux-bluetooth@vger.kernel.org,
	Wen-chien Jesse Sung <jesse.sung@canonical.com>,
	AceLan Kao <acelan.kao@canonical.com>,
	Tedd Ho-Jeong An <tedd.an@intel.com>,
	"Anthony Wong'" <anthony.wong@canonical.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Gustavo Padovan <gustavo@padovan.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] btusb: fix overflow return values
Date: Fri, 5 Jul 2013 10:59:47 +0800	[thread overview]
Message-ID: <20130705025947.GA10744@adam-laptop> (raw)
In-Reply-To: <CAO_0yfOXfO1ZNTNbYRnuY-CQ44hH+DqoEB5jnCwfhLPTq-RUqQ@mail.gmail.com>

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.

> On Thu, Jul 4, 2013 at 8:43 PM, Adam Lee <adam.lee@canonical.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

  parent reply	other threads:[~2013-07-05  2:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04 12:43 [PATCH] btusb: fix overflow return values Adam Lee
     [not found] ` <CAO_0yfOXfO1ZNTNbYRnuY-CQ44hH+DqoEB5jnCwfhLPTq-RUqQ@mail.gmail.com>
2013-07-05  2:53   ` Yang Bai
2013-07-05  2:59   ` Adam Lee [this message]
2013-07-05  4:41     ` Adam Lee
2013-07-08 18:50 ` Marcel Holtmann
2013-07-09  2:55   ` Adam Lee
2013-07-09  7:40     ` Adam Lee
2013-07-09  8:48       ` [PATCH v2] btusb: fix wrong use of PTR_ERR() Adam Lee
2013-07-09 15:32     ` [PATCH] btusb: fix overflow return values Gustavo Padovan
2013-07-10  2:02       ` [PATCH v3] btusb: fix wrong use of PTR_ERR() Adam Lee
2013-07-10 10:28         ` Gustavo Padovan

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=20130705025947.GA10744@adam-laptop \
    --to=adam.lee@canonical.com \
    --cc=acelan.kao@canonical.com \
    --cc=anthony.wong@canonical.com \
    --cc=gustavo@padovan.org \
    --cc=hamo.by@gmail.com \
    --cc=jesse.sung@canonical.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=tedd.an@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox