Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2704491pxy; Mon, 3 May 2021 06:17:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeXMyyzE5UR+q/7puSysR5v/kMZFNZOILuBoaCymh4/AjF/lpnQAF4m03ZjIQvknW4jTdx X-Received: by 2002:a17:90a:fe3:: with SMTP id 90mr16533077pjz.215.1620047878520; Mon, 03 May 2021 06:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620047878; cv=none; d=google.com; s=arc-20160816; b=hNI7VwNJFMFI37BcydKGKao1stcP7icYmsR7Ipx4w9bD+5PjopfG8j2N5jKcEvvuQA IUv70kF2leGV+YyxGGLDJeMg2lgeTqgP43Jh3qjLpkcyDqxVWjHuMHg/XdXwWtnyWZto WicQu1PS+GZNOYArQBqHl3cPC4uJpZdIV+ivhiu6A2vtGc+FLqWXsuUDktjI+/5oZGcD 2Ch7DlvLMzHuDbg7J1/CiRYMUEVDzKkFm/9RkTR9FRJxmLmde81ujy8W9N7jgarlOYzv NhcAj6MigJNpJiKpAAmnzNzEdp0asuTs4xXiTzaZHmwhTdjUj5Kt5bwX7c/OIl0EqD4y rcHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dl2k/Lr3k35EronFgOwKs8BL+jW6SJ/KCRP5pOzscQc=; b=fF/rwIJM6lShY6+vkFAcTkAVRbxU6WpnDNY31IycqIpcBG4/U77Gsy252LN053TYAO EChCgdmAGRGEX+UM1FuZrbvfHiZLx/+x+lj6YWtBCmdh8KL9LVe8lQWnTw37Y7Dr0CSh W2T98KnjDQNfXwEwXsQPGk7otNGAp5gHv6lbePUqY2gXng6cQVYTwZVf/6ZvOAwa/ZKQ 41kOnadwVd5HWhDKWm9HVbTtT421237A+ouL3rbc8YVcWVS1cXmBDIFN0Y9coC3ZxfVX Cxj2acHfeWuPfFDX89mrUJEGxIgJ84sKRkTC+CkYyHkbTxgd1JM42UIuwUXeXeFqkhkV hftQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sO8E4GPG; 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=pass (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 kb2si12535657pjb.124.2021.05.03.06.17.45; Mon, 03 May 2021 06:17:58 -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=@linuxfoundation.org header.s=korg header.b=sO8E4GPG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234097AbhECMCM (ORCPT + 99 others); Mon, 3 May 2021 08:02:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:35224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233939AbhECMBV (ORCPT ); Mon, 3 May 2021 08:01:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C0E3A61278; Mon, 3 May 2021 12:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620043227; bh=5DFi3yzKw+rniBZNk6JE9FjRKTgIIkyrqxIHDzQkPnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sO8E4GPGNhP6iK6TThr4Uy2frzGNt23oB7UjkBEoBNT4yO3fmLxX2cd8f/Ggyy0bm OhHpPaEwE2hUHNjKWpRXrWtO8SPIw2vOa0wj2fZTJubR3xY7ex384xeXF9CT6Jzwf4 QhyaacWAgFSibWb7J3Nzymb+ArN65s3U2qP9ees8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Phillip Potter , Tyler Hicks , Greg Kroah-Hartman Subject: [PATCH 49/69] fs: ecryptfs: remove BUG_ON from crypt_scatterlist Date: Mon, 3 May 2021 13:57:16 +0200 Message-Id: <20210503115736.2104747-50-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210503115736.2104747-1-gregkh@linuxfoundation.org> References: <20210503115736.2104747-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Phillip Potter crypt_stat memory itself is allocated when inode is created, in ecryptfs_alloc_inode, which returns NULL on failure and is handled by callers, which would prevent us getting to this point. It then calls ecryptfs_init_crypt_stat which allocates crypt_stat->tfm checking for and likewise handling allocation failure. Finally, crypt_stat->flags has ECRYPTFS_STRUCT_INITIALIZED merged into it in ecryptfs_init_crypt_stat as well. Simply put, the conditions that the BUG_ON checks for will never be triggered, as to even get to this function, the relevant conditions will have already been fulfilled (or the inode allocation would fail in the first place and thus no call to this function or those above it). Cc: Tyler Hicks Signed-off-by: Phillip Potter Signed-off-by: Greg Kroah-Hartman --- fs/ecryptfs/crypto.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 3d8623139538..271064511c1b 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c @@ -296,8 +296,6 @@ static int crypt_scatterlist(struct ecryptfs_crypt_stat *crypt_stat, struct extent_crypt_result ecr; int rc = 0; - BUG_ON(!crypt_stat || !crypt_stat->tfm - || !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED)); if (unlikely(ecryptfs_verbosity > 0)) { ecryptfs_printk(KERN_DEBUG, "Key size [%zd]; key:\n", crypt_stat->key_size); -- 2.31.1