Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2655204pxa; Mon, 17 Aug 2020 15:39:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJze+V4cl6CJKZ4tA6uwFuxcBwGdb1Ub7YtMvh8gvT3ETfG12u3Dy8bDODgDQ7QXnYE7jH+o X-Received: by 2002:a17:906:e24f:: with SMTP id gq15mr17120156ejb.46.1597703951590; Mon, 17 Aug 2020 15:39:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703951; cv=none; d=google.com; s=arc-20160816; b=IvOPld4dNaFl8fNvJvdT3GAvz7sWA378leGsQ4dxFGVssCpw//kCVG8+zi3cNzYsgR dDdROJKiDbdgV4fjjNlZkiyCGAB+E6n0I9SKWtrpsGbboVWXTzQAE/TxEkwJoLSOT5Su UoI6azIVpsED6UXjIdjEeg0YyFD3+ouctV7sZlhR3V7PRvtq4z7FzuwSCsjutmek0vwV FFk3UKn5mHDlDH26Dy1ywdGD7gWzqWWwQ+QyDZeQDCMJ/F6Y7ZIPhxrJGHNdydgfm1/z cKgwSj5voZmBv8JAQEBPeRvD5lKlo38daFmPWS1cnZ0Xk1M0zkRcM4qv0TxE5wsDgPKd IGaA== 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=DqDg053qkoXJHLSWJ8sNliojB1AFG9hYiz7j0Q63MLQ=; b=jdioEzCYtmGw1Gld4gx+0KphtRjANJu2Wy9nzs+rw1E7J7ARKaAhQR7gW7CZOBTaAu Vz/3y6BLw8cbIceWrmmH0eo68rDbKhOjdMutB0Lqm+HtRHDEEpKynu6YbNUV5lJidq14 ceULKJ5dJFC6I86woEdNYYfb/lGtS/V/JdOzzodD1+ytcWYjU6WkwC8L8felE753gJK9 o31tR3In8Q6UI+ApsTywxLR3p3TcXv1M015QOW3vcu1kJNKiRsPoM/ZgBQRwX5Sqmyhv qZyMxspEqRzMYMGzkXDtwQAmr9umg6RGGwsxEUCY/wBhP+vqCz27vuYAiaZbkujLY4ig +25w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GxpyeVKC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb14si12577534edb.325.2020.08.17.15.38.48; Mon, 17 Aug 2020 15:39:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GxpyeVKC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389462AbgHQR4i (ORCPT + 99 others); Mon, 17 Aug 2020 13:56:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:36720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388549AbgHQQK3 (ORCPT ); Mon, 17 Aug 2020 12:10:29 -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 7386C22D75; Mon, 17 Aug 2020 16:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680614; bh=xdUZ6JmuAWxPCP7ksF1xp3Pn0z3uNevBMXyZq8yKP4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GxpyeVKC0bLPFWOfWgwj9HH1WsfG5wuicNq6ROvZPSQkh6UKp0zbTmej1utDKnyoR K31GV38hogT6PGlFciKLW/XyiJsXm5NNdGQ5lwalXtysYkyZ4yDRjiU/GA917sMapl NM/gWOiFQCdDMcor3yU/7VI0pEt1PBAd6SxaLWo8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matteo Croce , Kees Cook Subject: [PATCH 5.4 256/270] pstore: Fix linking when crypto API disabled Date: Mon, 17 Aug 2020 17:17:37 +0200 Message-Id: <20200817143808.572108530@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@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 From: Matteo Croce commit fd49e03280e596e54edb93a91bc96170f8e97e4a upstream. When building a kernel with CONFIG_PSTORE=y and CONFIG_CRYPTO not set, a build error happens: ld: fs/pstore/platform.o: in function `pstore_dump': platform.c:(.text+0x3f9): undefined reference to `crypto_comp_compress' ld: fs/pstore/platform.o: in function `pstore_get_backend_records': platform.c:(.text+0x784): undefined reference to `crypto_comp_decompress' This because some pstore code uses crypto_comp_(de)compress regardless of the CONFIG_CRYPTO status. Fix it by wrapping the (de)compress usage by IS_ENABLED(CONFIG_PSTORE_COMPRESS) Signed-off-by: Matteo Croce Link: https://lore.kernel.org/lkml/20200706234045.9516-1-mcroce@linux.microsoft.com Fixes: cb3bee0369bc ("pstore: Use crypto compress API") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman --- fs/pstore/platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -275,6 +275,9 @@ static int pstore_compress(const void *i { int ret; + if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION)) + return -EINVAL; + ret = crypto_comp_compress(tfm, in, inlen, out, &outlen); if (ret) { pr_err("crypto_comp_compress failed, ret = %d!\n", ret); @@ -661,7 +664,7 @@ static void decompress_record(struct pst int unzipped_len; char *unzipped, *workspace; - if (!record->compressed) + if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION) || !record->compressed) return; /* Only PSTORE_TYPE_DMESG support compression. */