Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5440974ybf; Thu, 5 Mar 2020 00:43:27 -0800 (PST) X-Google-Smtp-Source: ADFU+vtC2bsVeEmkdxbCX7zCPzygZgOkP2OmWSwT9hFLZY3Gi9jjDmgEQ6JoMZhxJg1MlOBYCTjU X-Received: by 2002:a9d:69d3:: with SMTP id v19mr3160772oto.320.1583397807678; Thu, 05 Mar 2020 00:43:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583397807; cv=none; d=google.com; s=arc-20160816; b=BU89GKzgo8s/OapMuh4S1M8hyYEcqfbU9cJ4e9w48n2Jkb0kZ1bwC0VMk3SNogG0iD B4AGWNELLcSGHmns1atdsKDbV+s/tx8PR62BQeak1YWSSDttc97CDUaZU144QOw03eHX 6PRKdux3Mnzr5VReboV2HZORKXQaraocQwZwp2GLc7N7cNyAs6gbNyCF8ihwLiddThV7 NGLjPJTFjav5/rJOXWKlD+6pPDR78//8FhuNhOe64Bu8HVKy0dmq1mXZv4HmMkO0z9Xd +iqDrzZps80JZcTKEpL9GswBXDjmUFwrk8jh1A9WigN8a/9E/Fg2fzQlATcrR7fyNJ8W 8o9w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qTt+sb/R1m5KV+j3++5Y1R9izPSSnxWSHBF4kFcR3H8=; b=KCmiHYwFMXMcdGDruTNWIEtZpd9GqMr9ZfgBohH0HANX2s3tiYAkchyzhqczPaJJ3k FBs2shdurXnOcfhzBdKRepfMv5269FkJCs9d1TsKssrqIZrCNWrN1m5HsacOMSdKgEJm iME3C+F+6uRb3bqy5iAdfLuFWYhonmvJUmV5WDz9qVxtu9MCzQyn5ZsLf00EFy+Etitv uK9RFIRTZWQzjaJYhDa7a7H8bSXp+X3zouMcK0E0o1Rh31iCc3R189Mj0dhU2IPVHjS+ GuPuV29KkkffDQ1bi6jwdyxeb2EN5odiXvacECP7SK+gbgTJWBzKeKWZPCm8B9HqD59w NgjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SIlHJNUR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si3118663oik.171.2020.03.05.00.43.15; Thu, 05 Mar 2020 00:43:27 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=SIlHJNUR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726351AbgCEIly (ORCPT + 99 others); Thu, 5 Mar 2020 03:41:54 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49716 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726049AbgCEIlx (ORCPT ); Thu, 5 Mar 2020 03:41:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583397712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qTt+sb/R1m5KV+j3++5Y1R9izPSSnxWSHBF4kFcR3H8=; b=SIlHJNURveT3pK583w1FhJjwGE+x98cGd+rtQ6SanRKcW5OWD0BaJMUDs6YVjx4B5URR5P 8zfLvfB+7Qq5z98C2IKiQlRU7zEov3tjwqIwgmTm0MxqrPd4Lym0BDUng5ktrxoEy96ZDr CSuB3E+Iv6dLPzDeItTdsfNXg+IqGz8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-199-GCKAEdzONp2JBsA7OFk58w-1; Thu, 05 Mar 2020 03:41:49 -0500 X-MC-Unique: GCKAEdzONp2JBsA7OFk58w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A0DD0100550E; Thu, 5 Mar 2020 08:41:48 +0000 (UTC) Received: from rules.brq.redhat.com (ovpn-204-231.brq.redhat.com [10.40.204.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5278B46; Thu, 5 Mar 2020 08:41:44 +0000 (UTC) From: Vladis Dronov To: Ard Biesheuvel , linux-efi@vger.kernel.org, joeyli Cc: linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] efi: add a sanity check to efivar_store_raw() Date: Thu, 5 Mar 2020 09:40:40 +0100 Message-Id: <20200305084041.24053-3-vdronov@redhat.com> In-Reply-To: <20200305084041.24053-1-vdronov@redhat.com> References: <20200305084041.24053-1-vdronov@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a sanity check to efivar_store_raw() the same way efivar_{attr,size,data}_read() and efivar_show_raw() have it. Signed-off-by: Vladis Dronov --- drivers/firmware/efi/efivars.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivar= s.c index 69f13bc4b931..aff3dfb4d7ba 100644 --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c @@ -208,6 +208,9 @@ efivar_store_raw(struct efivar_entry *entry, const ch= ar *buf, size_t count) u8 *data; int err; =20 + if (!entry || !buf) + return -EINVAL; + if (in_compat_syscall()) { struct compat_efi_variable *compat; =20 --=20 2.20.1