Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754269Ab1EKPjo (ORCPT ); Wed, 11 May 2011 11:39:44 -0400 Received: from eriks.xs4all.nl ([83.160.41.216]:35837 "EHLO eriks.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754220Ab1EKPjm (ORCPT ); Wed, 11 May 2011 11:39:42 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=slagter.name; h=message-id :date:from:mime-version:to:cc:subject:references:in-reply-to :content-type; q=dns; s=2007072601; b=m9aXZMk45Qo7XyPVq9tJi31Wut XvLmA4JExlYCqzVRx9kP/iK6a0mzrkF7+RK6ODE0VAHSH5bsBoUkakC4fqHqfV2/ xoTAeYBJ0widu0shzhltmQ8jaWJ/L1jkbMWkXgAwavDK285msf5CkzKCBVEKBFzW lJK5l0UlyDkymVu7M= Message-ID: <4DCA5FBF.1050009@slagter.name> Date: Wed, 11 May 2011 12:06:55 +0200 From: Erik Slagter User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 ThunderBrowse/3.3.5 MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: Maxin John , greg@kroah.com Subject: [PATCH 001/001]: USB: cdc_acm: Fix oops when Droids MuIn LCD is connected References: <20110510074421.GA2755@maxin> <4DC97BD0.6040403@slagter.name> In-Reply-To: Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="------------ms020406040501040406010101" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 10164 Lines: 185 This is a cryptographically signed message in MIME format. --------------ms020406040501040406010101 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Erik Slagter The Droids MuIn LCD operates like a serial remote terminal. Data received are displayed directly on the LCD. This patch fixes the kernel null pointer oops when it is plugged in. Add NO_DATA_INTERFACE quirk to tell the driver that "control" and "data" interfaces are not separated for this device, which prevents dereferencing a null pointer in the device probe code. Signed-off-by: Erik Slagter Signed-off-by: Maxin B. John Tested-by: Erik Slagter --- This patch applies to vanilla kernel 2.6.38.2, but I am quite confident it will apply to any recent kernel. It was created by Maxin John after I located the problem, slightly modified by me and tested by me, so blame me if it breaks anything. diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e057e53..caa2535 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -946,7 +946,7 @@ static int acm_probe(struct usb_interface *intf, u8 ac_management_function =3D 0; u8 call_management_function =3D 0; int call_interface_num =3D -1; - int data_interface_num; + int data_interface_num =3D -1; unsigned long quirks; int num_rx_buf; int i; @@ -1030,7 +1030,11 @@ next_desc: if (!union_header) { if (call_interface_num > 0) { dev_dbg(&intf->dev, "No union descriptor, using call management descr= iptor\n"); - data_interface =3D usb_ifnum_to_if(usb_dev, (data_interface_num =3D c= all_interface_num)); + /* quirks for Droids MuIn LCD */ + if (quirks & NO_DATA_INTERFACE) + data_interface =3D usb_ifnum_to_if(usb_dev, 0); + else + data_interface =3D usb_ifnum_to_if(usb_dev, (data_interface_num =3D = call_interface_num)); control_interface =3D intf; } else { if (intf->cur_altsetting->desc.bNumEndpoints !=3D 3) { @@ -1622,6 +1626,11 @@ static const struct usb_device_id acm_ids[] =3D { .driver_info =3D NOT_A_MODEM, }, + /* Support for Droids MuIn LCD */ + { USB_DEVICE(0x04d8, 0x000b), + .driver_info =3D NO_DATA_INTERFACE, + }, + /* control interfaces without any protocol set */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, USB_CDC_PROTO_NONE) }, diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index b4ea54d..683104a 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h @@ -137,3 +137,4 @@ struct acm { #define SINGLE_RX_URB 2 #define NO_CAP_LINE 4 #define NOT_A_MODEM 8 +#define NO_DATA_INTERFACE 16 --------------ms020406040501040406010101 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIPWDCC BIowggNyoAMCAQICECf06hH0eobEbp27bqkXBwcwDQYJKoZIhvcNAQEFBQAwbzELMAkGA1UE BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9vdDAeFw0w NTA2MDcwODA5MTBaFw0yMDA1MzAxMDQ4MzhaMIGuMQswCQYDVQQGEwJVUzELMAkGA1UECBMC VVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5l dHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cudXNlcnRydXN0LmNvbTE2MDQGA1UEAxMtVVRO LVVTRVJGaXJzdC1DbGllbnQgQXV0aGVudGljYXRpb24gYW5kIEVtYWlsMIIBIjANBgkqhkiG 9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsjmFpPJ9q0E7YkY3rs3BYHW8OWX5ShpHornMSMxqmNVN NRm5pELlzkniii8efNIxB8dOtINknS4p1aJkxIW9hVE1eaROaJB7HHqkkqgX8pgV8pPMyaQy lbsMTzC9mKALi+VuG6JG+ni8om+rWV6lL8/K2m2qL+usobNqqrcuZzWLeeEeaYji5kbNoKXq vgvOdjp6Dpvq/NonWz1zHyLmSGHGTPNpsaguG7bUMSAsvIKKjqQOpdeJQ/wWWq8dcdcRWdq6 hw2v+vPhwvCkxWeM1tZUOt4KpLoDd7NlyP0e03Riqh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BAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMV VGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5j b20xNjA0BgNVBAMTLVVUTi1VU0VSRmlyc3QtQ2xpZW50IEF1dGhlbnRpY2F0aW9uIGFuZCBF bWFpbAIRAIg14yiGxBLBNd3nEhie2VcwDQYJKoZIhvcNAQEBBQAEggEAqEMFKIw9Z2u33OET 8GGPIhpQznUViiRtT05Ss8dj1LYY1WK4thK+WBNRizNc79fkZN/4g3c5qXu1RmYrqWLL/z1C YviT12peBfjST6IEg+iBYERlGchnh/Q7iwV3DwcNkU71P5fqLcAdUhYxiypmTKRuqxFE8Lvd rOsCMH+Ot/QsHSs6MDfEqSCi942rwUGNpJnGgoIIteiMSk0xFvN7awolzDw41D4kklnUtd1q AjZfCIv7/sPXwB/n7ObgE5WcMCaxTKCvYRETbJOgp8Kcj5pwvomVyh286Aacq5UFPMUR0ef4 B8shg6C1f0nf6uUWIVzZ43aPvYM2zsgvAKU2gAAAAAAAAA== --------------ms020406040501040406010101-- -- 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/