lkml.org 
[lkml]   [2017]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[BUG] fs/afs/flock: possible sleep-in-atomic bugs in afs_do_setlk
Date
According to fs/afs/flock.c, the kernel may sleep under a spinlock,
and the function call paths are:
afs_do_setlk (acquire the spinlock: inode->i_lock)
afs_vnode_fetch_status
schedule --> may sleep

afs_do_setlk (acquire the spinlock: inode->i_lock)
wait_event_interruptible --> may sleep

These bugs may be introduced by only considering "vnode->lock" but
ignoring "inode->i_lock".

A possible fix is to unlock "inode->i_lock" before calling
afs_vnode_fetch_status and wait_event_interruptible, and lock
"inode->i_lock" again after them.

These bugs are found by my static analysis tool and my code review.


Thanks,
Jia-Ju Bai

\
 
 \ /
  Last update: 2017-10-07 12:11    [W:1.102 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site