[PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-19 Thread Ming Lei
ock before calling usb_unlink_urb. CC: Signed-off-by: Ming Lei --- drivers/hid/usbhid/hid-core.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index aa1c503..b5d07da 100644 --- a/drivers/hid/usbhid/

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-19 Thread Ming Lei
On Fri, Apr 20, 2012 at 12:11 AM, Oliver Neukum wrote: > Am Donnerstag, 19. April 2012, 15:51:04 schrieb Ming Lei: >> The URB complete handler may be called by usb_unlink_urb directly, >> so deadlock will be triggered in __usbhid_submit_report since >> usbhid->lock is to

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-20 Thread Ming Lei
static inline void clear_cpu_bit(int nr, unsigned long __percpu *addr) +{ + unsigned long *fl = __this_cpu_ptr(addr); + clear_bit(nr, fl); +} + +static inline int test_cpu_bit(int nr, unsigned long __percpu *addr) +{ + unsigned long *fl = __this_cpu_ptr(addr); + return test_bit(nr, fl); +} + #endif thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-20 Thread Ming Lei
On Fri, Apr 20, 2012 at 6:45 PM, Oliver Neukum wrote: > Am Freitag, 20. April 2012, 12:17:51 schrieb Ming Lei: >> On Fri, Apr 20, 2012 at 3:57 PM, Oliver Neukum wrote: >> > >> > You are racing with hid_irq_out(). It calls hid_submit_out() >> > under lock. So

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-20 Thread Ming Lei
erstand you mean URB complete handler should be guaranteed to be run only in IRQ context and can't be called by usb_unlink_urb, don't I? If yes, many hc drivers are still involved to be modified. thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable&qu

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-20 Thread Ming Lei
On Sat, Apr 21, 2012 at 5:59 AM, Dmitry Torokhov wrote: > On Friday, April 20, 2012 06:17:51 PM Ming Lei wrote: > Why don't you do something like this: > >        urb_to_unlink = usbhid->urbout; >        usbhid->urbout = NULL; This may trigger oops in hid_submit_out ca

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-21 Thread Ming Lei
nk_urb does? just implement usb_unlink_urb as something like tasklet_schedule(unlink_tasklet). Then we can have a uniform lock requirement and no changes are involved on host controller drivers. Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-22 Thread Ming Lei
the lock -- the race has already been lost. > > Does that solve your problem? Not sure if that does work. If the URB completes asynchronously after unlinking, its status is still -ECONNRESET, so extra race may be caused without holding the lock because complete handler will access some global d

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-22 Thread Ming Lei
On Sun, Apr 22, 2012 at 1:31 AM, Alan Stern wrote: > On Sat, 21 Apr 2012, Ming Lei wrote: >> How about always scheduling a tasklet to run what usb_unlink_urb does? >> just implement usb_unlink_urb as something like >> tasklet_schedule(unlink_tasklet). >> >>

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-22 Thread Ming Lei
On Sun, Apr 22, 2012 at 8:50 PM, Alan Stern wrote: > On Sun, 22 Apr 2012, Ming Lei wrote: > >> > Although the kerneldoc doesn't actually say so, it should be safe to >> > assume that usb_unlink_urb calls the completion routine directly _only_ >> > in cases

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-23 Thread Ming Lei
On Mon, Apr 23, 2012 at 11:42 PM, Alan Stern wrote: > On Sun, 22 Apr 2012, Ming Lei wrote: >> If the lock which is to be acquired in the URB complete handler is dropped >> before calling usb_unlink_urb, one new submitted URB in complete handler >> may be unlinked, as mentio

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-24 Thread Ming Lei
On Tue, Apr 24, 2012 at 10:22 PM, Oliver Neukum wrote: > Am Dienstag, 24. April 2012, 06:19:00 schrieb Ming Lei: > >> @@ -486,11 +494,15 @@ static void hid_ctrl(struct urb *urb) >> >>       if (usbhid->ctrlhead != usbhid->ctrltail && !hid_submit_ctrl(hi

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-24 Thread Ming Lei
On Tue, Apr 24, 2012 at 11:20 PM, Alan Stern wrote: > On Tue, 24 Apr 2012, Ming Lei wrote: > >> > Instead of changing return codes or adding locks, how about >> > implementing a small state machine for each URB? >> > >> >        Initially the state is A

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-24 Thread Ming Lei
uct usbhid_device { unsigned long last_out; /* record of last output for timeouts */ spinlock_t lock; /* fifo spinlock */ + spinlock_t unlink_lock;

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-25 Thread Ming Lei
ks it is enough to avoid the race, isn't it? > We'd be back at the original proposal. Introducing a new flag to describe 'unlinked' is still OK, but borrowing urb->unlinked is better, the bad is that it is private. Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-25 Thread Ming Lei
transfer requests en masse >  * @anchor: anchor the requests are bound to >  * > diff --git a/include/linux/usb.h b/include/linux/usb.h > index 73b68d1..23df8ae 100644 > --- a/include/linux/usb.h > +++ b/include/linux/usb.h > @@ -1379,6 +1379,8 @@ extern int usb_unlink_urb(struc

Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

2012-04-25 Thread Ming Lei
On Wed, Apr 25, 2012 at 6:52 PM, Oliver Neukum wrote: > Am Mittwoch, 25. April 2012, 11:14:19 schrieb Ming Lei: >> You need to add check of "usbhid->outtail != usbhid->outhead" above. > > Done. Could you test? Basically my USB keyboard can work well as before wit

[PATCH] block: partition: optimize memory allocation in check_partition

2013-01-31 Thread Ming Lei
a bit big for kmalloc - given that many devices have the partition count limit, so only allocate disk_max_parts() partitions instead of 256 partitions Cc: stable@vger.kernel.org Signed-off-by: Ming Lei --- block/partition-generic.c |2 +- block/partitions/check.c | 35

Re: [PATCH] block: partition: optimize memory allocation in check_partition

2013-01-31 Thread Ming Lei
arts; > > This is relatively unusual style. > Could you break out this struct instead? IMO, looks it isn't necessary since no one uses the type of the embedded structure directly, and the style isn't introduced by this patch, which only follows the previous one. Thanks, -- M

Re: [PATCH] block: partition: optimize memory allocation in check_partition

2013-02-01 Thread Ming Lei
On Fri, Feb 1, 2013 at 4:33 PM, Yasuaki Ishimatsu wrote: > At least, you should use release_partitions() instead of kfree() here. Good catch, thank you for pointing it out, and I will post v1 later with the update. Thanks, -- Ming Lei -- To unsubscribe from this list: send the l

[PATCH v1] block: partition: optimize memory allocation in check_partition

2013-02-01 Thread Ming Lei
a bit big for kmalloc - given that many devices have the partition count limit, so only allocate disk_max_parts() partitions instead of 256 partitions Cc: stable@vger.kernel.org Signed-off-by: Ming Lei --- v1: - add one missing free_partitions - rename release_partitions as

Re: [PATCH v1] block: partition: optimize memory allocation in check_partition

2013-02-16 Thread Ming Lei
On Sat, Feb 2, 2013 at 6:43 AM, Andrew Morton wrote: > On Fri, 1 Feb 2013 20:23:12 +0800 I just return from holiday, sorry for the delay, and thanks for the review. > Ming Lei wrote: > >> Currently, sizeof(struct parsed_partitions) may be 64KB in 32bit arch, >> so it is

Re: FAILED: patch "[PATCH] usbnet: smsc95xx: fix suspend failure" failed to apply to 3.8-stable tree

2013-02-28 Thread Ming Lei
Hi Greg, The attachment patch is backported from the commit below: >From 7643721471117d5f62ca36f328d3dc8d84af4402 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Fri, 22 Feb 2013 03:05:03 + Subject: [PATCH] usbnet: smsc95xx: fix suspend failure and this patch can be applied cleanly agai

[PATCH 3.8-stable] usbnet: smsc95xx: fix suspend failure

2013-03-04 Thread Ming Lei
commit: From 7643721471117d5f62ca36f328d3dc8d84af4402 Mon Sep 17 00:00:00 2001 Subject: [PATCH] usbnet: smsc95xx: fix suspend failure Cc: Cc: Steve Glendinning Signed-off-by: Ming Lei --- drivers/net/usb/smsc95xx.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/n

[PATCH] Bluetooth: Add support for Dell[QCA 0cf3:0036]

2013-03-13 Thread Ming Lei
) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms Cc: Cc: Gustavo Padovan Signed-off-by: Ming Lei --- drivers

[PATCH v1] Bluetooth: Add support for Dell[QCA 0cf3:0036]

2013-03-14 Thread Ming Lei
) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms Cc: Cc: Gustavo Padovan Signed-off-by: Ming Lei --- v1

Re: [PATCH] Bluetooth: Add support for Dell[QCA 0cf3:0036]

2013-03-14 Thread Ming Lei
and sent out. Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH] Bluetooth: Add support for Dell[QCA 0cf3:817a]

2013-03-18 Thread Ming Lei
) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms Cc: Cc: Gustavo Padovan Signed-off-by: Ming Lei --- drivers/bluetooth/ath3k.c |2 ++ drivers/bluetooth/btusb.c

[PATCH 1/2] sysfs: fix race between readdir and lseek

2013-03-20 Thread Ming Lei
e problem since the lock is always held in readdir path. Reported-by: Dave Jones Tested-by: Sasha Levin Cc: Signed-off-by: Ming Lei --- fs/sysfs/dir.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 2fbdff6..c9e1660 100644

[PATCH 2/2] sysfs: handle failure path correctly for readdir()

2013-03-20 Thread Ming Lei
gered later. This patch returns immeadiately under the situation for fixing the bug, and it is reasonable to return from readdir() when filldir() fails. Reported-by: Dave Jones Tested-by: Sasha Levin Cc: Signed-off-by: Ming Lei --- fs/sysfs/dir.c |4 1 file changed, 4 insertions(+

Re: [PATCH 1/2] sysfs: fix race between readdir and lseek

2013-03-20 Thread Ming Lei
On Thu, Mar 21, 2013 at 10:41 AM, Li Zefan wrote: > > In fact the same race exists between readdir() and read()/write()... Fortunately, no read()/write() are implemented on sysfs directory, :-) Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable&q

Re: [PATCH 1/2] sysfs: fix race between readdir and lseek

2013-03-20 Thread Ming Lei
On Thu, Mar 21, 2013 at 11:28 AM, Li Zefan wrote: > On 2013/3/21 11:17, Ming Lei wrote: >> On Thu, Mar 21, 2013 at 10:41 AM, Li Zefan wrote: >>> >>> In fact the same race exists between readdir() and read()/write()... >> >> Fortunately, no read()/wri

Re: [PATCH 1/2] sysfs: fix race between readdir and lseek

2013-03-22 Thread Ming Lei
On Fri, Mar 22, 2013 at 1:48 PM, Li Zefan wrote: > On 2013/3/21 12:48, Ming Lei wrote: > > Yes, it can...As I said, it's irrelevant, because it's vfs that changes > file->f_pos. > > SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) >

[PATCH] USB: serial: fix hang when opening port

2013-03-25 Thread Ming Lei
sb&m=136368139627876&w=2 Cc: stable Signed-off-by: Ming Lei --- Cc stable since the previous patchset is marked as stable. drivers/usb/serial/usb-serial.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 2e70e

Re: [PATCH 1/2] sysfs: fix race between readdir and lseek

2013-03-26 Thread Ming Lei
Also I appreciate it if you may share your test case... Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH 1/2] sysfs: fix race between readdir and lseek

2013-03-26 Thread Ming Lei
Hi Zefan, On Tue, Mar 26, 2013 at 4:45 PM, Ming Lei wrote: > On Tue, Mar 26, 2013 at 3:30 PM, Li Zefan wrote: >>> Considered that vfs_read()/vfs_write on sysfs dir is almost doing nothing, >>> the >>> above problem may only exist in theory. >> >> The r

Re: [PATCH 1/2] sysfs: fix race between readdir and lseek

2013-03-26 Thread Ming Lei
On Tue, Mar 26, 2013 at 10:03 PM, Ming Lei wrote: > > If you mean the test code on link[1], I can't reproduce the > warning with the two sysfs fix patches in 4 hours's test. > > [1], https://patchwork.kernel.org/patch/2160771/ You are right, looks it is not a problem

[PATCH] sysfs: fix use after free in case of concurrent read/write and readdir

2013-04-01 Thread Ming Lei
st code on the link: https://patchwork.kernel.org/patch/2160771/ This patch fixes the use after free under this situation. Cc: Reported-by: Li Zefan Signed-off-by: Ming Lei --- fs/sysfs/dir.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/sys

Re: [PATCH] usbhid: use GFP_NOIO in reset code path

2012-10-10 Thread Ming Lei
ot;fix" should be discussed further, because in theory we can't avoid all GFP_KERNEL allocation in both device reset path and runtime resume path, which may call other kernel component APIs with GFP_KERNEL allocation. So hope to figure out one generic enough solution. Thanks, -- Ming Lei -- To

Re: [PATCH] [firmware_class] Fix compile with no builtin firmware

2012-11-20 Thread Ming Lei
4e7f 100644 > --- a/drivers/base/firmware_class.c > +++ b/drivers/base/firmware_class.c > @@ -38,7 +38,7 @@ MODULE_LICENSE("GPL"); > > /* Builtin firmware support */ > > -#ifdef CONFIG_FW_LOADER > +#ifdef CONFIG_FIRMWARE_IN_KERNEL This might not be correct whe

Re: [PATCH] [firmware_class] Fix compile with no builtin firmware

2012-11-20 Thread Ming Lei
will break this case. > > Perhaps the compile problem is solved in newer kernels (by always > generating an empty builtin firmware list?) but the #ifdef is still > incorrect. Looks the problem hasn't been reported before. Thanks, -- Ming Lei -- To unsubscribe from this list: send t

[PATCH] driver core: fix shutdown races with probe/remove(v1)

2012-06-07 Thread Ming Lei
parent lock if it has to fix the races. Cc: Alan Stern Cc: stable@vger.kernel.org Signed-off-by: Ming Lei --- drivers/base/core.c |8 1 file changed, 8 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 346be8b..cbc8bd2 100644 --- a/drivers/base/core.c

Re: [PATCH] driver core: fix shutdown races with probe/remove(v1)

2012-06-10 Thread Ming Lei
> down to which you prefer: a hang during shutdown, or a crash.  :-) Considered that the device or driver can be logged, either hang or crash will be fixed later by someone, :-) Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of

[PATCH] driver core: fix shutdown races with probe/remove(v2)

2012-06-10 Thread Ming Lei
nd its parent lock(if it has) to fix the races. Cc: Alan Stern Cc: stable@vger.kernel.org Signed-off-by: Ming Lei --- v2: - take Alan's suggestion to use device_trylock to avoid hanging during shutdown by buggy device or driver - hold parent reference counter d

Re: [PATCH] driver core: fix shutdown races with probe/remove(v2)

2012-06-11 Thread Ming Lei
); > > Even if the parent can't be locked, you should still try to lock the > device. I have considered doing it, but which may consume another 1sec. Also if the parent lock has been held, it is very possibly that the device can't be probed or removed at the same time, so just lo

Re: [PATCH] driver core: fix shutdown races with probe/remove(v2)

2012-06-11 Thread Ming Lei
On Tue, Jun 12, 2012 at 12:02 AM, Alan Stern wrote: > On Mon, 11 Jun 2012, Ming Lei wrote: >> >> I have considered doing it, but which may consume another 1sec. >> >> Also if the parent lock has been held, it is very possibly that the >> device can't be probe

[PATCH 1/3] usbnet: clear OPEN flag in failure path

2012-06-12 Thread Ming Lei
Without clearing OPEN flag in failure path, runtime or system resume may submit interrupt/rx URB and start tx queue mistakenly on a interface in DOWN state. Cc: stable@vger.kernel.org Signed-off-by: Ming Lei --- drivers/net/usb/usbnet.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion

[PATCH 2/3] usbnet: decrease suspend count if returning -EBUSY for runtime suspend

2012-06-12 Thread Ming Lei
This patch decreases dev->suspend_count in the -EBUSY failure path of usbnet_suspend. Without the change, the later runtime suspend will do nothing except for increasing dev->suspend_count. Cc: stable@vger.kernel.org Signed-off-by: Ming Lei --- drivers/net/usb/usbnet.c |1 + 1 file c

[PATCH 3/3] usbnet: handle remote wakeup asap

2012-06-12 Thread Ming Lei
patch, usbnet can't recieve any packets from peer in runtime suspend state if runtime PM is enabled and autosuspend_delay is set as zero. Cc: stable@vger.kernel.org Signed-off-by: Ming Lei --- drivers/net/usb/usbnet.c | 42 ++ 1 file change

Re: [PATCH 3/3] usbnet: handle remote wakeup asap

2012-06-14 Thread Ming Lei
On Wed, Jun 13, 2012 at 12:20 PM, Ming Lei wrote: > If usbnet is resumed by remote wakeup, generally there are > some packets comming to be handled, so allocate and submit > rx URBs in usbnet_resume to avoid delays introduced by tasklet. > Otherwise, usbnet may have been runtime susp

Re: [PATCH] driver core: fix shutdown races with probe/remove(v2)

2012-06-17 Thread Ming Lei
On Sat, Jun 16, 2012 at 6:03 AM, Greg Kroah-Hartman wrote: > On Mon, Jun 11, 2012 at 01:13:20PM +0800, Ming Lei wrote: >> Firstly, .shutdown callback may touch a uninitialized hardware >> if dev->driver is set and .probe is not completed. >> >> Secondly, device_shu

Re: [PATCH 3/3] usbnet: handle remote wakeup asap

2012-06-17 Thread Ming Lei
On Mon, Jun 18, 2012 at 7:22 AM, David Miller wrote: > From: Ming Lei > Date: Fri, 15 Jun 2012 10:22:16 +0800 > >> David, sorry, the 'GFP_ATOMIC' above should be 'flags', so could >> you take the fixed version from attachment? Or could you do it by >

Re: [PATCH] driver core: fix shutdown races with probe/remove(v2)

2012-06-18 Thread Ming Lei
can be exploited in reality. > >> >> Signed-off-by: Ming Lei >> >> --- >> >> v2: >> >>       - take Alan's suggestion to use device_trylock to avoid >> >>       hanging during shutdown by buggy device or driver >> >>

Re: [PATCH] driver core: fix shutdown races with probe/remove(v2)

2012-06-20 Thread Ming Lei
On Thu, Jun 21, 2012 at 6:37 AM, Greg Kroah-Hartman wrote: > On Tue, Jun 19, 2012 at 10:00:36AM +0800, Ming Lei wrote: >> so I marked it as -stable because I have explained how the race can be >> exploited in reality. > > Ok, but as this has been there since when, 2

Re: [PATCH] driver core: fix shutdown races with probe/remove(v2)

2012-06-21 Thread Ming Lei
n, do you have objections on the new one? Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] driver core: fix shutdown races with probe/remove(v2)

2012-06-21 Thread Ming Lei
On Fri, Jun 22, 2012 at 12:12 AM, Alan Stern wrote: > On Fri, 22 Jun 2012, Ming Lei wrote: > >> On Thu, Jun 21, 2012 at 9:49 PM, Greg Kroah-Hartman >> wrote: >> >> > We also have not made the rule that a shutdown will complete in a >> > specific amount

[PATCH] USB: fix missed resume for auto-suspend failed interface

2012-09-19 Thread Ming Lei
: stable@vger.kernel.org Signed-off-by: Ming Lei --- drivers/usb/core/driver.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index ddd820d..c228c9c 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core

Re: [PATCH] USB: fix missed resume for auto-suspend failed interface

2012-09-20 Thread Ming Lei
On Thu, Sep 20, 2012 at 3:29 PM, Oliver Neukum wrote: > On Thursday 20 September 2012 13:28:51 Ming Lei wrote: >> If one usb interface driver returns failure from its >> suspend(auto) callback inside usb_suspend_both, its >> resume() callback should be called to recover

[PATCH] driver core: fix possible missing of device probe

2012-09-27 Thread Ming Lei
ist' according to 'VARIETIES OF MEMORY BARRIER' part of Documentation/memory-barriers.txt. Reported-and-Tested-by: Russell King Cc: Signed-off-by: Ming Lei --- drivers/base/bus.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/bus.c b/drivers

Re: [PATCH] driver core: fix possible missing of device probe

2012-09-28 Thread Ming Lei
described in the commit log, and avoid the problem. > the driver model code. All in all, what with the error path issue, and > now the blatently wrong description, I'm not gaining much confidence in > Ming Lei. > > The below is actually what's happening, according to

Re: [PATCH] driver core: fix possible missing of device probe

2012-09-28 Thread Ming Lei
On Fri, Sep 28, 2012 at 11:31 AM, anish singh wrote: > Hello Ming, > Though I am not an expert in this driver core area but > I have been following this fix.So have some queries below: > > On Fri, Sep 28, 2012 at 6:22 AM, Ming Lei wrote: >> Inside bus_add_driver(), one devic

Re: [PATCH] driver core: fix possible missing of device probe

2012-09-28 Thread Ming Lei
tach because driver_attach didn't see the device in the bus. So the 'devb' will be missed to be probed in the bus, won't it? Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] driver core: fix possible missing of device probe

2012-09-28 Thread Ming Lei
On Fri, Sep 28, 2012 at 10:13 PM, Russell King - ARM Linux wrote: > On Fri, Sep 28, 2012 at 10:07:22PM +0800, Ming Lei wrote: >> On Fri, Sep 28, 2012 at 9:55 PM, Russell King - ARM Linux >> wrote: >> >> I do not mention threads case in one CPU because the context in

Re: [PATCH] driver core: fix possible missing of device probe

2012-09-28 Thread Ming Lei
ssell's nice explanation. Sorry, how do you know I didn't look at Russell's explanation? Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] driver core: fix possible missing of device probe

2012-09-28 Thread Ming Lei
On Fri, Sep 28, 2012 at 11:05 PM, Russell King - ARM Linux wrote: > On Fri, Sep 28, 2012 at 10:44:13PM +0800, Ming Lei wrote: >> On Fri, Sep 28, 2012 at 10:31 PM, anish kumar >> wrote: >> >> > Ming, >> > Somehow I feel here that the problem reported by Russ

Re: [PATCH] [firmware_class] Fix compile with no builtin firmware

2012-11-22 Thread Ming Lei
On Wed, Nov 21, 2012 at 10:01 PM, Solomon Peachy wrote: > On Wed, Nov 21, 2012 at 09:35:28AM +0800, Ming Lei wrote: >> Solomon, I can't duplicate the build failure with your .config on >> 3.7-rc5-next. > > Okay, so it's since been fixed. > >> > * Th

Re: [PATCH 06/12] gadgetfs: use-after-free in ->aio_read()

2015-03-08 Thread Ming Lei
_copy_worker); > > @@ -689,6 +697,7 @@ fail: > mutex_unlock(&epdata->lock); > > if (unlikely(value)) { > + kfree(priv->iv); > kfree(priv); > put_ep(epdata); > } else > -- >

[PATCH 2/2] blk-mq: fix CPU hotplug handling

2015-04-19 Thread Ming Lei
ted-by: Dongsu Park Signed-off-by: Ming Lei --- block/blk-mq.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 6804028..9da05b3 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1580,15 +1580,20 @@ stat

[PATCH 1/2] blk-mq: fix race between timeout and CPU hotplug

2015-04-19 Thread Ming Lei
has been disabled, otherwise still use-after-free on tags can be triggered. Cc: Reported-by: Dongsu Park Signed-off-by: Ming Lei --- block/blk-mq.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 67f01a0..6804028 100644 --

[PATCH v1 1/2] blk-mq: fix race between timeout and CPU hotplug

2015-04-20 Thread Ming Lei
has been unmapped, otherwise still use-after-free on tags can be triggered. Cc: Reported-by: Dongsu Park Tested-by: Dongsu Park Signed-off-by: Ming Lei --- block/blk-mq.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c in

[PATCH v1 2/2] blk-mq: fix CPU hotplug handling

2015-04-20 Thread Ming Lei
Tested-by: Dongsu Park Signed-off-by: Ming Lei --- block/blk-mq.c | 34 +- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 1fccb98..76f460e 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1574,22 +1574,6

[PATCH] block: loop: avoiding too many pending per work I/O

2015-04-28 Thread Ming Lei
@vger.kernel.org (v4.0) Reported-by: Justin M. Forbes Tested-by: Justin M. Forbes Signed-off-by: Ming Lei --- drivers/block/loop.c | 19 +-- drivers/block/loop.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index

Re: [PATCH] block: loop: avoiding too many pending per work I/O

2015-04-28 Thread Ming Lei
On Wed, Apr 29, 2015 at 12:36 AM, Jeff Moyer wrote: > Ming Lei writes: > >> If there are too many pending per work I/O, too many >> high priority work thread can be generated so that >> system performance can be effected. >> >> This patch limits the max pen

Re: [PATCH] block: loop: avoiding too many pending per work I/O

2015-04-30 Thread Ming Lei
On Fri, May 1, 2015 at 12:59 AM, Jeff Moyer wrote: > Ming Lei writes: > >> On Wed, Apr 29, 2015 at 12:36 AM, Jeff Moyer wrote: >>> Ming Lei writes: >>> >>>> If there are too many pending per work I/O, too many >>>> high priority work threa

Re: [PATCH 2/2] block: loop: avoiding too many pending per work I/O

2015-05-22 Thread Ming Lei
On Fri, May 22, 2015 at 8:36 PM, Josh Boyer wrote: > On Tue, May 5, 2015 at 7:49 AM, Ming Lei wrote: >> If there are too many pending per work I/O, too many >> high priority work thread can be generated so that >> system performance can be effected. >> >>

Re: [PATCH] driver core : Fix use after free of dev->parent in device_shutdown

2013-09-24 Thread Ming Lei
} > > device_unlock(dev); > - if (dev->parent) > - device_unlock(dev->parent); > + if (parent) > + device_unlock(parent); > > put_device(dev); > - put_de

[PATCH] blk-mq: free hctx->ctxs in queue's release handler

2015-06-04 Thread Ming Lei
toph Hellwig Cc: stable@vger.kernel.org (v4.0) Signed-off-by: Ming Lei --- block/blk-mq.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index e68b71b..594eea0 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1600,6 +1600,7 @@ static int

Re: [PATCH] blk-mq: free hctx->ctxs in queue's release handler

2015-06-04 Thread Ming Lei
On Thu, Jun 4, 2015 at 9:14 PM, Ming Lei wrote: > Now blk_cleanup_queue() can be called before calling > del_gendisk()[1], inside which hctx->ctxs is touched > from blk_mq_unregister_hctx(), but the variable has > been freed by blk_cleanup_queue() at that time. > > So this p

[PATCH v1] blk-mq: free hctx->ctxs in queue's release handler

2015-06-04 Thread Ming Lei
ng the oops reported by Stefan. [1], 6cd18e711dd8075 (block: destroy bdi before blockdev is unregistered) Reported-by: Stefan Seyfried Cc: NeilBrown Cc: Christoph Hellwig Cc: stable@vger.kernel.org (v4.0) Signed-off-by: Ming Lei --- V1: - fix commit log block/blk-mq.c | 8 +

[PATCH 1/2] blk-mq: fix buffer overflow when reading sysfs file of 'pending'

2015-08-09 Thread Ming Lei
U Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011^M [ 359.055682] task: 8802161cc000 ti: 88021b4a8000 task.ti: 88021b4a8000^M [ 359.055693] RIP: 0010:[] [] __kmalloc+0xe8/0x152^M Cc: Signed-off-by: Ming Lei --- block/blk-mq-sysfs.c | 25 ++--- 1 fi

[PATCH 2/2] blk-mq: fix race between timeout and freeing request

2015-08-09 Thread Ming Lei
439.790911] ---[ end trace d40af58949325661 ]---^M Cc: Signed-off-by: Ming Lei --- block/blk-flush.c | 15 ++- block/blk-mq-tag.c | 4 ++-- block/blk-mq-tag.h | 12 block/blk-mq.c | 16 +--- block/blk.h| 6 ++ 5 files changed, 35 insertion

[PATCH] firmware loader: fix use-after-free by double abort

2013-06-15 Thread Ming Lei
blem reported by nirinA raseliarison: http://lkml.org/lkml/2013/6/14/188 Reported-and-tested-by: nirinA raseliarison Cc: Guenter Roeck Cc: Bjorn Helgaas Cc: stable Signed-off-by: Ming Lei --- drivers/base/firmware_class.c | 27 ++- 1 file changed, 18 insertions(+),

Re: [PATCH] firmware loader: fix use-after-free by double abort

2013-06-17 Thread Ming Lei
On Tue, Jun 18, 2013 at 7:59 AM, Greg Kroah-Hartman wrote: > On Sat, Jun 15, 2013 at 04:36:38PM +0800, Ming Lei wrote: >> fw_priv->buf is accessed in both request_firmware_load() and >> writing to sysfs file of 'loading' context, but not protected >> by '

Re: [PATCH] firmware loader: fix use-after-free by double abort

2013-06-17 Thread Ming Lei
On Tue, Jun 18, 2013 at 12:05 PM, Guenter Roeck wrote: >> > I may be missing something, but why would mainline not need it ? > Or do you mean "mainline plus 3.9" ? Yes, mainline need it of course, sorry for not mentioning that explicitly. Thanks, -- Ming Lei -- To unsu

[PATCH] ARM: mm: Ensure get_unmapped_area() returns higher address than mmap_min_addr

2013-11-05 Thread Ming Lei
From: Ming Lei This patch is the arm version of below patch, which is already in -mm tree: http://marc.info/?t=13825144456&r=1&w=2 Without this patch, the below syscall may return failure when '/proc/sys/vm/mmap_min_addr' is set 32768: mmap(0, size, PROT

[PATCH 2/2] scripts/link-vmlinux.sh: only filter kernel symbols for arm

2013-11-13 Thread Ming Lei
ter on ARM when CONFIG_PAGE_OFFSET is defined as the original problem is only on ARM. Cc: Cc: Rusty Russell Singed-off-by: Ming Lei --- scripts/link-vmlinux.sh |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 32b10f

[PATCH 1/2] ARM: default PHYS_OFFSET if !MMU

2013-11-13 Thread Ming Lei
: Jonathan Austin Signed-off-by: Ming Lei --- arch/arm/Kconfig |1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 799ef94..db708c4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1560,6 +1560,7 @@ endchoice config PAGE_OFFSET

Re: FAILED: patch "[PATCH] virtio_blk: fix race between start and stop queue" failed to apply to 3.14-stable tree

2014-06-07 Thread Ming Lei
orted patch for 3.14. Thanks, -- Ming Lei From d1152f1cc1b1784691746bcfc18729ac4b7eb1b8 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Sun, 8 Jun 2014 10:33:34 +0800 Subject: [PATCH] [PATCH] virtio_blk: fix race between start and stop queue When there isn't enough vring descriptor for addin

[PATCH] block: mq flush: fix race between IPI handler and mq flush worker

2014-05-19 Thread Ming Lei
c of mq_flush_run() will never be run - fs sync hangs forever This patch introduces one exclusive work_struct inside request_queue for queuing flush request only to fix the problem. Cc: #3.14 Signed-off-by: Ming Lei --- Another simple fix is to disable ipi for flush request, but lo

Re: [PATCH] block: mq flush: fix race between IPI handler and mq flush worker

2014-05-19 Thread Ming Lei
On Mon, May 19, 2014 at 11:18 PM, Christoph Hellwig wrote: > On Mon, May 19, 2014 at 11:05:50PM +0800, Ming Lei wrote: >> Another simple fix is to disable ipi for flush request, but looks >> this one should be better. > > I think the first thing is to bite the bullet and

Re: [PATCH] block: mq flush: fix race between IPI handler and mq flush worker

2014-05-19 Thread Ming Lei
On Mon, May 19, 2014 at 11:18 PM, Christoph Hellwig wrote: > On Mon, May 19, 2014 at 11:05:50PM +0800, Ming Lei wrote: >> Another simple fix is to disable ipi for flush request, but looks >> this one should be better. > > I think the first thing is to bite the bullet and

Re: [PATCH] block: mq flush: fix race between IPI handler and mq flush worker

2014-05-20 Thread Ming Lei
On Tue, May 20, 2014 at 11:23 PM, Christoph Hellwig wrote: > On Tue, May 20, 2014 at 11:20:25AM +0800, Ming Lei wrote: >> - the conflict on the two structures just happens with flush >> requests because rq->requeue_work is only used to queue >> flush requests > >

Re: [PATCH] block: mq flush: fix race between IPI handler and mq flush worker

2014-05-20 Thread Ming Lei
On Wed, May 21, 2014 at 1:36 PM, Christoph Hellwig wrote: > On Wed, May 21, 2014 at 01:16:14PM +0800, Ming Lei wrote: >> I am wondering if virtio-blk is trivial block driver, :-) > > It's about as simple as it gets. > >> > The scsi-mq work that I plant to sub

Re: [PATCH] block: mq flush: fix race between IPI handler and mq flush worker

2014-05-27 Thread Ming Lei
d it. Looks writing over ext4(especially sync writing) can survive with Christoph's patch now, thanks Christoph. Reported-and-tested-by: Ming Lei Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord..