From patchwork Tue Jul 25 20:07:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108692 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp14414obm; Tue, 25 Jul 2017 13:07:59 -0700 (PDT) X-Received: by 10.84.128.69 with SMTP id 63mr22325068pla.54.1501013279675; Tue, 25 Jul 2017 13:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501013279; cv=none; d=google.com; s=arc-20160816; b=MI/UVOQXYZ0+uovidDG8e1BZzI0Z7eRNyYW2BcF2+AKJPtr/k0lsqx1NcvjxVVtVjE yxCEEqs+HftkOttUFfglxAaMoT8SnG07hogHAzIA5tIJ0qghlWBr4bSaCADfSjZsRJaw 0ZAs1porhHJUJBpak8M5hPyzQEMMhNN/xmh7QG/t4ZWL6kz5MaPTeahdmSWTujk7aTX9 nm6wnQwEgtGKQiSM37hbh8zO37dxtFKhZ3co4IIPyo9Shw4kbgGt3qLkq+c1SmWZCoVA J9AY+ImfG1IRellTCDw3m52dQmSYkSJVLjukNqr75AT66jlK8nxlKNXfWOm9MHXo2HN3 Gf8Q== 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=z+889JwfWEtSNgag+wts0USZXiaoFFZBZ0c4iPco9tc=; b=Ql9kqlHMmyhq0spSNNtW8JF2nVDUWDLTLMyjokB+sxMoU33+sATa6OCTfK6HIyi2cb d8jmcMl6J16FQ9OWaWROGfnPPQR094ANkxj9tKgKZZ++798TFHd8f1da697ExbH9bfPA Ms5JRhFeOQqiMALfqrjKQOgq5781aL4ZsbPJkea9wUFPW0E6QC0rEACEHOcV/PLIFgHi E5EjlLxUkqLl5nwrZpo4Srb1g/ei8OAzMuMboMvjYIvwAJsdMmADIol9pIBB05BW+nLj lke2G+XsB77O4yb/qCZKiHc/GMxnlGhYobXSGzWULccXJ+TCw7ylNwTi85xGa5GhRVam UefQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=SZLQAJBn; 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 h10si8970990plk.237.2017.07.25.13.07.59; Tue, 25 Jul 2017 13:07:59 -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=SZLQAJBn; 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 S1752116AbdGYUH6 (ORCPT + 6 others); Tue, 25 Jul 2017 16:07:58 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:33169 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751528AbdGYUH4 (ORCPT ); Tue, 25 Jul 2017 16:07:56 -0400 Received: by mail-pf0-f178.google.com with SMTP id s70so62313098pfs.0 for ; Tue, 25 Jul 2017 13:07:56 -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=z+889JwfWEtSNgag+wts0USZXiaoFFZBZ0c4iPco9tc=; b=SZLQAJBny0KwEloWa2xTxtHsVA904kMGNGqWZaXmGLljttLPR6Sldvq8/JNfvpehvY MA5dY8M4PN9bjsUH7EV0/opg6gbvWjIfdsKdWwmAtBCPzDV1/jYnflhj/KtSjme7cnEk Hg1UzZ8IjJgIGLqMEtM+o8Xg/zRJy7WxAxKRg= 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=z+889JwfWEtSNgag+wts0USZXiaoFFZBZ0c4iPco9tc=; b=hrQMTviaRycnyT5MI8P2F0ZTrKf03FhvmKdixyk/LHhDbFL8FgFmT3LThYfUi3mk/M zcCM59+hBilw8MSQ3gg7g1PMLiN33jn3vSL1GISGN263FfOsUjZwK85jq5t+xa4K/w0k qSpdtEp1lok7an8bxOJnjmf7XDXrkF7MsYu5nxuLRgckK1pKbvj4l4NZ4+srfISXLOP2 Cq7uRQBEMrpKVPJiE6c0sSZOiUyH86AQeBf4MxT0aM8aO55Ww1j5KQC2ehTFmurx+tlP GPyJ+4vr7A4tg3dO7cuppy9vFPaHGwnbNlkv7OvwxDDpcpb+XNbWHo+6pZ8cuUFTM1AX t+xg== X-Gm-Message-State: AIVw112F0Ky1SW4+ZclRFiwiLPgw1kZqSNNfv4dX8g7kqTeyEjCCJN/9 41YKSW176yySQd75 X-Received: by 10.99.3.140 with SMTP id 134mr2587884pgd.159.1501013276144; Tue, 25 Jul 2017 13:07:56 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id c76sm27684356pfj.91.2017.07.25.13.07.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 13:07:55 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Sudeep Holla , Jassi Brar Subject: [PATCH for-4.4 10/13] mailbox: always wait in mbox_send_message for blocking Tx mode Date: Wed, 26 Jul 2017 01:37:18 +0530 Message-Id: <1501013241-31961-11-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501013241-31961-1-git-send-email-amit.pundir@linaro.org> References: <1501013241-31961-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 6a4811f85705..6e03717318b0 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;