Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933778Ab3GEC77 (ORCPT ); Thu, 4 Jul 2013 22:59:59 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:36408 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932541Ab3GEC75 (ORCPT ); Thu, 4 Jul 2013 22:59:57 -0400 Date: Fri, 5 Jul 2013 10:59:47 +0800 From: Adam Lee To: Yang Bai Cc: linux-bluetooth@vger.kernel.org, Wen-chien Jesse Sung , AceLan Kao , Tedd Ho-Jeong An , "Anthony Wong'" , Marcel Holtmann , Gustavo Padovan , Johan Hedberg , open list Subject: Re: [PATCH] btusb: fix overflow return values Message-ID: <20130705025947.GA10744@adam-laptop> Mail-Followup-To: Yang Bai , linux-bluetooth@vger.kernel.org, Wen-chien Jesse Sung , AceLan Kao , Tedd Ho-Jeong An , Anthony Wong' , Marcel Holtmann , Gustavo Padovan , Johan Hedberg , open list References: <1372941783-30657-1-git-send-email-adam.lee@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1286 Lines: 38 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 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/