From patchwork Tue Nov 6 03:33:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 10669537 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84F6D15E9 for ; Tue, 6 Nov 2018 03:34:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74EDB2A134 for ; Tue, 6 Nov 2018 03:34:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 690312A13C; Tue, 6 Nov 2018 03:34:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 634E02A134 for ; Tue, 6 Nov 2018 03:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=V8MjS/9HcNLV1hWP7/gjmd93YppTRkEL/QYE4QHn31A=; b=Ry0 d2+gmwYVMNgsxKBNs5H8rskCv49kbd1EXIu4vfnsu8TU3V0Lo3+o7GxHpqhf521D70vpCBfGaDLYe I/VpD2d0oJzxI3u5iNw4FTgzmIdwuFDw5BRcMgOPwNB4e7CW7bzwHhM1/ptyc5QjA0nlt2ZMsaByr JtgBeBWFdxosBuMRkpOJ04xN2I0EFLUPL/RG1FzUhCSI/f4dNVO4ETdX0HA2kWI81EJ0k+rsYCrkj zevvsbmAvUes2oaAwIs5fs021KcQOo2Ym7VZXRlf0tAmtiyBOWQKMA6PZkJXuLRY47LvlJL7t35AM QyPuBjMHwwrXJSVXbf8ujIdSz5Led0A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJs85-0003rK-P8; Tue, 06 Nov 2018 03:34:13 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJs83-0003qS-0p for linux-arm-kernel@lists.infradead.org; Tue, 06 Nov 2018 03:34:12 +0000 Received: by mail-pl1-x641.google.com with SMTP id s5-v6so5468170plq.11 for ; Mon, 05 Nov 2018 19:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/B9c0Siz2cQq+Qlpwp7SPzLyhwUuiU2x/Fb4412Cyko=; b=WRG6yWX5Z/OUR89dfsuuY11uJL+1J+ZsaI6bwkea2MrBNZeZwDH7T7CXcrob8AltTZ aTl9/kl1CdUUizyXYGp4WpwLRPZYQTHR1sJRrJBQfXw2TUBK9Y2FYt/faourJbLn/don fK2uHt39gPKX+UagJaOqq0DnKkOBRP4ZnHaIUi/pYlAddYU73bqkgGRq/n4HfOegnedu BufAGn3F8HzLACayRyNU+D+8IfAyToMr+XWbk8X4BX2jsQnfmdeRAmQMAxm/a29ALUQk 2fiWSUO+Zqy1lpq1R8uNyw4zsxwRycz/3T/tMu81LEgacb83BdaoSw3Tx/e7m4p1yPL3 YN9Q== 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; bh=/B9c0Siz2cQq+Qlpwp7SPzLyhwUuiU2x/Fb4412Cyko=; b=rZsvOZ4e4W7+W5fJYBPdNzg6DKo/M+qnKJ8JgErZ+ZuqVqDl7+jhVQKi+NEa2em6AK 0VPd7NgTZbkSXf6v5FAa5W4z8lglvzmqeKzdUeU0XInJujBGWXHikNLSTwZEf7pUfBbA kT3cAzfdadxKf+u+l/LPA57AT7k92YaFWOKOn8BsSK0OTT6VhvmWJEZzWqQZLD8m8l0O ecoxdjCUvIWeVfY6LNcq0RuvgHW8lNKUBerC3fMOB4MujGFoVz9AroKYCoqUQOGoHuzE 3f92QzKW9v0f72JKhA86OFO42ZrQpgLqIZ1h0wm24bL5HuDuUnL9nVbZbx84vJVZGXQU rqfw== X-Gm-Message-State: AGRZ1gLXHAtqy6SujkZPY/lyz1TusNX5WpxsT8wMUel43C+HTbAYV+F0 VPRVO4DDkHftU9C4ApJa3DlpFHOz X-Google-Smtp-Source: AJdET5c8NM7ilNUKMZtcj9QYMf9VpwIJxA+CAomEca2+tNR2zo38H+oCG7vQv1JoxwNsSXg21OdCxQ== X-Received: by 2002:a17:902:b789:: with SMTP id e9-v6mr4823856pls.338.1541475236274; Mon, 05 Nov 2018 19:33:56 -0800 (PST) Received: from localhost.localdomain ([2402:f000:1:4414:1815:546f:dfdc:5850]) by smtp.gmail.com with ESMTPSA id i88-v6sm40639651pfi.66.2018.11.05.19.33.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 19:33:55 -0800 (PST) From: Jia-Ju Bai To: linus.walleij@linaro.org, vkoul@kernel.org, dan.j.williams@intel.com Subject: [PATCH] dma: coh901318: Fix a double-lock bug Date: Tue, 6 Nov 2018 11:33:48 +0800 Message-Id: <20181106033348.27361-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181105_193411_063672_D2A3A82D X-CRM114-Status: GOOD ( 11.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dmaengine@vger.kernel.org, Jia-Ju Bai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The function coh901318_alloc_chan_resources() calls spin_lock_irqsave() before calling coh901318_config(). But coh901318_config() calls spin_lock_irqsave() again in its definition, which may cause a double-lock bug. Because coh901318_config() is only called by coh901318_alloc_chan_resources(), the bug fix is to remove the calls to spin-lock and -unlock functions in coh901318_config(). Signed-off-by: Jia-Ju Bai Reviewed-by: Linus Walleij --- drivers/dma/coh901318.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index eebaba3d9e78..fd862a478738 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c @@ -1807,8 +1807,6 @@ static int coh901318_config(struct coh901318_chan *cohc, int channel = cohc->id; void __iomem *virtbase = cohc->base->virtbase; - spin_lock_irqsave(&cohc->lock, flags); - if (param) p = param; else @@ -1828,8 +1826,6 @@ static int coh901318_config(struct coh901318_chan *cohc, coh901318_set_conf(cohc, p->config); coh901318_set_ctrl(cohc, p->ctrl_lli_last); - spin_unlock_irqrestore(&cohc->lock, flags); - return 0; }