lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 18 Sep 2012 17:14:41 +0530
From:	navin patidar <navinp@...c.in>
To:	Dan Carpenter <dan.carpenter@...cle.com>
Cc:	gregkh@...uxfoundation.org, mfm@...eddisk.com,
	devel@...verdev.osuosl.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: usbip: stub_dev: Fixed oops during removal of usbip_host

for usbip_host  event_handler()   handles following events.  defined
in "usbip_common.h"

 1. SDEV_EVENT_REMOVED   (USBIP_EH_SHUTDOWN | USBIP_EH_RESET | USBIP_EH_BYE)
 2. SDEV_EVENT_DOWN		(USBIP_EH_SHUTDOWN | USBIP_EH_RESET)
 3. SDEV_EVENT_ERROR_TCP	(USBIP_EH_SHUTDOWN | USBIP_EH_RESET)
 4. SDEV_EVENT_ERROR_SUBMIT	(USBIP_EH_SHUTDOWN | USBIP_EH_RESET)
 5. VDEV_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE)

In case of events(1,2,3,4),  stub_shoutdown_connection() gets executed
first and than stub_device_reset() .

In case of event 5, stub_shoutdown_connection()  kills kernel threads
and stub_device_unusable()   changes devices status to
"SDEV_ST_ERROR"(fatal error).

 thus stub_device_reset() can't  be called without
stub_shutdown_connection(), so there is no problem of resource leak .
you are also right, i could have set pointers to  NULL in
stub_shutdown_connection() but i used  stub_device_reset() which is
intended to reset usbip_device stuct member variables.

i'll resend patches, if maintainer ask for that.
thanks

--navin-patidar


On Tue, Sep 18, 2012 at 3:06 PM, Dan Carpenter <dan.carpenter@...cle.com> wrote:
> On Tue, Sep 18, 2012 at 03:02:15PM +0530, navin patidar wrote:
>> On Tue, Sep 18, 2012 at 1:10 PM, Dan Carpenter <dan.carpenter@...cle.com> wrote:
>> > On Tue, Sep 18, 2012 at 09:30:06AM +0530, navin patidar wrote:
>> >> stub_device_reset should set kernel thread pointers to NULL.
>> >> so that at the time of usbip_host removal stub_shoutdown_connection
>> >> doesn't try to kill kernel threads which are already killed.
>> >>
>> >
>> > If you have the Oops output, that's always nice to put in the commit
>> > message.
>>
>> i'll surely keep this in mind  before submitting further patches.
>>
>> > Why don't you set the pointers to NULL in stub_shutdown_connection()
>> > since that's where you actually kill the threads.  Setting them to
>> > NULL in stub_device_reset() will (sometimes) solve the problem but
>> > it gives you a new problem of a resource leak.
>>
>>  stub_device_reset() always gets executed after
>> stub_shutdown_connection() , never before.
>>
>
> No it isn't.  Read event_handler() more carefully.  They can be
> executed independently.
>
> In other words, stub_shutdown_connection() can be called without
> calling stub_device_reset() and stub_device_reset() can be called
> without stub_shutdown_connection().  If either of those happen then
> it causes a problem with the patch you have just sent.
>
> regards,
> dan carpenter
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ