Skip to content

Commit

Permalink
mtd/chips: add missing set_current_state() to cfi_{amdstd,staa}_sync()
Browse files Browse the repository at this point in the history
cfi_amdstd_sync() and cfi_staa_sync() call schedule() without changing task's
state appropriately.

In case of e.g.  chip->state == FL_ERASING, cfi_*_sync() will be busy-looping
either redundantly for a fixed interval of time (for SCHED_NORMAL tasks) or
possibly endlessly (for RT tasks and UP).

Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Dmitry Adamushko authored and Linus Torvalds committed Apr 9, 2008
1 parent b9ad898 commit f8e30e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/mtd/chips/cfi_cmdset_0002.c
Original file line number Diff line number Diff line change
Expand Up @@ -1763,6 +1763,7 @@ static void cfi_amdstd_sync (struct mtd_info *mtd)

default:
/* Not an idle state */
set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&chip->wq, &wait);

spin_unlock(chip->mutex);
Expand Down
1 change: 1 addition & 0 deletions drivers/mtd/chips/cfi_cmdset_0020.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,7 @@ static void cfi_staa_sync (struct mtd_info *mtd)

default:
/* Not an idle state */
set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&chip->wq, &wait);

spin_unlock_bh(chip->mutex);
Expand Down

0 comments on commit f8e30e4

Please sign in to comment.