Message ID | 20240222102548.1426561-1-suhui@nfschina.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-76322-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp158876dyb; Thu, 22 Feb 2024 02:26:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV4sV8a3QABliP4+8oneanMY5uTgWI3iHmrRc3UvAKAanncerTFXH0k/HzOc61doE1r+zcEpyOnniWYDXh4FDjs/PFH9Q== X-Google-Smtp-Source: AGHT+IGbdWjK/M+OK9pl5osaeOJo5FQiiTkrSp9xTJXdk36xse7dApIOiAWTJYonboEEhdBJViVM X-Received: by 2002:a05:620a:15bb:b0:787:a444:12cd with SMTP id f27-20020a05620a15bb00b00787a44412cdmr512162qkk.59.1708597598119; Thu, 22 Feb 2024 02:26:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708597598; cv=pass; d=google.com; s=arc-20160816; b=zO4Wjam1vnA7c/iTmIWOWxjKR9gQEhKXRDTE70uuz/aHcQEkvvHDzWwAOn1AoZnNjO Xx/4kvpnbZM7SPXQocDNvI8Iahf7WIjoe3I0u7hM5QznZX4+CkuBAQ45iq2tobohbmmt qHwJjIMNe+qeITgvB8tsVcN78ifqTkJBy9Tq/JVapvo2X5Z7fWBD5hXZtmXrrRtf2u5I 4wFPrXPxlL4+zM+yVSDgRDP2UwSPrH66RRK3/ZcpDbXq4CzhOeQeSujs670wHZ35Dxg0 QOgS35CvF5SBH5FdhhVUGZpR0u/41BO3wLZStvnvCZ3lLsl/X8k39InBegDhuJMjNSoW WZiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=kGzzuzIOGybsJ6z29Izl4lL3iuwQJ7Qr+zp2XdfdN58=; fh=HnVwUOaH0xFFSx+ca5OaOvEisbsLu3IvwevzkAotE6I=; b=IDwunptDH5hUBIe4R7h8VeeaFiwg0ZtZw9/zYr2Rm7ix30gr8C3t0y+5jR4sh+B1Ow 860G8p5dPLx/tGpS6GXw8s0BPc/+t04U2AQ3hnZEvCKachxVRh4PZOosGOTj3xMAr8md cInXlFnrhvXcXyAOj+S0tvGpzNVWBxBAhltykMe8zL/hg4Sd7hLN/NU0WlyWoeVXjeul ald5iqp8vTaWKpOWQiTysaNYDSfZ2Hz0fxz3jR5FxDYETslb8SsAscmAZr32hF3Te5Cp vRdGlozsoGi5iH2QExse8wwzeefWwoL+gRokoKdp1mCp15IDer4EIUbVOzVYd9kD59Mv 1efw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-kernel+bounces-76322-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76322-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b19-20020a05620a119300b007873ee07d54si12419285qkk.260.2024.02.22.02.26.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 02:26:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76322-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-kernel+bounces-76322-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76322-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E4B1A1C23C04 for <ouuuleilei@gmail.com>; Thu, 22 Feb 2024 10:26:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 487CB3DB86; Thu, 22 Feb 2024 10:26:18 +0000 (UTC) Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id BE4EC3C481; Thu, 22 Feb 2024 10:26:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708597576; cv=none; b=nSvWAv1Zb+rATCXVUqQ7ua2nb6eKoajNQ2nHbeUC8YBT7hzaPvqHvIEXnnHCtjJXUWlmOCbzAMVPXM83l4s33r57oikR4W8aNaE5s96S3E7ozOBfERRMd2uJR7ZVbvKZJ7LaP64ghGRhBUJYpbJAX+13Vj7mKn3nlAHj59+iUtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708597576; c=relaxed/simple; bh=Rm+Yj2UuZ1027lvdPwgeiZQLrr3sHaHO5cTHO1idRqg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=G6pfVhou3QvsIsUHgvSK9LgyiZD8E6u8zQI31mun11HkxUs78/jVYaqsbHnVMBF5umGRrLNNu2NajhtLrOWMPep1MNIcaPtOrMU0W4JGdOb+/ce4bBRNvxk8Ltl1mccPOxqxsCZmdq5upA8lMn94hv87dD4SJ+MRVm+lEjgprc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 093096032FDD7; Thu, 22 Feb 2024 18:25:52 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui <suhui@nfschina.com> To: hubcap@omnibond.com, martin@omnibond.com Cc: Su Hui <suhui@nfschina.com>, xiyuyang19@fudan.edu.cn, cymi20@fudan.edu.cn, tanxin.ctf@gmail.com, devel@lists.orangefs.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] orangefs: Fix possible NULL deference in orangefs_mount Date: Thu, 22 Feb 2024 18:25:49 +0800 Message-Id: <20240222102548.1426561-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791594434747961231 X-GMAIL-MSGID: 1791594434747961231 |
Series |
orangefs: Fix possible NULL deference in orangefs_mount
|
|
Commit Message
Su Hui
Feb. 22, 2024, 10:25 a.m. UTC
scripts/coccinelle/null/deref_null.cocci complains:
fs/orangefs/super.c:584:18-25: ERROR:
ORANGEFS_SB ( sb ) is NULL but dereferenced.
When memory allocation for orangefs_sb_info_s fails, ORANGEFS_SB(sb)
is NULL and ORANGEFS_SB(sb)->no_list will result in NULL deference.
Add a judgement to fix this NULL deference problem.
Fixes: ac2c63757f4f ("orangefs: Fix sb refcount leak when allocate sb info failed.")
Signed-off-by: Su Hui <suhui@nfschina.com>
---
fs/orangefs/super.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
This was already fixed in commit: 9bf93dcfc453 ("Julia Lawall reported this null pointer dereference, this should fix it.") Amusing subject... :P regards, dan carpenter
On 2024/2/22 18:45, Dan Carpenter wrote: > This was already fixed in commit: > 9bf93dcfc453 ("Julia Lawall reported this null pointer dereference, this > should fix it.") > > Amusing subject... :P Oh, really sorry for this. I forgot to check the linux-next git. I'm not sure if commit 9bf93dcfc453 will lead to sb refcount leak which was previously fixed by ac2c63757f4f ("orangefs: Fix sb refcount leak when allocate sb info failed."). In any case, the null pointer problem has been solved. Thanks for your reminder:) Su Hui
On Fri, Feb 23, 2024 at 10:11:03AM +0800, Su Hui wrote: > On 2024/2/22 18:45, Dan Carpenter wrote: > > > This was already fixed in commit: > > 9bf93dcfc453 ("Julia Lawall reported this null pointer dereference, this > > should fix it.") > > > > Amusing subject... :P > > Oh, really sorry for this. I forgot to check the linux-next git. > > I'm not sure if commit 9bf93dcfc453 will lead to sb refcount leak which was > previously fixed > by ac2c63757f4f ("orangefs: Fix sb refcount leak when allocate sb info > failed."). > Yeah, you're right. Do you want to re-fix that? regards, dan carpenter
diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index 5254256a224d..c056c86e2482 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -581,7 +581,8 @@ struct dentry *orangefs_mount(struct file_system_type *fst, free_sb_and_op: /* Will call orangefs_kill_sb with sb not in list. */ - ORANGEFS_SB(sb)->no_list = 1; + if (ORANGEFS_SB(sb)) + ORANGEFS_SB(sb)->no_list = 1; /* ORANGEFS_VFS_OP_FS_UMOUNT is done by orangefs_kill_sb. */ deactivate_locked_super(sb); free_op: