Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp507451ybi; Thu, 30 May 2019 02:07:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3jDvadXsQ8eycN1l0UKlsrMRI9OMo3fsL6gV35NG6qnDiA8ZihzTmb5H0LfRsOOYAhNMc X-Received: by 2002:a17:902:8d96:: with SMTP id v22mr2805973plo.282.1559207276838; Thu, 30 May 2019 02:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559207276; cv=none; d=google.com; s=arc-20160816; b=E55Qz28vcQwi5CnTAs96tlxSMor3kIbH2nGsWg4OyPP9yWgBRUWSOe9yndawu1R54D ltkH+U2+4k9f0GY8GgmD0U9OoNeAqaflQef+QuOPtDiN52blJNLQzRlOcvCL1//Xaa65 9mDd/z9JXvzAN9+fwDZomzD2HqbxeqOIEiH7zViXaW4ui/W/PlxgHxR4zgRWihdNwd8r KwzDz8XHfISjdDsTDpCUsc77efLa44twED3iDMrdffexUa4Z6La1nJTotMtv2+dCWIeB WMpFEo7SCtJ28BQJbdJyRkgYsdRhWcnDbvYc91cPYxwlnzUCQ6w5hrjdk8GsSWpirkJY WjiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=WB3NAADDilR+pQagX0XJnxPLeHo0i5e2Cuu9jSLHh1E=; b=N1bCKs5l/RJYV+rjVNnYvGRWQCUIJFWtKCuClZupAiCO0x33SxumZUmCwWGMlRvZ40 QM+ycKrzMEDUExUivfqEskMGna+8jS7UsuoGm2ek4cxoHpK9fe/jYthg2beanNEA8LBR b1TanlB08W563ALy8m6j6TfUC2S5fxD6HZ/Samd08L0MWfsSuN4otsHfEuYTRn2Yieyr hd8Mkb+t8QeVw+YyPG6HfJyjfDmLHrfNeWraSbair8b6YBVW0sWcjsWfcVNspO8AcSzu v/MonKykbW6+p/MPQdsiGgU8JHMH2ugdI45KQ8IoG+7liMJVI6VZNQiF0fe+B1mpd5Qg l2Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lpB1Jkw2; 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=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 j93si2285246plb.32.2019.05.30.02.07.40; Thu, 30 May 2019 02:07:56 -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=pass header.i=@gmail.com header.s=20161025 header.b=lpB1Jkw2; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727068AbfE3JFG (ORCPT + 99 others); Thu, 30 May 2019 05:05:06 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33295 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726442AbfE3JFF (ORCPT ); Thu, 30 May 2019 05:05:05 -0400 Received: by mail-pg1-f196.google.com with SMTP id h17so1658229pgv.0 for ; Thu, 30 May 2019 02:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=WB3NAADDilR+pQagX0XJnxPLeHo0i5e2Cuu9jSLHh1E=; b=lpB1Jkw2oOAqbZBAmZSQC/b66H4fQsO13YoayB5e3p+1e8WhK+IWndHuFP9yLrK1u1 iO9e/9gce9SWDSC+7w9NQlZ+efezCgjpg1dK0UWYmsZM9eNs1c3AzQc2AoGGPqSoyGqw Gu0xu4MUoTWkmXVIHGfz+NUR7iwSTs9Kodx5w/q3G30pR1EaVQjWejdEXGZPmOpOijtT v1YbppCuE/0Eo4vObiamodDEwECOYxujFpONtXglKwiCCNfA9DYPZSrUyA0GJPQ8W3c+ W5YxuNW3HFH/hsk6kIDEn8pNlPXUUhKfBx+DMGnJCygcdYLdpHPwiMmjix+wxiGOWsiX 2c5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=WB3NAADDilR+pQagX0XJnxPLeHo0i5e2Cuu9jSLHh1E=; b=B2wtWDH+uLe7Uk8+azfhSnYNGP/6dJhgzIAiEnbuS8SE/MtfclfbW/yiqtbpuOmfJ9 nXNyw23DT2aKgyG+dH31EEefugtU5leNWfuAJfSorQs4v29LcT2KqrVGBi2xKx0W/dyk /MyxenCCryzzCPET4M5nAuPqMfEzLKlZDaCyMRdjXt5w/DV8gxftzTus6D50bcrD5dV7 kHpvYdMxa1TrrecR0PCGtxvYfcaL3X8Qr25GuRcAkVZF4mdZPvZnLWnZ4Bduyrp8Eyk7 ATEnFvwFlqlzBwIFybsxDFrg3ZBUHLyeWRtGydjDdNrLoiau9jq20PSTvEPAXaUM1D2a MUlQ== X-Gm-Message-State: APjAAAWdE7K29SvL+3y7fHJWCDjFy3pjK023CyjaiHD72AZd+dZsEMSG 2z9ckXjzLIhtwwuEA8bzGEWUzYN8zEY= X-Received: by 2002:a17:90a:dc86:: with SMTP id j6mr2336394pjv.141.1559207105150; Thu, 30 May 2019 02:05:05 -0700 (PDT) Received: from zhanggen-UX430UQ ([66.42.35.75]) by smtp.gmail.com with ESMTPSA id x10sm3427230pfj.136.2019.05.30.02.05.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 May 2019 02:05:04 -0700 (PDT) Date: Thu, 30 May 2019 17:04:55 +0800 From: Gen Zhang To: hubcap@omnibond.com, martin@omnibond.com Cc: devel@lists.orangefs.org, linux-kernel@vger.kernel.org Subject: [PATCH] orangefs-debugfs: fix a missing-check bug in debug_string_to_mask() Message-ID: <20190530090455.GA3059@zhanggen-UX430UQ> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In debug_string_to_mask(), 'strsep_fodder' is allocated by kstrdup(). It returns NULL when fails. So 'strsep_fodder' should be checked. Signed-off-by: Gen Zhang --- diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c index 87b1a6f..a9a9aac 100644 --- a/fs/orangefs/orangefs-debugfs.c +++ b/fs/orangefs/orangefs-debugfs.c @@ -888,6 +888,8 @@ static void debug_string_to_mask(char *debug_string, void *mask, int type) char *unchecked_keyword; int i; char *strsep_fodder = kstrdup(debug_string, GFP_KERNEL); + if (!strsep_fodder) + return; char *original_pointer; int element_count = 0; struct client_debug_mask *c_mask = NULL;