From patchwork Tue Jul 25 20:45:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108708 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp29141qge; Tue, 25 Jul 2017 13:46:14 -0700 (PDT) X-Received: by 10.84.210.135 with SMTP id a7mr17621607pli.471.1501015574386; Tue, 25 Jul 2017 13:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501015574; cv=none; d=google.com; s=arc-20160816; b=M45ms0R/m75E35vqAhtao7hdAkkg29F8ea7lHzU8aJ0xYT6tZy89Wi2Cjcy3If7qIm R1LaHRqC34zTBwP8iQJZAusWzWaliK5WPpO/mPrF1EPvlr1kdC7wDUojgMMd3qhGKC0v vtdhkayOl7bkueGxhlhbD9YpT2/C21WZydTsBcXDpnQ/hOAzNnPBYgrarKsPtUZ4bm/t IdQZyME5VcuDcCVMFm6Qk7bn8T1/v8VgjCkmLux1QsFHzstcmHRtq0FiBoAG14sRNiNC OuceYS8gHrWnpQfkhzyA9mfv9jNpO2X3K6O0bW8IBPIcztm5DiKPpWN5cAEegBLZ6YlB MWCQ== 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=Ibqc7TIps6wZO4dTkb/soO1vJ8uKvnbrSQaGCzfVM3E=; b=HxBz7u5lAIznS2PmP39b6fBmdnSvwhiZzIB3+kPPFNXvKManqguOZ9o6k6fuMHoRZ1 E7i4QeaALkVddvjsZelDqcbkrgXbFo++M42daFYqCKYauhCVRVMRKiRd4h1ppZqtL9Rp xoutGq7VihKlwrOVfy87bcIL5LRU10KHAUe+BmvuWgs2YrZRp315ETfXYiSTjndWvQ3r ltR9lDgTYgqJCXjMAq6ZqRsNHWWU7q3jwsnvI8M+htTWNjhhvdTjsqrq3Ts/b44YTOiN qsB5kZl1vs5+EKyADagKCNEzYXqXwah4LG82Mn+DkonAdKCSgedMPepNTq4jxpvHpzlD q0qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=J6/3dsta; 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 k3si387020pgk.256.2017.07.25.13.46.14; Tue, 25 Jul 2017 13:46:14 -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.b=J6/3dsta; 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 S1752033AbdGYUqM (ORCPT + 6 others); Tue, 25 Jul 2017 16:46:12 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:33684 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752469AbdGYUqK (ORCPT ); Tue, 25 Jul 2017 16:46:10 -0400 Received: by mail-pg0-f54.google.com with SMTP id g14so25957121pgu.0 for ; Tue, 25 Jul 2017 13:46:10 -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=Ibqc7TIps6wZO4dTkb/soO1vJ8uKvnbrSQaGCzfVM3E=; b=J6/3dsta67wDvNUvWr0fLCIp+xuB0nz3Pfpncdhqw4g9IRLK1Rp1mK4DjdL7siEQcC PmKp9HOr/0GxNvNWiF6Or6AmDkcluvhs0Kq+eyJPTGvWkhQYGq2oggYvE180nOEVbNwB FdP/ib+Kekl9O8fpWaNRHAiwz2N1Nfw8GIXP0= 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=Ibqc7TIps6wZO4dTkb/soO1vJ8uKvnbrSQaGCzfVM3E=; b=ffFIbZAnyclnd9A53CP9L4bMzSCg537EFiGNyNY89G0yNaNUe57TZ1Y5fjACV3UafB GoCSUHmsoRYFBTdgY4J510+NLiqp87DOCLLvJPiYG8Mx0tiAB8M1nCiJepY5hWy6XSzu HbDMKyScT92rdVXNpqhSLlimAL/mJT49/g6kIZDMIqxZF5Oar1uNeMNVdkBGVJ9qaQwK L67vGOMWpbPBSPQWnIjMLiQGi4vdrbVQ/DHSxyFRtCufVqCN92AVKi5lVk3n4AsuPgnk ppKtljEnd7+MHEGx3fDCoi2c4JNPiSJhY/AWLdS3ufcMsElg4WfnyAEzKihq8mzp1+Qg df4g== X-Gm-Message-State: AIVw113/8G1oApU+6VkYJzfaBDtu+DYoL8U9/0wZ3tvEO3df6ZUpNH1B 0hdUaUHcvzAOUuy0vRxgWA== X-Received: by 10.84.236.77 with SMTP id h13mr22542517pln.183.1501015570254; Tue, 25 Jul 2017 13:46:10 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id d4sm532125pfj.59.2017.07.25.13.46.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 13:46:09 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Sudeep Holla , Jassi Brar Subject: [PATCH for-3.18 13/15] mailbox: skip complete wait event if timer expired Date: Wed, 26 Jul 2017 02:15:24 +0530 Message-Id: <1501015526-32178-14-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501015526-32178-1-git-send-email-amit.pundir@linaro.org> References: <1501015526-32178-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: Sudeep Holla commit cc6eeaa3029a6dbcb4ad41b1f92876483bd88965 upstream. If a wait_for_completion_timeout() call returns due to a timeout, complete() can get called after returning from the wait which is incorrect and can cause subsequent transmissions on a channel to fail. Since the wait_for_completion_timeout() sees the completion variable is non-zero caused by the erroneous/spurious complete() call, and it immediately returns without waiting for the time as expected by the client. This patch fixes the issue by skipping complete() call for the timer expiry. Fixes: 2b6d83e2b8b7 ("mailbox: Introduce framework for mailbox") Reported-by: Alexey Klimov Signed-off-by: Sudeep Holla Signed-off-by: Jassi Brar Signed-off-by: Amit Pundir --- drivers/mailbox/mailbox.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 2691cb75b2e8..cbde6fccbc29 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -103,7 +103,7 @@ static void tx_tick(struct mbox_chan *chan, int r) if (mssg && chan->cl->tx_done) chan->cl->tx_done(chan->cl, mssg, r); - if (chan->cl->tx_block) + if (r != -ETIME && chan->cl->tx_block) complete(&chan->tx_complete); } @@ -266,8 +266,8 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg) ret = wait_for_completion_timeout(&chan->tx_complete, wait); if (ret == 0) { - t = -EIO; - tx_tick(chan, -EIO); + t = -ETIME; + tx_tick(chan, t); } }