Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Jia-Ju Bai
On 2018/5/7 22:15, Eric Dumazet wrote: On 05/07/2018 07:08 AM, Jia-Ju Bai wrote: The write operations to "dev->stats" are protected by the spinlock on line 862-864, but the read operations to this data on line 858 and 867 are not protected by the spinlock. Thus, there may exi

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Jia-Ju Bai
On 2018/5/8 9:56, Eric Dumazet wrote: On 05/07/2018 05:51 PM, Jia-Ju Bai wrote: On 2018/5/7 22:15, Eric Dumazet wrote: On 05/07/2018 07:08 AM, Jia-Ju Bai wrote: The write operations to "dev->stats" are protected by the spinlock on line 862-864, but the read operations to this

[PATCH] acpi: scan: Fix a possible data race in acpi_scan_hotplug_enabled

2018-05-07 Thread Jia-Ju Bai
quot;hotplug->enabled" is also protected by the lock. Signed-off-by: Jia-Ju Bai --- drivers/acpi/scan.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 970dd87d347c..e21d7b0f7179 100644 --- a/drivers/acpi/scan.c +++ b/d

[PATCH] watchdog: mena21_wdt: Fix a possible data race in a21_wdt_set_timeout

2018-05-07 Thread Jia-Ju Bai
timeout" should be also protected by the lock. Signed-off-by: Jia-Ju Bai --- drivers/watchdog/mena21_wdt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/mena21_wdt.c b/drivers/watchdog/mena21_wdt.c index 25d5d2b8cfbe..05ca69042829 100644 --- a/driv

Re: [PATCH] watchdog: mena21_wdt: Fix a possible data race in a21_wdt_set_timeout

2018-05-07 Thread Jia-Ju Bai
On 2018/5/8 11:28, Guenter Roeck wrote: On 05/07/2018 08:18 PM, Jia-Ju Bai wrote: The write operation to "wdt->timeout" is protected by the lock on line 118, but the read operation to this data on line 105 is not protected by the lock. Thus, there may exist a data race for

[PATCH] xen: xenbus: Fix a possible data race in xs_request_enter

2018-05-07 Thread Jia-Ju Bai
; should be also protected by the lock. Signed-off-by: Jia-Ju Bai --- drivers/xen/xenbus/xenbus_xs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index 49a3874ae6bb..274cdfee08b1 100644 --- a/drivers/x

[PATCH] ata: ata_piix: Fix a possible data race in piix_pci_device_resume

2018-05-07 Thread Jia-Ju Bai
t;flags" should be also protected by the lock. Signed-off-by: Jia-Ju Bai --- drivers/ata/ata_piix.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 7ecb1322a514..c99fdf473dee 100644 --- a/drivers/ata/ata_piix.c

Re: [PATCH] watchdog: mena21_wdt: Fix a possible data race in a21_wdt_set_timeout

2018-05-07 Thread Jia-Ju Bai
On 2018/5/8 11:42, Guenter Roeck wrote: On 05/07/2018 08:32 PM, Jia-Ju Bai wrote: On 2018/5/8 11:28, Guenter Roeck wrote: On 05/07/2018 08:18 PM, Jia-Ju Bai wrote: The write operation to "wdt->timeout" is protected by the lock on line 118, but the read operation to this dat

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-08 Thread Jia-Ju Bai
On 2018/5/8 13:04, Eric Dumazet wrote: On 05/07/2018 07:16 PM, Jia-Ju Bai wrote: Yes, ">stats" will not change, because it is a fixed address. But the field data in "dev->stats" is changed (rx_frame_errors, rx_crc_errors and rx_missed_errors). So if the driver ret

Re: [PATCH] xen: xenbus: Fix a possible data race in xs_request_enter

2018-05-08 Thread Jia-Ju Bai
On 2018/5/8 15:02, Juergen Gross wrote: On 08/05/18 05:34, Jia-Ju Bai wrote: The read operation to "req->type" is protected by the lock on line 128, but the write operation to this data on line 118 is not protected by the lock. Thus, there may exist a data race for "r

[PATCH] watchdog: mena21_wdt: Drop unnecessary mutex lock

2018-05-08 Thread Jia-Ju Bai
There is already a mutex in the watchdog core which serializes calls to the various API functions. So the mutex lock "drv->lock" is unnecessary and can be dropped. Signed-off-by: Jia-Ju Bai --- drivers/watchdog/mena21_wdt.c | 18 -- 1 file changed, 18 deletions(-

[PATCH] usb: storage: Fix a possible data race in uas_queuecommand_lck

2018-05-08 Thread Jia-Ju Bai
uot;cmnd->scsi_done". To fix this data race, the write operations on line 634-635 should be also protected by the lock. Signed-off-by: Jia-Ju Bai --- drivers/usb/storage/uas.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/storage/uas.c b/drivers/usb/s

[PATCH] net: wireless: ath: ath9k: Fix a possible data race in ath_chanctx_set_next

2018-05-08 Thread Jia-Ju Bai
;sc->next_chan" should be also protected by the lock. Signed-off-by: Jia-Ju Bai --- drivers/net/wireless/ath/ath9k/channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c index 1b05b5d7a038

[PATCH] ata: libata-pmp: Fix a possible data race in sata_pmp_handle_link_fail

2018-05-08 Thread Jia-Ju Bai
t;flags" should be also protected by the lock. Signed-off-by: Jia-Ju Bai --- drivers/ata/libata-pmp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index 85aa76116a30..42f61106ac70 100644 --- a/drivers/ata/liba

Re: [usb-storage] [PATCH] usb: storage: Fix a possible data race in uas_queuecommand_lck

2018-05-08 Thread Jia-Ju Bai
On 2018/5/8 16:27, Oliver Neukum wrote: Am Dienstag, den 08.05.2018, 15:47 +0800 schrieb Jia-Ju Bai: The write operations to "cmnd->result" and "cmnd->scsi_done" are protected by the lock on line 642-643, but the write operations to these data on line 634-635 are

[PATCH] android: binder: Fix a possible data race in binder_alloc_mmap_handler

2018-05-08 Thread Jia-Ju Bai
;alloc->buffer" should be also protected by the lock. Signed-off-by: Jia-Ju Bai --- drivers/android/binder_alloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 5a426c877dfb..596acc3a84e4 100644 --- a/drive

Re: [PATCH] acpi: scan: Fix a possible data race in acpi_scan_hotplug_enabled

2018-05-08 Thread Jia-Ju Bai
On 2018/5/9 4:17, Rafael J. Wysocki wrote: On Tue, May 8, 2018 at 5:08 AM, Jia-Ju Bai wrote: The write operation to "hotplug->enabled" is protected by the lock on line 1760, but the read operation to this data on line 1755 is not protected by the lock. Thus, there may exis

[BUG] fs/super: a possible sleep-in-atomic bug in put_super

2017-10-06 Thread Jia-Ju Bai
t; may sleep This bug is found by my static analysis tool and my code review. Thanks, Jia-Ju Bai

[PATCH] ext2/super: Fix a possible sleep-in-atomic bug in parse_options

2017-10-06 Thread Jia-Ju Bai
ode review. Signed-off-by: Jia-Ju Bai --- lib/parser.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parser.c b/lib/parser.c index 3278958..bc6e2ce 100644 --- a/lib/parser.c +++ b/lib/parser.c @@ -133,7 +133,7 @@ static int match_number(substring_t *s, int *result,

[BUG] fs/aio: A possible sleep-in-atomic bug in aio_migratepage

2017-10-06 Thread Jia-Ju Bai
code review. A possible fix is to remove cond_resched in __copy_gigantic_page. Thanks, Jia-Ju Bai

Re: [PATCH] ext2/super: Fix a possible sleep-in-atomic bug in parse_options

2017-10-06 Thread Jia-Ju Bai
Thanks for your reply. I agree that extra allocation in match_number() and match_u64int() may be unnecessary. Thanks, Jia-Ju Bai On 2017/10/7 9:37, Linus Torvalds wrote: On Fri, Oct 6, 2017 at 6:20 PM, Jia-Ju Bai wrote: To fix it, GFP_KERNEL is replaced with GFP_ATOMIC. This bug is found

[BUG] fs/dlm: A possible sleep-in-atomic bug in dlm_master_lookup

2017-10-06 Thread Jia-Ju Bai
my static analysis tool and my code review. Thanks, Jia-Ju Bai

[PATCH] fs/afs/flock and fs/locks: Fix possible sleep-in-atomic bugs in posix_lock_file

2017-10-07 Thread Jia-Ju Bai
ile posix_lock_inode (fs/locks.c) locks_get_lock_context kmem_cache_alloc(GFP_KERNEL) --> may sleep To fix them, GFP_KERNEL is replaced with GFP_ATOMIC. These bugs are found by my static analysis tool and my code review. Signed-off-by: Jia-Ju Bai --- fs/locks.c |2 +-

[BUG] fs/afs/flock: possible sleep-in-atomic bugs in afs_do_setlk

2017-10-07 Thread Jia-Ju Bai
; again after them. These bugs are found by my static analysis tool and my code review. Thanks, Jia-Ju Bai

A question of "cond_resched_lock" called in atomic context

2017-10-07 Thread Jia-Ju Bai
uot; and "__cond_resched_lock". I know that "__cond_resched_lock" is safe and okay to be called when holding a spinlock. However, I think "___might_sleep" can be removed, because it prints error messages in this situation, but it is safe in fact. Am I right? I am looking forward to your comments :) Thanks, Jia-Ju Bai

[PATCH] staging/rtl8188eu: Fix a possible sleep-in-atomic bug in rtw_disassoc_cmd

2017-10-07 Thread Jia-Ju Bai
off-by: Jia-Ju Bai --- drivers/staging/rtl8188eu/core/rtw_cmd.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 9461bce..65083a7 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cm

[PATCH v2 3/3] rtl8188eu: Fix a possible sleep-in-atomic bug in _rtw_pwr_wakeup

2017-10-08 Thread Jia-Ju Bai
off-by: Jia-Ju Bai --- drivers/staging/rtl8188eu/core/rtw_pwrctrl.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c index f86c9ce..2913661 100644 --- a/drivers/staging/rtl8188eu/c

[PATCH v2 2/3] rtl8188eu: Fix a possible sleep-in-atomic bug in rtw_createbss_cmd

2017-10-08 Thread Jia-Ju Bai
iew. Signed-off-by: Jia-Ju Bai --- drivers/staging/rtl8188eu/core/rtw_cmd.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 9461bce..430b8eb 100644 --- a/drivers/staging/rtl8188eu/c

[PATCH v2 1/3] rtl8188eu: Fix a possible sleep-in-atomic bug in rtw_disassoc_cmd

2017-10-08 Thread Jia-Ju Bai
off-by: Jia-Ju Bai --- drivers/staging/rtl8188eu/core/rtw_cmd.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 9461bce..65083a7 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cm

[BUG] rtl8188eu: Some possible sleep-in-atomic bugs in ips_leave

2017-10-08 Thread Jia-Ju Bai
CC to mailing list. On 2017/10/8 20:13, Jia-Ju Bai wrote: The driver may sleep under a spinlock when calling the function "ips_leave", which causes some possible sleep-in-atomic bugs. Here are several examples: rtw_set_802_11_disassociate (acquire the spinlock) _rtw_pwr_wakeup

[BUG] gma500: Possible sleep-in-atomic bugs in gma_resume_pci

2017-10-08 Thread Jia-Ju Bai
rs/pci/pci.c. These bugs are found by my static analysis tool and my code review. Thanks, Jia-Ju Bai

[PATCH] arcmsr: Fix possible sleep-in-atomic bugs in arcmsr_queue_command

2017-10-08 Thread Jia-Ju Bai
p_parking arcmsr_stop_adapter_bgrb arcmsr_hbaD_stop_bgrb arcmsr_hbaD_wait_msgint_ready msleep --> may sleep To fix them, msleep is replaced with mdelay. These bugs are found by my static analysis tool and my code review. Signed-off-by: Jia-Ju Bai --- drivers/scsi/arcmsr/

[PATCH] wcn36xx: Remove unnecessary rcu_read_unlock in wcn36xx_bss_info_changed

2017-10-08 Thread Jia-Ju Bai
No rcu_read_lock is called, but rcu_read_unlock is still called. Thus rcu_read_unlock should be removed. Signed-off-by: Jia-Ju Bai --- drivers/net/wireless/ath/wcn36xx/main.c |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless

[BUG] haswell: A possible sleep-in-atomic bug in hsw_irq_thread

2017-10-08 Thread Jia-Ju Bai
Jia-Ju Bai

[BUG] stmmac: A possible sleep-in-atomic bug in stmmac_suspend

2017-10-08 Thread Jia-Ju Bai
y code review. Thanks, Jia-Ju Bai

[BUG] vt6655: A possible sleep-in-atomic bug in vt6655_suspend

2017-10-08 Thread Jia-Ju Bai
lay in __pci_start_power_transition in drivers/pci/pci.c. This bug is found by my static analysis tool and my code review. Thanks, Jia-Ju Bai

[BUG] ssb: Possible sleep-in-atomic bugs in ssb_pcmcia_read8

2017-10-08 Thread Jia-Ju Bai
ock --> may sleep A possible fix is to use spinlock instead of mutex lock in pcmcia_access_config in drivers/pcmcia/pcmcia_resource.c. These bugs are found by my static analysis tool and my code review. Thanks, Jia-Ju Bai

[PATCH] sound/pci/riptide or drivers/base/firmware: Fix a possible sleep-in-atomic bug

2017-10-08 Thread Jia-Ju Bai
) _request_firmware_prepare kzalloc(GFP_KERNEL) --> may sleep To fix it, GFP_KERNEL is replaced with GFP_ATOMIC in _request_firmware_prepare. This bug is found by my static analysis tool and my code review. Signed-off-by: Jia-Ju Bai --- drivers/base/firmware_class.c |

[PATCH] opl3: Fix a possible sleep-in-atomic bug in snd_opl3_find_patch

2017-10-08 Thread Jia-Ju Bai
off-by: Jia-Ju Bai --- sound/drivers/opl3/opl3_synth.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c index ddcc1a3..2e1cb2b 100644 --- a/sound/drivers/opl3/opl3_synth.c +++ b/sound/drivers/opl3/opl3_synt

[BUG] sound/core/seq: A possible sleep-in-atomic bug in snd_virmidi_dev_receive_event

2017-10-08 Thread Jia-Ju Bai
According to seq_virmidi.c, the driver may sleep under a read spinlock. The function call path is: snd_virmidi_dev_receive_event (acquire the spinlock) snd_seq_dump_var_event copy_from_user --> may sleep This bug is found by my static analysis tool and my code review. Thanks, Jia-Ju Bai

[PATCH] fs/cachefiles: Fix a possible sleep-in-atomic bug in cachefiles_printk_object

2017-10-08 Thread Jia-Ju Bai
ode review. Signed-off-by: Jia-Ju Bai --- fs/cachefiles/namei.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 3978b32..39e1504 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c @@ -83,7 +83,7 @@ static noinl

[PATCH] scsi/fnic: Fix a sleep-in-atomic bug in fnic_handle_event

2017-10-02 Thread Jia-Ju Bai
ter this function. This bug is found by my static analysis tool and my code review. Signed-off-by: Jia-Ju Bai --- drivers/scsi/fnic/fnic_fcs.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c index 999fc75..4c99c96 100644 --- a/driv

[BUG] fs/dcache: might_sleep is called under a spinlock

2017-10-02 Thread Jia-Ju Bai
According to fs/dcache.c, might_sleep is called under a spinlock, and the function call path is: d_prune_aliases (acquire the spinlock) dput might_sleep This bug is found by my static analysis tool and my code review. A possible fix is to remove might_sleep in dput. Thanks, Jia-Ju Bai

[BUG] scsi/fcoe: Sleep-in-atomic bugs in fcoe driver

2017-10-02 Thread Jia-Ju Bai
logoff mutex_lock --> may sleep These bugs are found by my static analysis tool and my code review. Thanks, Jia-Ju Bai

[BUG] scsi/libfc: Sleep-in-atomic bugs in libfc

2017-10-02 Thread Jia-Ju Bai
rports fc_rport_logoff mutex_lock --> may sleep These bugs are found by my static analysis tool and my code review. Thanks, Jia-Ju Bai

Re: [BUG] fs/dcache: might_sleep is called under a spinlock

2017-10-03 Thread Jia-Ju Bai
Thanks for your detailed explanation :) I will improve my static analysis tool. Thanks, Jia-Ju Bai On 2017/10/3 11:19, Al Viro wrote: On Tue, Oct 03, 2017 at 10:38:25AM +0800, Jia-Ju Bai wrote: According to fs/dcache.c, might_sleep is called under a spinlock, and the function call path

[PATCH] block/drbd: Fix a sleep-in-atomic bug in drbd_bcast_event

2017-10-03 Thread Jia-Ju Bai
my static analysis tool and my code review. Signed-off-by: Jia-Ju Bai --- drivers/block/drbd/drbd_nl.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index a12f77e..713c965 100644 --- a/drivers/block/drbd/drbd_nl.c ++

[PATCH] block/drbd: Fix a sleep-in-atomic bug in notify_helper

2017-10-03 Thread Jia-Ju Bai
tic analysis tool and my code review. Signed-off-by: Jia-Ju Bai --- drivers/block/drbd/drbd_nl.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index a12f77e..ad093da 100644 --- a/drivers/block/drbd/drbd_nl.c ++

[BUG] drbd/block: A sleep-in-atomic bug in notify_helper

2017-10-03 Thread Jia-Ju Bai
my static analysis tool and my code review. Thanks, Jia-Ju Bai

[PATCH v2] b43: Replace mdelay with usleep_range in b43_radio_2057_init_post

2018-01-08 Thread Jia-Ju Bai
b43_radio_2057_init_post is not called in an interrupt handler nor holding a spinlock. The function mdelay in it can be replaced with usleep_range, to reduce busy wait. Signed-off-by: Jia-Ju Bai --- v2: * Replace mdelay with usleep_range, instead of msleep in v1. Thank Larry for good advice

Re: b43: Replace mdelay with msleep in b43_radio_2057_init_post

2018-01-08 Thread Jia-Ju Bai
On 2018/1/9 0:31, Larry Finger wrote: On 01/08/2018 10:21 AM, Kalle Valo wrote: Jia-Ju Bai wrote: b43_radio_2057_init_post is not called in an interrupt handler nor holding a spinlock. The function mdelay in it can be replaced with msleep, to reduce busy wait. Signed-off-by: Jia-Ju Bai

Re: [PATCH v2] b43: Replace mdelay with usleep_range in b43_radio_2057_init_post

2018-01-09 Thread Jia-Ju Bai
On 2018/1/9 16:35, Greg KH wrote: On Tue, Jan 09, 2018 at 09:40:06AM +0800, Jia-Ju Bai wrote: b43_radio_2057_init_post is not called in an interrupt handler nor holding a spinlock. The function mdelay in it can be replaced with usleep_range, to reduce busy wait. Signed-off-by: Jia-Ju Bai

Re: [PATCH v2] b43: Replace mdelay with usleep_range in b43_radio_2057_init_post

2018-01-09 Thread Jia-Ju Bai
On 2018/1/9 17:07, Arend van Spriel wrote: On 1/9/2018 9:39 AM, Jia-Ju Bai wrote: On 2018/1/9 16:35, Greg KH wrote: On Tue, Jan 09, 2018 at 09:40:06AM +0800, Jia-Ju Bai wrote: b43_radio_2057_init_post is not called in an interrupt handler nor holding a spinlock. The function mdelay

Re: [PATCH V2] hyper-v: use GFP_KERNEL for hv_context.hv_numa_map

2017-12-19 Thread Jia-Ju Bai
On 2017/12/19 1:05, Stephen Hemminger wrote: On Mon, 18 Dec 2017 17:02:52 +0800 Jia-Ju Bai wrote: The kzalloc function is called with GFP_ATOMIC. But according to driver call graph, it is not in atomic context, namely no spinlock is held nor in an interrupt handler. This GFP_ATOMIC

[PATCH V3 1/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_reset

2017-12-19 Thread Jia-Ju Bai
iew. Signed-off-by: Jia-Ju Bai --- drivers/media/platform/sti/bdisp/bdisp-hw.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c b/drivers/media/platform/sti/bdisp/bdisp-hw.c index b7892f3..b63d9c9 100

Re: [PATCH V2 1/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_reset

2017-12-19 Thread Jia-Ju Bai
On 2017/12/19 18:43, Fabien DESSENNE wrote: Hi, On 16/12/17 12:54, Jia-Ju Bai wrote: The driver may sleep under a spinlock. The function call path is: bdisp_device_run (acquire the spinlock) bdisp_hw_reset msleep --> may sleep To fix it, readl_poll_timeout_atomic is u

Re: [PATCH 1/2] hp100: Fix a possible sleep-in-atomic bug in hp100_login_to_vg_hub

2017-12-13 Thread Jia-Ju Bai
Sorry, I made a mistake in last e-mail. Maybe "mdelay(1000/HZ)" or "udelay(100/HZ)" . Which one do you think is right? Thanks, Jia-Ju Bai On 2017/12/14 11:13, Jia-Ju Bai wrote: Thanks for reply :) I think I should use "udelay(10/HZ)" instead, do you thin

Re: [PATCH 1/2] hp100: Fix a possible sleep-in-atomic bug in hp100_login_to_vg_hub

2017-12-13 Thread Jia-Ju Bai
Sorry, I think I know your meaning now. Maybe we can unlock the spinlock before "schedule_timeout_interruptible" and then lock again? Like: spin_unlock(...); schedule_timeout_interruptible(1); spin_lock(...); Best wishes, Jia-Ju Bai On 2017/12/14 11:34, David Mi

[PATCH] sky2: Replace mdelay with msleep in sky2_vpd_wait

2017-12-23 Thread Jia-Ju Bai
sky2_vpd_wait is not called in an interrupt handler nor holding a spinlock. The function mdelay in it can be replaced with msleep, to reduce busy wait. Signed-off-by: Jia-Ju Bai --- drivers/net/ethernet/marvell/sky2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH] b43: Replace mdelay with msleep in b43_radio_2057_init_post

2017-12-23 Thread Jia-Ju Bai
b43_radio_2057_init_post is not called in an interrupt handler nor holding a spinlock. The function mdelay in it can be replaced with msleep, to reduce busy wait. Signed-off-by: Jia-Ju Bai --- drivers/net/wireless/broadcom/b43/phy_n.c |2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH] staging: rtl8192u: Replace mdelay with msleep in rtl8192_usb_probe

2017-12-24 Thread Jia-Ju Bai
rtl8192_usb_probe is not called in an interrupt handler nor holding a spinlock. The function mdelay in it can be replaced with msleep, to avoid busy wait. Signed-off-by: Jia-Ju Bai --- drivers/staging/rtl8192u/r8192U_core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH] scsi: imm: Replace mdelay with msleep in imm_init

2017-12-24 Thread Jia-Ju Bai
imm_init is not called in an interrupt handler nor holding a spinlock. The function mdelay in it can be replaced with msleep, to reduce busy wait. Signed-off-by: Jia-Ju Bai --- drivers/scsi/imm.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/imm.c b

[PATCH] i40iw: Replace mdelay with msleep in i40iw_wait_pe_ready

2017-12-24 Thread Jia-Ju Bai
i40iw_wait_pe_ready is not called in an interrupt handler nor holding a spinlock. The function mdelay in it can be replaced with msleep, to reduce busy wait. Signed-off-by: Jia-Ju Bai --- drivers/infiniband/hw/i40iw/i40iw_main.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH V2 1/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_reset

2017-12-16 Thread Jia-Ju Bai
iew. Signed-off-by: Jia-Ju Bai --- drivers/media/platform/sti/bdisp/bdisp-hw.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c b/drivers/media/platform/sti/bdisp/bdisp-hw.c index b7892f3..e94a371 100644 --- a/driv

Re: [PATCH 1/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_reset

2017-12-16 Thread Jia-Ju Bai
Hi, On 2017/12/15 22:51, Fabien DESSENNE wrote: Hi On 12/12/17 14:47, Jia-Ju Bai wrote: The driver may sleep under a spinlock. The function call path is: bdisp_device_run (acquire the spinlock) bdisp_hw_reset msleep --> may sleep To fix it, msleep is replaced with mdelay. Ma

[PATCH] hv: Fix unnecessary sleeping in hv_synic_alloc

2017-12-18 Thread Jia-Ju Bai
The kzalloc function is called with GFP_ATOMIC. But according to driver call graph, it is not in atomic context, namely no spinlock is held nor in an interrupt handler. This GFP_ATOMIC is unnecessary, and replace with GFP_KERNEL. Signed-off-by: Jia-Ju Bai --- drivers/hv/hv.c |2 +- 1 file

Re: [PATCH] hv: Fix unnecessary sleeping in hv_synic_alloc

2017-12-18 Thread Jia-Ju Bai
On 2017/12/18 16:54, Vitaly Kuznetsov wrote: Jia-Ju Bai writes: The kzalloc function is called with GFP_ATOMIC. But according to driver call graph, it is not in atomic context, namely no spinlock is held nor in an interrupt handler. This GFP_ATOMIC is unnecessary, and replace

[PATCH V2] hyper-v: use GFP_KERNEL for hv_context.hv_numa_map

2017-12-18 Thread Jia-Ju Bai
The kzalloc function is called with GFP_ATOMIC. But according to driver call graph, it is not in atomic context, namely no spinlock is held nor in an interrupt handler. This GFP_ATOMIC is unnecessary, and replace with GFP_KERNEL. Signed-off-by: Jia-Ju Bai --- drivers/hv/hv.c |2 +- 1 file

[PATCH] staging: vt6655: Use GFP_KERNEL in kzalloc

2017-12-18 Thread Jia-Ju Bai
Four kzalloc functions are called with GFP_ATOMIC. But according to driver call graph, they are not in atomic context, namely no spinlock is held nor in an interrupt handler. All these "GFP_ATOMIC"s are unnecessary, and replace with with "GFP_KERNEL"s. Signed-off-by: Jia-

A question of sleeping with interrupts are disabled in start_kernel()

2018-04-06 Thread Jia-Ju Bai
o disable the interrupt; perf_pmu_register() calls mutex_lock() and idr_alloc(GFP_KERNEL), and they can sleep; pmu_dev_alloc() calls kzalloc(GFP_KERNEL), and it can sleep. In my opinion, this code may sleep with interrupts are disabled. I wonder why this code is okay? Best wishes, Jia-Ju Bai

Re: [PATCH v2] dec: tulip: de4x5: Replace mdelay with usleep_range in de4x5_hw_init

2018-04-11 Thread Jia-Ju Bai
On 2018/4/12 0:16, James Bottomley wrote: On Wed, 2018-04-11 at 23:39 +0800, Jia-Ju Bai wrote: de4x5_hw_init() is never called in atomic context. de4x5_hw_init() is only called by de4x5_pci_probe(), which is only set as ".probe" in struct pci_driver. Despite never getting called f

Re: [PATCH 1/3] mmc: wbsd: Replace mdelay with usleep_range in wbsd_init

2018-04-11 Thread Jia-Ju Bai
On 2018/4/11 23:04, Ulf Hansson wrote: On 11 April 2018 at 04:46, Jia-Ju Bai wrote: wbsd_init() is never called in atomic context. The call chains ending up at wbsd_init() are: [1] wbsd_init() <- wbsd_probe() [2] wbsd_init() <- wbsd_pnp_probe() wbsd_probe() is set as ".probe

[PATCH v2] net: dsa: b53: Using sleep-able operations in b53_switch_reset_gpio

2018-04-11 Thread Jia-Ju Bai
sis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- v2: * Use gpio_set_value_cansleep() to replace gpio_set_value() additionally. Thanks for Florian and Phil for good advice. --- drivers/net/dsa/b53/b53_common.c | 8 1 file changed,

Re: [PATCH] net: dsa: b53: Replace mdelay with msleep in b53_switch_reset_gpio

2018-04-11 Thread Jia-Ju Bai
On 2018/4/12 0:19, Florian Fainelli wrote: On 04/11/2018 12:14 AM, Jia-Ju Bai wrote: On 2018/4/11 13:30, Phil Reid wrote: On 11/04/2018 09:51, Jia-Ju Bai wrote: b53_switch_reset_gpio() is never called in atomic context. The call chain ending up at b53_switch_reset_gpio() is: [1

Re: [PATCH v2] dec: tulip: de4x5: Replace mdelay with usleep_range in de4x5_hw_init

2018-04-11 Thread Jia-Ju Bai
On 2018/4/12 10:21, arvindY wrote: On Thursday 12 April 2018 07:00 AM, Jia-Ju Bai wrote: On 2018/4/12 0:16, James Bottomley wrote: On Wed, 2018-04-11 at 23:39 +0800, Jia-Ju Bai wrote: de4x5_hw_init() is never called in atomic context. de4x5_hw_init() is only called by de4x5_pci_probe

Re: [PATCH] sound: soc: intel: bxt_da7219_max98357a: Replace GFP_ATOMIC with GFP_KERNEL in broxton_audio_probe

2018-04-13 Thread Jia-Ju Bai
On 2018/4/13 18:41, Mark Brown wrote: On Mon, Apr 09, 2018 at 06:46:21PM +0800, Jia-Ju Bai wrote: broxton_audio_probe() is never called in atomic context. This function is only set as ".probe" in "struct platform_driver". Please submit patches using subject lines

[PATCH 1/2] sound: ad1889: Replace mdelay with usleep_range in snd_ad1889_init

2018-04-09 Thread Jia-Ju Bai
. Despite never getting called from atomic context, snd_ad1889_init() calls mdelay for busy wait. This is not necessary and can be replaced with usleep_range to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- sound/pci/ad

[PATCH 2/2] sound: ad1889: Replace mdelay with usleep_range in snd_ad1889_ac97_ready

2018-04-09 Thread Jia-Ju Bai
S written by myself. Signed-off-by: Jia-Ju Bai --- sound/pci/ad1889.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 0bf2c04..a2a8e1d 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -258,7 +258,7 @

[PATCH] net: dccp: Replace GFP_ATOMIC with GFP_KERNEL in dccp_init

2018-04-09 Thread Jia-Ju Bai
with GFP_KERNEL, to avoid busy waiting and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- net/dccp/proto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH] net: decnet: Replace GFP_ATOMIC with GFP_KERNEL in dn_route_init

2018-04-09 Thread Jia-Ju Bai
off-by: Jia-Ju Bai --- net/decnet/dn_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 0bd3afd..59ed12a 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c @@ -1898,7 +1898,7 @@ void __init dn_route_init(v

[PATCH] net: nsci: Replace GFP_ATOMIC with GFP_KERNEL in ncsi_register_dev

2018-04-09 Thread Jia-Ju Bai
And I also manually check it. Signed-off-by: Jia-Ju Bai --- net/ncsi/ncsi-manage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c index 3fd3c39..6b5b5a0 100644 --- a/net/ncsi/ncsi-manage.c +++ b/net/ncsi/ncsi-manage.c @@ -1508

[PATCH] net: tipc: Replace GFP_ATOMIC with GFP_KERNEL in tipc_mon_create

2018-04-09 Thread Jia-Ju Bai
s tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- net/tipc/monitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c index 9e109bb..9714d80 100644 --- a/net/tipc/monitor.c +++ b/ne

[PATCH] fs: quota: Replace GFP_ATOMIC with GFP_KERNEL in dquot_init

2018-04-09 Thread Jia-Ju Bai
with GFP_KERNEL, to avoid busy waiting and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- fs/quota/dquot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH] fs: dls: lowcomms: Replace GFP_ATOMIC with GFP_KERNEL in receive_from_sock

2018-04-09 Thread Jia-Ju Bai
ity of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- fs/dlm/lowcomms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 4813d0e..2d4e

Re: [PATCH] net: dccp: Replace GFP_ATOMIC with GFP_KERNEL in dccp_init

2018-04-09 Thread Jia-Ju Bai
On 2018/4/9 22:42, Eric Dumazet wrote: On 04/09/2018 07:10 AM, Jia-Ju Bai wrote: dccp_init() is never called in atomic context. This function is only set as a parameter of module_init(). Despite never getting called from atomic context, dccp_init() calls __get_free_pages() with GFP_ATOMIC

Re: [PATCH] net: decnet: Replace GFP_ATOMIC with GFP_KERNEL in dn_route_init

2018-04-09 Thread Jia-Ju Bai
On 2018/4/9 22:44, Eric Dumazet wrote: On 04/09/2018 07:10 AM, Jia-Ju Bai wrote: dn_route_init() is never called in atomic context. The call chain ending up at dn_route_init() is: [1] dn_route_init() <- decnet_init() decnet_init() is only set as a parameter of module_init(). Despite ne

[PATCH 1/4] xen: xen-pciback: Replace GFP_ATOMIC with GFP_KERNEL in pcistub_probe

2018-04-09 Thread Jia-Ju Bai
e replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/xen/xen-pciback/pci_stub.c | 2 +- 1 file changed, 1 inser

[PATCH 2/4] xen: xen-pciback: Replace GFP_ATOMIC with GFP_KERNEL in pcistub_init_device

2018-04-09 Thread Jia-Ju Bai
allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/xen/xen-pcibac

[PATCH 4/4] xen: xen-pciback: Replace GFP_ATOMIC with GFP_KERNEL in xen_pcibk_config_quirks_init

2018-04-09 Thread Jia-Ju Bai
ossibility of sucessful allocation. Signed-off-by: Jia-Ju Bai --- drivers/xen/xen-pciback/conf_space_quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/xen-pciback/conf_space_quirks.c b/drivers/xen/xen-pciback/conf_space_quirks.c index 7476791..e3df3f9 10

[PATCH 3/4] xen: xen-pciback: Replace GFP_ATOMIC with GFP_KERNEL in pcistub_device_alloc

2018-04-09 Thread Jia-Ju Bai
ontext. Despite never getting called from atomic context, pcistub_device_alloc() calls kzalloc() with GFP_ATOMIC, which does not sleep for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. Signed-of

[PATCH] video: fbdev: savage: Replace mdelay with usleep_range in savage_init_hw

2018-04-09 Thread Jia-Ju Bai
c analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/video/fbdev/savage/savagefb_driver.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/savage/savagefb_driver.c b/drivers/video/fbde

[PATCH v2] net: decnet: Replace GFP_ATOMIC with GFP_KERNEL in dn_route_init

2018-04-09 Thread Jia-Ju Bai
Jia-Ju Bai --- v2: * Modify the description of GFP_ATOMIC in v1. Thank Eric for good advice. --- net/decnet/dn_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 0bd3afd..59ed12a 100644 --- a/net/decnet/dn_route.c +++ b/

[PATCH v2] net: dccp: Replace GFP_ATOMIC with GFP_KERNEL in dccp_init

2018-04-09 Thread Jia-Ju Bai
with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- v2: * Modify the description of GFP_ATOMIC in v1. Thank Eric for good advice

[PATCH v2] net: nsci: Replace GFP_ATOMIC with GFP_KERNEL in ncsi_register_dev

2018-04-09 Thread Jia-Ju Bai
also manually check it. Signed-off-by: Jia-Ju Bai --- v2: * Modify the description of GFP_ATOMIC in v1. Thank Eric for good advice. --- net/ncsi/ncsi-manage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c index 3fd3c39..6b5b

[PATCH v2] net: tipc: Replace GFP_ATOMIC with GFP_KERNEL in tipc_mon_create

2018-04-09 Thread Jia-Ju Bai
s tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- v2: * Modify the description of GFP_ATOMIC in v1. Thank Eric for good advice. --- net/tipc/monitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/tipc/monitor.c b/ne

[PATCH v2] net: tipc: Replace GFP_ATOMIC with GFP_KERNEL in tipc_mon_create

2018-04-09 Thread Jia-Ju Bai
s tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- v2: * Modify the description of GFP_ATOMIC in v1. Thank Eric for good advice. --- net/tipc/monitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/tipc/monitor.c b/ne

[PATCH v2] net: decnet: Replace GFP_ATOMIC with GFP_KERNEL in dn_route_init

2018-04-09 Thread Jia-Ju Bai
Jia-Ju Bai --- v2: * Modify the description of GFP_ATOMIC in v1. Thank Eric for good advice. --- net/decnet/dn_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 0bd3afd..59ed12a 100644 --- a/net/decnet/dn_route.c +++ b/

[PATCH] usb: storage: Replace mdelay with msleep in init_freecom

2018-04-09 Thread Jia-Ju Bai
msleep() to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/usb/storage/freecom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/storage/freecom.

[PATCH] video: fbdev: aty: aty128fb: Replace mdelay with msleep in aty128_set_suspend

2018-04-09 Thread Jia-Ju Bai
context, aty128_set_suspend() calls mdelay() to busily wait. This is not necessary and can be replaced with msleep() to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/video/fbdev/aty/a

[PATCH] video: fbdev: aty: radeon_pm: Replace mdelay with msleep in radeonfb_pci_suspend

2018-04-09 Thread Jia-Ju Bai
usily wait. This is not necessary and can be replaced with msleep() and usleep_range() to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/video/fbdev/aty/radeon_pm.c | 8 1 file changed, 4

<    1   2   3   4   5   6   7   8   9   10   >