From patchwork Tue Aug 28 20:13:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 145361 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1589177ljw; Tue, 28 Aug 2018 13:13:47 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb11lc7mGhw7+GUMvGCz1EazfC90umFkGevVn/cASeB9RVEFcvSrpKgAB0OEc27vZ2CULoM X-Received: by 2002:a62:34c4:: with SMTP id b187-v6mr2944208pfa.15.1535487227308; Tue, 28 Aug 2018 13:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535487227; cv=none; d=google.com; s=arc-20160816; b=zNWQIaMbyILG59sZej7bX8q/ttAbb3K3t4QjihBbo/Ck2LcBNV3bRUvQky0YEpO981 sz647ja8N8IPujZeKTwRNonAGVEuYJwWJviUPaxRrPMfyV3c8Wr6uis6hxgLlNMSeuVU 67+bX9wiK+d23zvO+kPjmIYQLNy+6vNWqMwzwAZbD3BMs7jRKGZGY45z8IQCH87tOy8n ov7pHJ0BID9ynGq4LlPEpyqqtl7iHpRuss+hC4a+nDRChsyNBqV2jEJ7qGCIEDecSHTi QlV+f7Bf7teswf8iHgy7Bm7FOmCmjxTdsf1TE/MbKiubkeYPeJbln/vaf6zNCLUCl42C qd3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=qYcf063hllozIk+Vm2lQwN4IeBSGRsR7ZzxbTQ78qI8=; b=rkJp6dJoyDDjodTz0UedZtmqHZQDRlu8Dg5GtqnQwO8pwLr4bZu1a/b9C2pvyvK767 7SorfFSNK7fqjsoeE+nJtTKRrriA9Omo+4RIq/VEj3W6LDPRW8GfCKrtYqua5ANSEhUX csULS1S7sVs1R1kVvxCeLG25ravVWtkN5rYeCebWOTmRQkBJ4e9Bu9rzcft2gcsnjEr0 thdczcR873oEcOotlW7vJxDv5frp1/8kx0yjcPYMin8ctQ45g94yCZEGrKSBzuKndoZJ UzzV5TJvVGcvSRY0b0AWku0yRdj7/dpU7mynKsdndEsYzHS6fkAX/7w/dQbscElF+R9I xwRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CoqLLGf4; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10-v6si1906969pgf.312.2018.08.28.13.13.47; Tue, 28 Aug 2018 13:13:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CoqLLGf4; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727117AbeH2AHA (ORCPT + 13 others); Tue, 28 Aug 2018 20:07:00 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37238 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726961AbeH2AHA (ORCPT ); Tue, 28 Aug 2018 20:07:00 -0400 Received: by mail-pg1-f194.google.com with SMTP id 2-v6so717256pgo.4 for ; Tue, 28 Aug 2018 13:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qYcf063hllozIk+Vm2lQwN4IeBSGRsR7ZzxbTQ78qI8=; b=CoqLLGf4dUyq+m6cSA8vBJS6VFkhspOmBcbqIFv3eYACETEqV8ByMw+Ca+/iCHF7lH z8lpDc9UsldOv6iKWtGDdzLC5x6g5lbzW4PmkyPvD4qkjtOYqfID4E0lwALl6lXY1Eq8 wRHOWXu0IlHPkW18QhkMVGx8CclDpet97fwKc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qYcf063hllozIk+Vm2lQwN4IeBSGRsR7ZzxbTQ78qI8=; b=FoDHryfQVXylsRtpum0U0s+ocuocSUAJoOylK/pm2OCF1Ca6AZ/vZq9GzEhSQPMW5G QL6Hk0MkzhF+Yl/psQSBr7i1UNk0/67AWALtoNyrGECllO2BwvgzcyT+b1RbVFH6fCS5 c6LxBNBnB8/EyHbP7G0/OWJmp8WVrMC6MKEB0tTpbLUzeAstI/+YkhPLw47FoFkcbc8N DmRjGjpvco6UYtc/sdjsqW6w1sGAJ7Sk30F0chGX/DmF3u9Gf+0GudSip7Mb+CWfYdqy dcJ+32GF4EIh6RKRR+CwUvsuYJv8ZUrKXdfpta0BaAZggHimwQNYVK4NHbjgoH6m/AnE LMsg== X-Gm-Message-State: APzg51Anni2Am0CWkRZNuBBxv8BA2i9S/rEsl/AFKLD5/GSyNwUtxNbD 6kaoHC44fMa4nm+mwle8S+5bRA== X-Received: by 2002:a62:cc41:: with SMTP id a62-v6mr2948242pfg.131.1535487225629; Tue, 28 Aug 2018 13:13:45 -0700 (PDT) Received: from localhost.localdomain ([49.207.48.21]) by smtp.gmail.com with ESMTPSA id t86-v6sm3098181pfe.109.2018.08.28.13.13.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Aug 2018 13:13:44 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Jia-Ju Bai 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 Message-Id: <1535487205-26280-6-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535487205-26280-1-git-send-email-amit.pundir@linaro.org> References: <1535487205-26280-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jia-Ju Bai 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Amit Pundir --- 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(-) -- 2.7.4 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, ®); if (reg & (XD_ECC1_ERROR | XD_ECC2_ERROR)) { - wait_timeout(100); + mdelay(100); if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) {