Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4101237ybi; Mon, 29 Jul 2019 19:16:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFITfwJp4vIMwKl3Vxe7B/ycYlqhNL22dqrkdiv/If5UdDLT7mUyDopphzwP3ofm5cvnZy X-Received: by 2002:a63:c03:: with SMTP id b3mr43267634pgl.23.1564452986083; Mon, 29 Jul 2019 19:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564452986; cv=none; d=google.com; s=arc-20160816; b=uxNi8zj8mdSoVJdgrstvl7dhd/BPTW0I8TN9G7pyePertBxe8XSlG3Pik6mU+Vmzrw UPvk9wRBidpqTrFlUADCvSowE5opplbZROnyM1u3RlU588k1ZDDz2KNz/CZ/C7ZBD1dx +T8DT41OTX/AYRxQAnRt7VibbYQNMG3lwrTXEBXTqHMvsheAjNFaCD/66Y+XHopo4SDe TlO65033zUHxlAERs6Uxzas3zROB+Vu4s0ppeDpxjsPVXHLFMW09s1090yKei+CFn/Vb DdSW9CAD7Rk/OIuKaKQ+ZNabNKh+r0lVJhIFqTvOIGdavaErhcZsFWirjUXDQjb6T0SU VAyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=usNadKWv65KvT8nYnCkIFsqsG5agEE2PGoa7sKPz6H4=; b=iyQHVVLv6mypnOl4K2LZIkrqofxMfcPsPteiyf0FvCpZ8bvPOMHzospYcNF2FhBQi8 G9YuJO8SCDSO1C9xl0RV897Wt2zjRBMcWh/0Yy64ZcqGVSkbp8/1ahP3yXCPXfCbkpzH hO6yc3S4Lktpdao9uIZjHwYtZkv0l3Nxtv+CkbYNtFHb0OenivFmiFCRhNrJ9L6wiPut CICKVnxbB9wDvZi9JH6lb+YZffDUdAesXmK/iMH/TmFJC/OdHG+RAmX1wuSw1dTGvXPn K7idLueQl57wSsn+u9IPfC1XYfe4gL6lwZO3HEhWs0auOMEhKFsY9LRsWbvdiRqKe9Ym K2ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GQxifqed; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg3si24489990plb.83.2019.07.29.19.16.08; Mon, 29 Jul 2019 19:16:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@kernel.org header.s=default header.b=GQxifqed; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388965AbfG2TjO (ORCPT + 99 others); Mon, 29 Jul 2019 15:39:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:54254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388956AbfG2TjM (ORCPT ); Mon, 29 Jul 2019 15:39:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 070CB2054F; Mon, 29 Jul 2019 19:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429151; bh=18PvMK3IzPiBGJaA0mcdhTC0A3bQpt3XEH68L8UAk+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GQxifqedc8bJ5MZ0RA5ACtoiJv2zMaKAC6ICFXA76LeXSpj5m6rFhFpoMD6IlIv/p flwJNAerCqWHFrceFNJaGLd+LmmBnVILNyLS4bzUSzj5Xp9GQs3EfJ8qRroOGk3VTR EtFjTCHD7qG444WwFBjYzT810yABW3gSAYzaEN8I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Morten Borup Petersen , Jassi Brar , Sasha Levin Subject: [PATCH 4.14 267/293] mailbox: handle failed named mailbox channel request Date: Mon, 29 Jul 2019 21:22:38 +0200 Message-Id: <20190729190844.826530235@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 25777e5784a7b417967460d4fcf9660d05a0c320 ] Previously, if mbox_request_channel_byname was used with a name which did not exist in the "mbox-names" property of a mailbox client, the mailbox corresponding to the last entry in the "mbox-names" list would be incorrectly selected. With this patch, -EINVAL is returned if the named mailbox is not found. Signed-off-by: Morten Borup Petersen Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/mailbox.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 537f4f6d009b..44b49a2676f0 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -391,11 +391,13 @@ struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl, of_property_for_each_string(np, "mbox-names", prop, mbox_name) { if (!strncmp(name, mbox_name, strlen(name))) - break; + return mbox_request_channel(cl, index); index++; } - return mbox_request_channel(cl, index); + dev_err(cl->dev, "%s() could not locate channel named \"%s\"\n", + __func__, name); + return ERR_PTR(-EINVAL); } EXPORT_SYMBOL_GPL(mbox_request_channel_byname); -- 2.20.1