Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4865050imm; Mon, 11 Jun 2018 21:27:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJYrC/gjnvfCRySYI9R4Dp3WNmebuKvnOV/jIWc6FRQxsqkEQJl13uFxdd9OVuoFpPQRKu2 X-Received: by 2002:a17:902:14b:: with SMTP id 69-v6mr2242679plb.184.1528777670769; Mon, 11 Jun 2018 21:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528777670; cv=none; d=google.com; s=arc-20160816; b=mL9i4HxWUALQUMrZywg7/lPGbzp9twDbfaUG1GIb9GIPldkGoj710UmX57xe8qRjJ8 s0/qGSWSqtMb8YfRXLbAmVGpKpdrxk3WqaceiEYXgi/7lk0m1VBmqt9tFqWWGZEdNFrU WOVQl4bou/Hlx7lXUivqOS3OZstq/s7iceBxECVxBjFhas+E9uGHUd+o4iNKR14l7Xai PCYoJh2svNSkkW/7rCvqKp8yz7oWWWFjRn77vjw9fdawqYJqBkvcipzHpau0M6UEwQIo no2eQ1SbqImiULFsNgrhXa9c1qX5PdGyuNt1oCxNCIlJK8OnEh2XIqrgRo37DDdqbpon LxMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature:arc-authentication-results; bh=SStYGhlcztqQ2MrXH1jzRquNyv/Gz5mhdhNphCnT8tg=; b=JWaIyP8BYFfyh76Gy+pyWcniuJEqpDGmsuDzW7gKR6FCcT1hX/Dz2A+AnCEuRX7urH 8bKeUu3hjxh9YqQ4j62UjbfRrnpfp3mPskhvDLjXGmfYEHNrJEsL0m2rCnEiJo+HzOFY vAiuMubvlXS77AeQQc17TG1KyF9caMkqTKfjmNtIUPFtACgdSmSfRRPmb1yQQz5PTAzi gs+Dxkayf0jPQKz6dkH+t2MJg9t5S/6EuD4URr/XEzlyrF6+xq5hd1P7g0Bd2cWNPeDl a1pRmLxRt9HRPhkmBsOIfmmZPPbhKNvBPF1bnZoI7duuue41dtWqvoKv+ZPwnBpVNbNw XsrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=MksncrhA; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3-v6si22885850pgt.106.2018.06.11.21.27.36; Mon, 11 Jun 2018 21:27:50 -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=fail header.i=@gmail.com header.s=20161025 header.b=MksncrhA; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753455AbeFLE1N (ORCPT + 99 others); Tue, 12 Jun 2018 00:27:13 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34274 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbeFLE1M (ORCPT ); Tue, 12 Jun 2018 00:27:12 -0400 Received: by mail-pf0-f195.google.com with SMTP id a63-v6so11404278pfl.1; Mon, 11 Jun 2018 21:27:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=SStYGhlcztqQ2MrXH1jzRquNyv/Gz5mhdhNphCnT8tg=; b=MksncrhAv+28cnPrTeqSYPjg0teTHebXSTHHFRMMHB9Oa7iemr97MRBUi71KNfp6kF abgC+HFzraaqgsPVQBHPJ+/l8w13HtcKecyoDCBpyzQYE9707epJQ/rxjIY4nHUJ+VYq L+qKCTel8jpgLgP2Bz6ct+vakZTxEhGBdu4f9/vgnBI2GZFRbX7EUE0LAE7q3f49tm3P 8cJL1LnZY8AQ6gdl5sEUxnNgp+/Uk77gCWm5v3blHbbbkHYvGvQiJrYVfrTKtkWCL4+w kwSS5PxihyX41rmx/rzpyWEZq+6obHk3rcez14CJSfjvsVsfQl1UGt66bS8Y9qnZs5BB jkMg== 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; bh=SStYGhlcztqQ2MrXH1jzRquNyv/Gz5mhdhNphCnT8tg=; b=J7XIS1GqUVyecm/LmR7CovgYpTk4hu0BXXPcwx0lZ5c5LikYj5xTVdIp38nr6mARYH k455Cyc9PdsOuTPD9hd+MroKO9AdXCuPRQFXOk/s/243GIz7zaV8uL0xVU+MF38oKEtD mzY8UnmALtcza+LQ/cX2M0Ebud+jiitr6akZt4GekK/t+/RayTH2xPSHPtLchh9U+mps ymOS4Di7gLl3wV87tc9PhP0AV80aS1YxdcYkZmBjSENyGnyHYHnGokdYrEeyvvxCdbih Q8WGm/WYXt9DVy9xRkW8KWqCq4f4R2Ckf/HCXm3SAzKgA5awA9M8FJ6/25IMPPRhHP3B Puag== X-Gm-Message-State: APt69E0jIIzNiFEV8WGSA/YjWdweG/3jCkKMgb5U5H5Vd61f1yF2qTwh Thh+7clR2kA+VN0lSSV6N7E= X-Received: by 2002:a63:6f42:: with SMTP id k63-v6mr1756600pgc.135.1528777631602; Mon, 11 Jun 2018 21:27:11 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id c19-v6sm4347607pfn.182.2018.06.11.21.27.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 21:27:11 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , James Morris , "Serge E. Hallyn" , Mimi Zohar , Matthew Garrett , Jeff Layton , Thiago Jung Bauermann , Dmitry Kasatkin , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] integrity: add error handling for kmem_cache_create Date: Tue, 12 Jun 2018 12:27:03 +0800 Message-Id: <1528777625-40502-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When kmem_cache_create fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling kmem_cache_create. Signed-off-by: Zhouyang Jia --- security/integrity/iint.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/security/integrity/iint.c b/security/integrity/iint.c index 149faa8..c074fd8 100644 --- a/security/integrity/iint.c +++ b/security/integrity/iint.c @@ -172,6 +172,9 @@ static int __init integrity_iintcache_init(void) iint_cache = kmem_cache_create("iint_cache", sizeof(struct integrity_iint_cache), 0, SLAB_PANIC, init_once); + if (!iint_cache) + return -ENOMEM; + return 0; } security_initcall(integrity_iintcache_init); -- 2.7.4