From nobody Tue Feb 10 04:03:15 2026 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 4966F248F77 for ; Mon, 1 Dec 2025 21:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764624570; cv=none; b=JEM1uErXL2efk4tuUvzcOazB/qypUdTOlvWav5E5wulxkZm0JotqyYD7npIjZt35MVqlckq44A8USSpIzffxmLn+/lZqBx60ZRZzUWfPdbTizfrrSIHMuh3H1WHyEnewborlLbii9jgykq1BREp+C8vXuSzdcdgqDGZYHE405es= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764624570; c=relaxed/simple; bh=lSvg/K7yPsKUCFTcfSOcZg9VsOKeNcGmYT1edmcLv+g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZUKr1vV0OZfXEgfg8wZzDYlNYpq/1u/hLeMsl3MnI6A5+lI0bSnPBV5H9LnFwE4BfQUk3NYckJye8138mw9L0R9eS2K5Dy9OdeyZ0NV58HRShtDK8TGMERjH9F5jE3EahKgY/BgaZ7Bh1DNSct+qkLqcxElPujBGGobmoXZafTs= 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=eOM/prtQ; arc=none smtp.client-ip=209.85.208.44 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="eOM/prtQ" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-6416133c627so755957a12.0 for ; Mon, 01 Dec 2025 13:29:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764624567; x=1765229367; 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; bh=S0Yn63rsGsd4Hj7X1d2hk85Oe6NspbG2sX3h25PNq3o=; b=eOM/prtQzCQkC3h2dB0feks+lWNJnMfgWJmuVHWXl6qTGv7Vmsizgz10yBKuH7+4Ek U08BtSGDiDI3VFnNy68nUFLLkZvg6m27DIlitsimj8YV5a2R2Fcq3cJC9H5OlMiw1XBA 4gDEdsg5udlNMRl2n8bWiRrUs9hXvCygKAxIijfPm6ZhP/U2SZUIhbP9QJGl/Reg5twr IKl3/yMI1ga1/EtaOWRV0D4jTi7ttgqvSnOq74eFwzXGS9bHNKkkYBKps8Vp0EPabH5m AxIlYKN7WqFBjeEQo/katzZ+qjOdI4Kz+6jzGqB7QDFdLQN+w36Z2H6nAJiIMtoW57iE 3ehg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764624567; x=1765229367; 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; bh=S0Yn63rsGsd4Hj7X1d2hk85Oe6NspbG2sX3h25PNq3o=; b=GXTERfRJnL3cvKt5wkkNWvAd+7isXinDO4WwZtuyL6ZstS6tnDOOsoBt1RoWDgWhsm gNlO+R2ff4ohLeWpcvwzjDPyuih5F5GE+Wxmk4US5bIUWbrfXlDsNrZuisYGgQEAZGFs KujeX4WuWHU6OqtF3z8MVCVqULTMUbKfwVyN3CZFGItf+ucALLwf2pDkKZfV8xX37f2n AUQPm8MnJqx7IV9t32rtEyl+OmRkfzkloy6erCd5OQFOKwgwN8Svcx7FE93+6DQsCbsn vzn8DWxTVxzIxOZqZ8INe45d1Y1N3yAaFyGW7C/A4nBJKbnERcMUam0cmFJG3TDsN8ls 4r7g== X-Forwarded-Encrypted: i=1; AJvYcCXYeTSGePDe7WC+2ssMnVD0rtrpFMGPmXri9U00s5LwwH9bdx7RYWRRSPDr6FoOLdlfUdgJo9H3itk4hKk=@vger.kernel.org X-Gm-Message-State: AOJu0YxT2agZB+G+gUmKt2rtu7lsnqLwmC2Ke2npUjZg5bGOsjH/IxJI PRXrl8GZNUlIxY4IcvYkFmbSZI7SLp3C7IaSgn7MMtohErMe0MTinPqw X-Gm-Gg: ASbGncua5lWU7tMRiVFzI2KMQyDOBU3gWooiF+TF1Hw8Rs35B/mKPO0omRgPHArhXM5 /qWX4SFQAp8AR0+LK3IDSk+bFt/KVdAccNiqhb8jV4KltJX8Dp0xeVxgRgh+Zm9OSFeiCCjl+EG gUpyzC8NT7ZZNzdOi8+gfY5/IZxxFXbQ9M379hJR8+Qr3uszZqg8axdrxM2wP+vNntPmIgB9052 BfzSf+Z2S+9m2OG0FD7B7ltn/p04x880BAfFB2ljG+M1FG0gDtgETEtOjA2bOrCNxQaftu0PJkd uc+nUPd8wo5heDcE4ey9MBiPbj4xrcg2wAj3Z66FdFReCqHwNU6cDZudl7xQI396nydReoCVkq/ D0rieMtPwomWKi/2VSTtWj+2LR6AeebIG7U2ryOUSsdHiju52zFMtBBSD9ZxFpfx4Q3afVLX+/b B4/5XUNLILDAVUlA== X-Google-Smtp-Source: AGHT+IGu1SlFFpvIYvIrQ+apMAxrKVb7zxXr0S8Sxm9iSmu6U7ZmdNyqWZGcEobHLqob2qXQsUOdtQ== X-Received: by 2002:a05:6402:5190:b0:645:e986:682f with SMTP id 4fb4d7f45d1cf-645e98668camr14681838a12.8.1764624566404; Mon, 01 Dec 2025 13:29:26 -0800 (PST) Received: from bhk ([165.50.39.229]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6475104fd7asm13519497a12.23.2025.12.01.13.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 13:29:26 -0800 (PST) From: Mehdi Ben Hadj Khelifa To: slava@dubeyko.com, glaubitz@physik.fu-berlin.de, frank.li@vivo.com, jack@suse.cz, sandeen@redhat.com, brauner@kernel.org, Slava.Dubeyko@ibm.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, david.hunter.linux@gmail.com, khalid@kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Mehdi Ben Hadj Khelifa , stable@vger.kernel.org Subject: [PATCH v3 2/2] hfsplus: ensure sb->s_fs_info is always cleaned up Date: Mon, 1 Dec 2025 23:23:07 +0100 Message-ID: <20251201222843.82310-3-mehdi.benhadjkhelifa@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201222843.82310-1-mehdi.benhadjkhelifa@gmail.com> References: <20251201222843.82310-1-mehdi.benhadjkhelifa@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: quoted-printable Content-Type: text/plain; charset="utf-8" When hfsplus was converted to the new mount api a bug was introduced by changing the allocation pattern of sb->s_fs_info. If setup_bdev_super() fails after a new superblock has been allocated by sget_fc(), but before hfsplus_fill_super() takes ownership of the filesystem-specific s_fs_info data it was leaked. Fix this by freeing sb->s_fs_info in hfsplus_kill_super(). Cc: stable@vger.kernel.org Fixes: 432f7c78cb00 ("hfsplus: convert hfsplus to use the new mount api") Reported-by: Viacheslav Dubeyko =20 Tested-by: Viacheslav Dubeyko Signed-off-by: Christian Brauner Signed-off-by: Mehdi Ben Hadj Khelifa Reviewed-by: Viacheslav Dubeyko --- fs/hfsplus/super.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 16bc4abc67e0..8734520f6419 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c @@ -328,8 +328,6 @@ static void hfsplus_put_super(struct super_block *sb) hfs_btree_close(sbi->ext_tree); kfree(sbi->s_vhdr_buf); kfree(sbi->s_backup_vhdr_buf); - call_rcu(&sbi->rcu, delayed_free); - hfs_dbg("finished\n"); } =20 @@ -629,7 +627,6 @@ static int hfsplus_fill_super(struct super_block *sb, s= truct fs_context *fc) out_unload_nls: unload_nls(sbi->nls); unload_nls(nls); - kfree(sbi); return err; } =20 @@ -688,10 +685,18 @@ static int hfsplus_init_fs_context(struct fs_context = *fc) return 0; } =20 +static void hfsplus_kill_super(struct super_block *sb) +{ + struct hfsplus_sb_info *sbi =3D HFSPLUS_SB(sb); + + kill_block_super(sb); + call_rcu(&sbi->rcu, delayed_free); +} + static struct file_system_type hfsplus_fs_type =3D { .owner =3D THIS_MODULE, .name =3D "hfsplus", - .kill_sb =3D kill_block_super, + .kill_sb =3D hfsplus_kill_super, .fs_flags =3D FS_REQUIRES_DEV, .init_fs_context =3D hfsplus_init_fs_context, }; --=20 2.52.0