From patchwork Sun Sep 16 23:45:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10601931 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 DA8B2157B for ; Sun, 16 Sep 2018 23:46:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8AEE29340 for ; Sun, 16 Sep 2018 23:46:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAF572934C; Sun, 16 Sep 2018 23:46:44 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26A9C29340 for ; Sun, 16 Sep 2018 23:46:44 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A34212676AA; Mon, 17 Sep 2018 01:46:12 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4C10B2676AA; Mon, 17 Sep 2018 01:46:04 +0200 (CEST) Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) by alsa0.perex.cz (Postfix) with ESMTP id 1C3982677FC for ; Mon, 17 Sep 2018 01:46:02 +0200 (CEST) Received: by mail-it0-f65.google.com with SMTP id 139-v6so8813102itf.0 for ; Sun, 16 Sep 2018 16:46:02 -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=1bcJh9CtfJ4gAb6t6vtjisbCR0PKBNS05ea9K+ric0w=; b=Ev+CCGgnvLIEXmiRTpQCrXBwU5Sr96o05fDv55zIg+z7zwz0OheesH3dewlX9N9eHB 6yZ876AB+oazr67VkYjG3rjV1lY8h/3RN+cfPcvaTuHkiSIpY344ClDhkeIAbxnn6YuD 5CSKr/1swr9ywRZjGSkZxa2UyiQkN3m5rEjA8= 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=1bcJh9CtfJ4gAb6t6vtjisbCR0PKBNS05ea9K+ric0w=; b=EvlpYGQKvhMArrmicmGU8dbK37GX3T2snUlp8AynXeTJ/ZpDWkPzNrYzarSUIfXW0I Rl9oCLQQghkxDMJhhRHzMbh2CWP67WZbGOE1y76Ig6pT73mlJuGTZvZdQAL/SfNaohoK liRiSSJyQacKTo1IKIaO9xwbGHTalcP/xiZWy9FDOMJXcqjn+9ZHrMa6bBbpAWxuO3ky c2YDJBx46LGlusmPYnnf/jNUZgEIjnH9uSVvJKAujUxd58C7y/amXwSc+SyJ5obIaA8B 7XMwwDkAossIMNK68ohPRLpxJah8TzVQUUfQkwPyvrLUo10MhuE3dzoI6Jag3Tj4sCX4 UnVA== X-Gm-Message-State: APzg51DIHuMwBznMONHfZsNVm8eo9w5yU7xD+MaPq3YxAPSz4HW+1TdD htnqUXBDYJtreEK3gZKofbVl9w== X-Google-Smtp-Source: ANB0VdZwJHiLbZJbBZtX/QkrLfVNuaoAO+VWs87iuhwajGLr9YqptxAZFqUbn0bSnsg5cVTWd0ss3w== X-Received: by 2002:a24:aa08:: with SMTP id b8-v6mr10725014itf.49.1537141561414; Sun, 16 Sep 2018 16:46:01 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id a11-v6sm4495177ioc.63.2018.09.16.16.46.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Sep 2018 16:46:01 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Date: Sun, 16 Sep 2018 16:45:43 -0700 Message-Id: <20180916234546.29661-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180916234546.29661-1-srinivas.kandagatla@linaro.org> References: <20180916234546.29661-1-srinivas.kandagatla@linaro.org> Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, broonie@kernel.org, Srinivas Kandagatla Subject: [alsa-devel] [PATCH 4/7] slimbus: ngd: validate logical address assigned by remote X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Srinivas Kandagatla Validate logical address assigned by remote, in failure cases this value is all zeors. Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/qcom-ngd-ctrl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index 8be4d67..b9f2e3f 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1004,6 +1004,7 @@ static int qcom_slim_ngd_get_laddr(struct slim_controller *ctrl, struct slim_eaddr *ea, u8 *laddr) { struct slim_val_inf msg = {0}; + u8 failed_ea[6] = {0, 0, 0, 0, 0, 0}; struct slim_msg_txn txn; u8 wbuf[10] = {0}; u8 rbuf[10] = {0}; @@ -1034,6 +1035,9 @@ static int qcom_slim_ngd_get_laddr(struct slim_controller *ctrl, return ret; } + if (!memcmp(rbuf, failed_ea, 6)) + return -ENXIO; + *laddr = rbuf[6]; return ret;