From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752175AbcFFIUo (ORCPT ); Mon, 6 Jun 2016 04:20:44 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:52905 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994AbcFFIUl (ORCPT ); Mon, 6 Jun 2016 04:20:41 -0400 X-AuditID: cbfec7f4-f796c6d000001486-82-575532567451 Subject: Re: [PATCH] usb: usbip: fix null pointer dereference To: Sudip Mukherjee , Valentina Manea , Shuah Khan , Greg Kroah-Hartman References: <1464873753-11456-1-git-send-email-sudipm.mukherjee@gmail.com> <57513FF3.6050608@samsung.com> <5754675B.1050104@gmail.com> Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org From: Krzysztof Opasiak Message-id: <57553255.2050505@samsung.com> Date: Mon, 06 Jun 2016 10:20:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-version: 1.0 In-reply-to: <5754675B.1050104@gmail.com> Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPLMWRmVeSWpSXmKPExsVy+t/xy7phRqHhBq2fJCyaF69ns7i8aw6b xaJlrcwWXz5zWRw4PYXZ4t2luewObB47Z91l99g/dw27R9+WVYwenzfJBbBEcdmkpOZklqUW 6dslcGV8+3GBveAhb8XBZbOZGhg/c3UxcnBICJhIdPbWdDFyApliEhfurWfrYuTiEBJYyigx YcdrKOc5o0T39ZPMIFXCArYSS6YfZAFJiAjsZJSYuucKI0RVB6PEi6Z97CBVzALWEisOrWYG WcEmoC8xb5coSJhXQEvi2IJZYINYBFQl5ryeDlYuKhAhMWv7DyaIGkGJH5PvsYDYnAKaEj2T nzGBjGEWUJeYMiUXYrq8xOY1b5knMArMQtIxC6FqFpKqBYzMqxhFU0uTC4qT0nMN9YoTc4tL 89L1kvNzNzFCgvnLDsbFx6wOMQpwMCrx8K7IDwkXYk0sK67MPcQowcGsJML7RDE0XIg3JbGy KrUoP76oNCe1+BCjNAeLkjjv3F3vQ4QE0hNLUrNTUwtSi2CyTBycUg2Mq8serpvfkTBpoS1z B2P+YR3PH4yPtzZxhQdLLtv0WPbC+mP3l/f01Szwjno36/W/+8uSxPh5NPKONpyd+OBx8Dve T6tcz98VPbW6vcj8ndHBzkkLdolPFE2OW7Xqu+L/gvbpiy5c/8TcHfCv5j6rXfyx0wlTTpk5 HRNS59bmeW3JeapxFfeHhUosxRmJhlrMRcWJAFGHY41iAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/05/2016 07:54 PM, Sudip Mukherjee wrote: > On Friday 03 June 2016 09:29 AM, Krzysztof Opasiak wrote: >> >> >> On 06/02/2016 03:22 PM, Sudip Mukherjee wrote: >>> We have been dereferencing udc before checking it. Lets use it after it >>> has been checked. >>> >> >> To be honest I have mixed feelings about this patch. >> >> On one hand it prevents us from dereferencing potential NULL ptr what is >> generally good. But on the other hand it seems to be a little bit >> pointless overhead. This function is called only in one place, it's >> internal function of vudc driver and in addition generally it is >> currently impossible that this function will get NULL ptr as parameter >> as it's value is taken from container_of(). Not to mention that if this >> is NULL or garbage we will end up in NULL ptr dereference much earlier >> before calling this function. >> >> So if there is something that you would like to fix with this patch and >> you have a real problem with this function could you please provide us >> some more details (for example stack trace)? If this patch is just to >> prevent us from something that will never happen then I would rather to >> not submit this. In my opinion if we get a NULL in this function this >> means that we have some serious problem in UDC core and this check will >> just mask this error. > > Yes, I should have seen earlier that the only caller has already > dereferenced udc. So maybe the following will be appropriate in this > situation. > Your patch does exactly what Alan suggested and I agree with it;) Could you please resend this properly so Greg can easily pick it up? Best regards, -- Krzysztof Opasiak Samsung R&D Institute Poland Samsung Electronics