From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj2-f38.google.com (mail-pj2-f38.google.com [74.125.227.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B825E374A17 for ; Wed, 30 Sep 2026 03:16:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.166 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790738171; cv=none; b=mIM45/Ysju+H0OXoWiApCG9kifdO75wUsou6MBYfRz2qEpaY44oD1NFZN9Q0tdrh0YymvGgBxM/cwKPqcqXCtWdSokAIflqIoPAAkRveoyW7V4eXFWPhJ7AaDNiytlrP6NLh8guOuKNvdMDXcioS4GqHw28/ZmJc7nZwE7zoltc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790738171; c=relaxed/simple; bh=roecPC4KNfRBgR7bV/ESvlsnTUyjo5wG2Hm0Hg0DTg0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qqDrq0v8fFvLcYn0rv4PhA8/C3xkp4riW4JcgJto8eputx/4j7Hy7WJLgf0cjli2JsQ9EFOjoDxwuW+txsZSN4ZY6itlF2IBa7XY1AyUUl6AL+UgAi1IxRyTLZcT5pUuW1fa1E3nWup4CeJFSS4CHSHiMHppz3e8Uhs7SrfDsyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ESilTwaO; arc=none smtp.client-ip=74.125.227.166 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ESilTwaO" Received: by mail-pj2-f38.google.com with SMTP id 98e67ed59e1d1-3a4b940d3d7so386534a91.1 for ; Tue, 29 Sep 2026 20:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790738169; x=1791342969; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0KXgNpEX25c+Amu+sqbzUoyIr1sz44/W+AZ1ZSlYE64=; b=ESilTwaOYnVYfJwiAsvEMNbDpUGKF+P8/M1X6CEuuvzU3WMUKXOfU7sMOQh4OEKsvE Mp45MGyJSktlBsOI5UafCT8FyFwCYfGgF8Mc7HK2IlVXPQWiwGR8efwQQRf+Jt0PbHLI KxbAevxmpxsqwWz2sHeMITDkctUDbIT56ZgHhuBHVlTDri8QDFygxQIwHePwBpi13Q8J twfGQszHYqpZCS0jM1Bq2j6HNIlzOypRWPpKr1h0FEffumj5vKivvTi4O2tF41ZKgq13 s9btjx3Dj6GRSuq2q/se1AZ9BKx0G2JslT4yTo8I4G427g+hMM5k6lg9PthgJxHSFC2b y1og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790738169; x=1791342969; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=0KXgNpEX25c+Amu+sqbzUoyIr1sz44/W+AZ1ZSlYE64=; b=E44d+TP17uIcYs8lSYPhVziHQywZGOXBAjocY0dknGi/AtCNfu2Dq7EK3dMcK/+DC9 hgaeur9BFF0WiHeSeZ2MaHQ8L8sy8jgUf1v1KC13s68hQ9LuJk4yLsnUik5qVxSmUhux tY3r2lJ9CLRIHDQvxOxuy50gxo3FrNsgw3L8jtXVhkacHsXl3AmbkXM6FuOVaM0UCP0+ JhbWEMsyMptH8xepVTCdEfRzih3c4jiXsuK6TUSuzsITzVeZk8GN/MNTyIIh0oOkWWdN LUDzZJNwHi2EJ6u+XMYG2MxEZwIrwPjQyT6qBCT6Jr9qxIUfe6C4iQbuklN8xNJlPQIQ rPZQ== X-Forwarded-Encrypted: i=1; AKwUvBw7wItNBijLh6KLRgjh9JYabR2i5cUlcHKgZcNcTa/rF5B2SdO7RszV/WwPi27H2Jwh6OMHCNGtos82Qog=@vger.kernel.org X-Gm-Message-State: AFq9FYLE8sTMolGQF0eMoBLnX3B4LQ0xuYa1rbWdrI6wIz43oYlLo2m5 7PBurwCODkOG7klz2/tRUoxPA9QklJL1AAcG/w+JoVGZ+Ytb6ARx6SPk X-Gm-Gg: AYBFou0aNrZFEDkoSlda9njEE1j8X+eK0hrEHdFRE6ooA/CmLn7tgGt2pFWdfyNvo4h qV3PBsLMz+g2pRnMhtZLLZ22gBwpJR+YFixAkxz4u04osH6s3xha68d8F3Mc8K2aH2oAvsGmwaT KPycsU6Q8smkYxQUwIRcsQAo7JuWP8Bk6AOCpNus9G95tTqYPqOIwIIvB+lAtiywg9wzDuaro0+ K6OExgCnPlmFIxIYsD6lTshyTy3Jt0JENMsVzsI3WJ8f9J1lHkCszlLjOF5B0bbcVXek9QVncwT X98dEzIJ2b9hEQeKoE+iPRn2lnt7HeC7K5da6Sa/OzFyszN5z67AfZ2iWaCkOyCTl934w51sXuZ Sha3UdU3HeaDHgeAOpklWN9rvslJXPc1vkA9SkOF1M3EqWKlWWIqKREfDHfrmQ9xLmOZXVjZbDh 8RAI0tBHnrcypf1Xun6vuG1os+EF9ADz2Z8i8J6KMLfM0pbkpeZpBKHI4Z1o2aAc9RfravsENB5 HDU3TjsAjeI4m5Plim44XVLFssqKVogryB4Vi3rD54shobM8GRMsr372XMqTxeuglz3HnPVWLju 7gLG8oFUFQ== X-Received: by 2002:a17:90b:3ec2:b0:3a0:b223:683e with SMTP id 98e67ed59e1d1-3a4d18bdcafmr79615a91.48.1790738168850; Tue, 29 Sep 2026 20:16:08 -0700 (PDT) Received: from phui-2.c.googlers.com.com (25.187.82.34.bc.googleusercontent.com. [34.82.187.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3a4ce1c9045sm588743a91.12.2026.09.29.20.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2026 20:16:08 -0700 (PDT) From: Hui Peng To: Anders Larsen Cc: Matthias Goergens , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Hui Peng Subject: [PATCH v4 4/6] qnx6: release bh2/bh1 on active superblock selection in qnx6_mmi_fill_super() Date: Wed, 30 Sep 2026 03:16:02 +0000 Message-ID: <20260930031604.70544-5-benquike@gmail.com> X-Mailer: git-send-email 2.56.0.rc1.315.gc6ed9934b7-goog In-Reply-To: <20260924073920.2782917-1-benquike@gmail.com> References: <20260924073920.2782917-1-benquike@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In qnx6_mmi_fill_super(), when selecting active superblock 1 or 2, brelse(bh2) or brelse(bh1) is called without resetting bh2 or bh1 to NULL. If memory allocation for qsb fails or a checksum error occurs later, label out: calls brelse(bh1) and brelse(bh2), causing a double free. Clear bh2 = NULL and bh1 = NULL after releasing the inactive buffer head in qnx6_mmi_fill_super(). Tested in QEMU against tip of mainline commit 62f4c998b297 ("Merge tag 'parisc-for-7.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux") using a loop-device reproducer mounting an MMI QNX6 filesystem: verified that inactive superblock pointers are cleared on selection, avoiding double brelse() when error handling unwinds. Fixes: 5d026c724220 ("fs: initial qnx6fs addition") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Hui Peng --- Changes in v4: - Rebased cleanly onto upstream mainline commit 62f4c998b297. - Added QEMU test procedure and verification details in commit message body. fs/qnx6/super_mmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/qnx6/super_mmi.c b/fs/qnx6/super_mmi.c index b8afb6f388b2..797d8c238bbb 100644 --- a/fs/qnx6/super_mmi.c +++ b/fs/qnx6/super_mmi.c @@ -118,6 +118,7 @@ struct qnx6_super_block *qnx6_mmi_fill_super(struct super_block *s, int silent) sbi->sb_buf = bh1; sbi->sb = (struct qnx6_super_block *)bh1->b_data; brelse(bh2); + bh2 = NULL; pr_info("superblock #1 active\n"); } else { /* superblock #2 active */ @@ -130,6 +131,7 @@ struct qnx6_super_block *qnx6_mmi_fill_super(struct super_block *s, int silent) sbi->sb_buf = bh2; sbi->sb = (struct qnx6_super_block *)bh2->b_data; brelse(bh1); + bh1 = NULL; pr_info("superblock #2 active\n"); } kfree(qsb); -- 2.55.0.1082.g2b9226bbc0-goog