Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp847163rdb; Fri, 23 Feb 2024 01:37:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXn0zmZnKRPyawzWOcBP+j/73a3lOeTK+iCmdt4mM09UztrZxModzM6YzwQR5TOlJUOOsP2o194IQNm9jkgczGivLOnLA+geh3zFqlHAQ== X-Google-Smtp-Source: AGHT+IHZpCTksyNWU4oNJcIuDpBaY507nmC+vj38xNd9gjvBS3rOD28K+j5HJ4AkobItqni+Ixzv X-Received: by 2002:aa7:da57:0:b0:563:c54e:f1 with SMTP id w23-20020aa7da57000000b00563c54e00f1mr835043eds.2.1708681070971; Fri, 23 Feb 2024 01:37:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708681070; cv=pass; d=google.com; s=arc-20160816; b=y53g7kgfLpl70msTVRNlMwLhYuV8QzCeVUOzggLeQR45+S5JEwyWTZvXgn851fBHID fVUPvMkn5qwimAWZqfUN9/gzajgYAQ8eqv3gLfliMcBTnImBa55u7uMGzO69OprUZSwh d4klfQ8GWwSQpaLmBR/6PUa36NP/e1V9MV4ehDWtAKfMcsFh1vl3dvvc1i204l/yPqD+ okEhkmSqamwslzCywYxPnjDc6VQ0Euq+08rRi28+Z0EHJ6O+dL/dvuhyNfKCysfDoxJT guX7zYj3C+nCw99RB3Zjr2NWIQsAVK6SD+nsP89M/ccg3SIUONSUm0IOIcb5/mnUZXXu fBpQ== 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=fNSpyGiwvrcHRe6E2QN2k9Y4FoD0gG0ye6GB8BZMZ18=; fh=5YKPRJEHDy1kuQqsvRIda0A4kiv1YLGZHXqGIIyBv4w=; b=L5uWSudTE7RQu8B3xsAdBfoZxeuk8gVUa4qhRt/hKQ2Hh7EDNjpKhJbMpe9aw06hQY qaMR0oVxL0/8rvge2XSgk82SEwHLfw7fqqe1aa+XxVdwb+diwUpeOpDMZio9RVFixw65 Vhuoh3SYBVtf3CfkCCYxPGh8WJxwHIKBpX5hvZOQexL5hpgO31DGzeQu+4KX9RZ9OmBa CIMG2J3jFJvCrtZWP7mDy5EtDBKMqeyaWexWmJr3tuTw61lV7X5WCSWFuFuuqzZI7ove TWtAEHS6wLJxv2nWEZ4LtRaPoJ6KoGTf0Z1FkIG2Gy4nSEADBM79AgS0X6yE9G2cUNsE YJCQ==; 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-78027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78027-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h28-20020a50cddc000000b0056382b02f44si6117057edj.37.2024.02.23.01.37.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 01:37:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-kernel+bounces-78027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78027-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0E5F31F262B1 for ; Fri, 23 Feb 2024 09:37:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BC771B95F; Fri, 23 Feb 2024 09:37:39 +0000 (UTC) Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id 17BDC18B04; Fri, 23 Feb 2024 09:37:20 +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=1708681049; cv=none; b=Rnm7fFuWyqY2jZ9JflKzsJwAuPUOwYwBe3J4V7OPtitRzSrDyeVaqTEo+1/vo4tauQKDDJv2vIa8rLUe037795zf7ZHbX7blPmYL59maptHjqlILWYPcYV+8sXlPNBCHtdp17QMhxVE3scQCQLtbigLpDQ/lA04AgpBLxaaq3Sk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708681049; c=relaxed/simple; bh=jzGH6BnS+LEtgknawVwnW9qhr2Z/pUoY5FYpMz3a70E=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=tPv5BmAHy/nGQOggmd/ymo1A1VHPsGrnJAC33umROUe0UN6BsgR9JZfEPbDQvBwqk86yPhs4oZFQ+53njuLFwUKvE0xJk5FsNZY0DY3vM0MNYNCBirqZArbL0B/P9y1vL5E2GL1TUKbH2WIJn5XWf+pnz+4vXO8YQm+EwsN7UBc= 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 A61F2604A6F93; Fri, 23 Feb 2024 17:37:11 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: Mike Marshall , Martin Brandenburg Cc: Dan Carpenter , devel@lists.orangefs.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Su Hui Subject: [PATCH next] orangefs: re-fix sb refcount leak when allocate sb info failed. Date: Fri, 23 Feb 2024 17:36:41 +0800 Message-Id: <20240223093639.1794556-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This problem was previously fixed by commit ac2c63757f4f ("orangefs: Fix sb refcount leak when allocate sb info failed."). Add a judgement to fix NULL deference problem and also avoid refcount leak problem. Fixes: 9bf93dcfc453 ("Julia Lawall reported this null pointer dereference, this should fix it.") Signed-off-by: Su Hui --- ps: Thanks for Dan's suggestion[1]. [1]: https://lore.kernel.org/all/c4bf77fb-c289-4f5d-9f20-e0861a543d91@moroto.mountain/ fs/orangefs/super.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index 34849b4a3243..e189e1aae00b 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -527,7 +527,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst, sb->s_fs_info = kzalloc(sizeof(struct orangefs_sb_info_s), GFP_KERNEL); if (!ORANGEFS_SB(sb)) { d = ERR_PTR(-ENOMEM); - goto free_op; + goto free_sb_and_op; } ret = orangefs_fill_sb(sb, @@ -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: -- 2.30.2