From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511AbcFCI3s (ORCPT ); Fri, 3 Jun 2016 04:29:48 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:12745 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752473AbcFCI3o (ORCPT ); Fri, 3 Jun 2016 04:29:44 -0400 X-AuditID: cbfec7f5-f792a6d000001302-30-57513ff4bb2c 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> Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org From: Krzysztof Opasiak Message-id: <57513FF3.6050608@samsung.com> Date: Fri, 03 Jun 2016 10:29:39 +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: <1464873753-11456-1-git-send-email-sudipm.mukherjee@gmail.com> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLLMWRmVeSWpSXmKPExsVy+t/xq7pf7APDDeZN0bVoXryezeLyrjls FouWtTJbfPnMZXHg9BRmi3eX5rI7sHnsnHWX3WP/3DXsHn1bVjF6fN4kF8ASxWWTkpqTWZZa pG+XwJVx5dAMloIGroojr9+yNzD+Ye9i5OCQEDCRWPvYqIuRE8gUk7hwbz0biC0ksJRR4s61 5C5GLiD7OaPE1D2XmEESwgK2EkumH2QBSYgI7ARJXGGE6PCSuNr7mR3EZhawllhxaDUzyAI2 AX2JebtEQcK8AloSjWums4LYLAKqElN+LgArFxWIkJi1/QcTRI2gxI/J91hAbE4Bb4lfE+4x goxhFtCTuH9RC2K6vMTmNW+ZJzAKzELSMQuhahaSqgWMzKsYRVNLkwuKk9JzjfSKE3OLS/PS 9ZLzczcxQgL56w7GpcesDjEKcDAq8fAyLA4IF2JNLCuuzD3EKMHBrCTCa20bGC7Em5JYWZVa lB9fVJqTWnyIUZqDRUmcd+au9yFCAumJJanZqakFqUUwWSYOTqkGxm2rxbIkXH6Wn/tXb131 RYS14qywliVPndx202D/k/HvFG4WWP7VZLv9xWPax2dMNnUhok0P5spteFhyO9dr19v18p4G udxRmRKJqiETT+9VXixyYwe7a/PcCu+mafUT2KVUelQKWVOmJ18x+yVof3dFsoHGL7ZMSa79 a//5n9ffLSb0apqiEktxRqKhFnNRcSIA9W0rxGACAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Best regards, -- Krzysztof Opasiak Samsung R&D Institute Poland Samsung Electronics