From patchwork Tue Jul 25 19:29:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108672 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939410qge; Tue, 25 Jul 2017 12:29:44 -0700 (PDT) X-Received: by 10.98.87.195 with SMTP id i64mr19999032pfj.175.1501010984867; Tue, 25 Jul 2017 12:29:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501010984; cv=none; d=google.com; s=arc-20160816; b=fbF50N/5nntzVPAATYd52x1lIbpQPk3Cpwm7zktWB7Xv+DjpvCszD9F04dHnodsxxS T5eP1nl1YOA1O7H7RdeXPfIoRyghoz6ZcrSdUtD4RxRbVFauYnc1jam3EGW6bnKk3mut pCcIUHYX2VpHsyak6/rTjVAAHosATTRUZFkKAUgX5glFtnEqq54RGmsbqUTa8rOhNscx PS4fJcGmm2tF0FcqM+epDwySBPC/kwZ/qk8eX/cuQOZA9ixJNr1pmC7H0/V/fDxl4Ack tHTSgGLUKpxKprfEeqmMC8rvjKEtJ6TAirtmNnR9KCSkRqtXVfIEo9z6Vjqk+9gabpuz i0/A== 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=/QkfGwx1qN+bH6UcWAZ8ICsmNcw0HgeMWJLpOBUNdDM=; b=b7xUjU/Ml+KUNVkNm5BjjkNFqFy+p0Uynfb5ZEcp5MTZpGYPNtG0Rw+ntNuqUwrDNS xkECjSQ5lwIYORSEsTdEH2XfXEGtQ2/OCs+WUSM4qwR5qA28q893rjUvVbpDBtvTCDpZ 1/vuPdhQYizutlPBVuLew00r70V9I1ycfKWtBSFRTU3Eun0OF2zF2zqwioTqA46iweS5 IbOzpDDtkVhiBxGng+7DWr1O+jMIQmvIQsWO0tjwpxH9gtVifHGgXcMSsGxBmmWHtsEf VEyb77tMDhWmWuyQ4dEIVH3Bt8CyB2NpMrpTHcDzDtDX6KZAbmcOyhDTUVCbIKfSSKtv 2q8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Y1hJrsVX; 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 o129si8605553pga.543.2017.07.25.12.29.44; Tue, 25 Jul 2017 12:29:44 -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=Y1hJrsVX; 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 S1754444AbdGYT3m (ORCPT + 6 others); Tue, 25 Jul 2017 15:29:42 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:33614 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754362AbdGYT3l (ORCPT ); Tue, 25 Jul 2017 15:29:41 -0400 Received: by mail-pg0-f45.google.com with SMTP id g14so25234640pgu.0 for ; Tue, 25 Jul 2017 12:29:41 -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=/QkfGwx1qN+bH6UcWAZ8ICsmNcw0HgeMWJLpOBUNdDM=; b=Y1hJrsVX36R6GD8rrUnoLr9RyGK/DfqWl8nBWaV68bqaf4P9XFBG/RA7QYWGYWzPhI xVm+7lyZFp7FIaWE82tGr9NBtxtlSqjAnTUWi+Erf5K9Kyk5Lqm1bEZJlZft8/lOoBs7 AURV/sTf4ohLsngxc3AT2Z+IkOAKInDm/EjXY= 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=/QkfGwx1qN+bH6UcWAZ8ICsmNcw0HgeMWJLpOBUNdDM=; b=W1WrINr72EZwzEtX8A4EYrNlzM+7ukuv/Rkcy1OpAWo8uU8+kh3EUc1C9suscmy7tY NaPgG9sKrjWaJykWQs+HaP7A3TODQFxodhTvatGTUl5FKE3zx5nKR/YC77mPYt2n0/le w+9aNAkhxqOFhLOkcqXo+/ucNsShdM/t3M4NBbvT+aTxy7tiJBiChEslrKuckKo97p5D mNspt6xI4O/L81RBNDPVW+Xxv3h2OZ2va3gRb2r4crDRmoeAvxfY+IG14OTEh1fFbMF6 ExJfMLgf7Ejorok1GuNScLejGtBiTDVSf+m7QJxAL2kTkhQ0DRae9P2A/R9wf16xSuO+ 4lTw== X-Gm-Message-State: AIVw113FsvaBX0L4gJNVURhinheK6C+FO+NFORf7J0yNinI02b1zHA3h 3gor0qgsok8QfUWk X-Received: by 10.99.124.86 with SMTP id l22mr20022724pgn.344.1501010981009; Tue, 25 Jul 2017 12:29:41 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:40 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Sudeep Holla , Jassi Brar Subject: [PATCH for-4.9 07/10] mailbox: always wait in mbox_send_message for blocking Tx mode Date: Wed, 26 Jul 2017 00:59:13 +0530 Message-Id: <1501010956-27944-8-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-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 c61b781ee084e69855477d23dd33e7e6caad652c upstream. There exists a race when msg_submit return immediately as there was an active request being processed which may have completed just before it's checked again in mbox_send_message. This will result in return to the caller without waiting in mbox_send_message even when it's blocking Tx. This patch fixes the issue by waiting for the completion always if Tx is in blocking mode. Fixes: 2b6d83e2b8b7 ("mailbox: Introduce framework for mailbox") Reported-by: Alexey Klimov Signed-off-by: Sudeep Holla Reviewed-by: Alexey Klimov Signed-off-by: Jassi Brar Signed-off-by: Amit Pundir --- drivers/mailbox/mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 4a36632c236f..e9e6d6672967 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -261,7 +261,7 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg) msg_submit(chan); - if (chan->cl->tx_block && chan->active_req) { + if (chan->cl->tx_block) { unsigned long wait; int ret;