All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Pundir <amit.pundir@linaro.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Stable <stable@vger.kernel.org>, Jia-Ju Bai <baijiaju1990@163.com>
Subject: [PATCH for-4.9.y 05/14] staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page
Date: Wed, 29 Aug 2018 01:43:16 +0530	[thread overview]
Message-ID: <1535487205-26280-6-git-send-email-amit.pundir@linaro.org> (raw)
In-Reply-To: <1535487205-26280-1-git-send-email-amit.pundir@linaro.org>

From: Jia-Ju Bai <baijiaju1990@163.com>

commit 498c4b4e9c23855d17ecc2a108d949bb68020481 upstream.

The driver may sleep under a spin lock, and the function call path is:
rtsx_exclusive_enter_ss (acquire the lock by spin_lock)
  rtsx_enter_ss
    rtsx_power_off_card
      xd_cleanup_work
        xd_delay_write
          xd_finish_write
            xd_copy_page
              wait_timeout
                schedule_timeout --> may sleep

To fix it, "wait_timeout" is replaced with mdelay in xd_copy_page.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
---
To be applied on 4.4.y and 3.18.y as well.
Build tested on v4.4.153 and v3.18.120.

 drivers/staging/rts5208/xd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
index 1de02bb98839..647f6beb4c65 100644
--- a/drivers/staging/rts5208/xd.c
+++ b/drivers/staging/rts5208/xd.c
@@ -1247,7 +1247,7 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk,
 			reg = 0;
 			rtsx_read_register(chip, XD_CTL, &reg);
 			if (reg & (XD_ECC1_ERROR | XD_ECC2_ERROR)) {
-				wait_timeout(100);
+				mdelay(100);
 
 				if (detect_card_cd(chip,
 					XD_CARD) != STATUS_SUCCESS) {
-- 
2.7.4

  parent reply	other threads:[~2018-08-29  0:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 20:13 [PATCH for-4.9.y 00/14] Few upstream fixes from OnePlus6's kernel tree Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 01/14] cfq: Give a chance for arming slice idle timer in case of group_idle Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 02/14] kthread: Fix use-after-free if kthread fork fails Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 03/14] kthread: fix boot hang (regression) on MIPS/OpenRISC Amit Pundir
2018-08-28 20:13   ` [OpenRISC] " Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 04/14] random: convert get_random_int/long into get_random_u32/u64 Amit Pundir
2018-09-16 13:29   ` Greg KH
2018-08-28 20:13 ` Amit Pundir [this message]
2018-08-28 20:13 ` [PATCH for-4.9.y 06/14] staging/rts5208: Fix read overflow in memcpy Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 07/14] IB/rxe: do not copy extra stack memory to skb Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 08/14] block,blkcg: use __GFP_NOWARN for best-effort allocations in blkcg Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 09/14] nl80211: fix null-ptr dereference on invalid mesh configuration Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 10/14] locking/rwsem-xadd: Fix missed wakeup due to reordering of load Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 11/14] selinux: use GFP_NOWAIT in the AVC kmem_caches Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 12/14] locking/osq_lock: Fix osq_lock queue corruption Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 13/14] mm, vmscan: clear PGDAT_WRITEBACK when zone is balanced Amit Pundir
2018-08-28 20:13 ` [PATCH for-4.9.y 14/14] mm: remove seemingly spurious reclaimability check from laptop_mode gating Amit Pundir
2018-09-16 13:36 ` [PATCH for-4.9.y 00/14] Few upstream fixes from OnePlus6's kernel tree Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1535487205-26280-6-git-send-email-amit.pundir@linaro.org \
    --to=amit.pundir@linaro.org \
    --cc=baijiaju1990@163.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.