From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 990EDC636CC for ; Fri, 3 Feb 2023 11:01:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6C5D480FF7; Fri, 3 Feb 2023 12:01:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="D6nJAa1N"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9817C85EED; Fri, 3 Feb 2023 12:00:54 +0100 (CET) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D4DF185D7D for ; Fri, 3 Feb 2023 12:00:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jens.wiklander@linaro.org Received: by mail-wm1-x335.google.com with SMTP id d4-20020a05600c3ac400b003db1de2aef0so3551088wms.2 for ; Fri, 03 Feb 2023 03:00:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=PHvn5qyKCoCUirS0xD0cXrE6q8od43U3PmtAwTWP7/w=; b=D6nJAa1NLL7v8qIlNkUPOzCC0HibfHBHbwleWBt9b/mMJGeRNzoOHHDtvriLxiGe+T Dm6fedP6GTyphW0rAfz36uc/0w8O72fCpPuY9FgfZ5QobG9DtREvrdPlxte3Poh2Si/1 acqqdfhFLlDebu6cQuWK2vmGwJMKMxNKPsoSktQEBPPkTVIVguqkIHdU6J8/1wxRfx7H W5aaErS/dS8HCVEHBf50NAwMzi9eso1KS/O+r7llSptjj47J0xAbOCeZHnCGFQC97sON PNIIelF5kyB4KqHps/zS6yEDoa/jD+PP+pM9wccw6SSCYShwDlTEwCFtyUDSJ596QjMw HOmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PHvn5qyKCoCUirS0xD0cXrE6q8od43U3PmtAwTWP7/w=; b=coPGZncpJZ6YN7T1zD81aPer3wEcJ12AZJas9EJGEpMfJKBLEnfZvcPWDTCn7OhESr IvudR+8OWzT8aabbkdk6BvBrLMOI3XnJhnX3Yo//zpnnUZmdkEXuPGY4nazMSbmJE5w2 XKSGnxGMH84sUeQe0jzRKVwcXQSMSKmnwfSmpw9pEwLd0L8WTciWaR9/BqbbkzqPX7en Ms4Gk/oR0V2NT7eR0M/nuwtYEWToKIGT7ytpaCaoKOzV+oZZbDTwmJpQoJXpXA5aS7V3 IJxKU3hR/PhwUC1y8m6nSr+9KlppS0ycV+KvvIAnrs9rflYO3y2sns7RWBVgfGgHZ6Id 1wmA== X-Gm-Message-State: AO0yUKWT8d2x0N2eZ1QKM2o/MmGrO4K5Q5Gi8cTQ/FCY2UrrqiW29RTO 5yz9A+ieia2wnPjVJtly+saPkHKhdLIlBY+a1TKi4g== X-Google-Smtp-Source: AK7set8pYECpnOuvQFzXvu2Jvu/H/nGokIlv+/pSSQUqn+gK+KVqL3LLvJwQbIvD8G8jQ5VVhuVCXTl2y3UfCrZFcBM= X-Received: by 2002:a05:600c:3d98:b0:3dd:3dc5:880d with SMTP id bi24-20020a05600c3d9800b003dd3dc5880dmr274833wmb.75.1675422007237; Fri, 03 Feb 2023 03:00:07 -0800 (PST) MIME-Version: 1.0 References: <20230122024130.4028621-1-ivan.khoronzhuk@gmail.com> <20230127200214.287138-1-ivan.khoronzhuk@globallogic.com> In-Reply-To: <20230127200214.287138-1-ivan.khoronzhuk@globallogic.com> From: Jens Wiklander Date: Fri, 3 Feb 2023 11:59:56 +0100 Message-ID: Subject: Re: [PATCH v4] common: avb_verify: prevent opening incorrect session To: Ivan Khoronzhuk Cc: igor.opaniuk@gmail.com, u-boot@lists.denx.de, Ivan Khoronzhuk Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On Fri, Jan 27, 2023 at 9:02 PM Ivan Khoronzhuk wrote: > > The arg->session is not valid if arg->ret != NULL, so can't be > assigned, correct this. > > Signed-off-by: Ivan Khoronzhuk > --- > common/avb_verify.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) Reviewed-by: Jens Wiklander Thanks, Jens > > diff --git a/common/avb_verify.c b/common/avb_verify.c > index 0520a71455..48ba8db51e 100644 > --- a/common/avb_verify.c > +++ b/common/avb_verify.c > @@ -619,10 +619,11 @@ static int get_open_session(struct AvbOpsData *ops_data) > memset(&arg, 0, sizeof(arg)); > tee_optee_ta_uuid_to_octets(arg.uuid, &uuid); > rc = tee_open_session(tee, &arg, 0, NULL); > - if (!rc) { > - ops_data->tee = tee; > - ops_data->session = arg.session; > - } > + if (rc || arg.ret) > + continue; > + > + ops_data->tee = tee; > + ops_data->session = arg.session; > } > > return 0; > -- > 2.34.1 >