Message ID | 20230103234616.never.915-kees@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4872599wrt; Tue, 3 Jan 2023 15:48:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXs+9z8vqQpQ+mX8jOm1Vp6WSwshm56iYqV48gF08IHnNGJNJakkNv7/Ig5Ft2BMrAHFPj+M X-Received: by 2002:a05:6402:249e:b0:472:c7fe:475e with SMTP id q30-20020a056402249e00b00472c7fe475emr44308724eda.27.1672789708871; Tue, 03 Jan 2023 15:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672789708; cv=none; d=google.com; s=arc-20160816; b=GCIvBSS4wv1+wPT3CvSjM4E8CnIOjLLtGMn1QSUYG065suMpbg35fys4FMU2RePnGJ fDK0zvmGupd5QFc269pv30cqV1pgwvU87HebFsiaf2c9Jrlk2ieLsacvZB/DleMqd9RB QHR9CRb3Q/ze02CzGEG3xDramQ7b28Jz2KNizhJYPh7DVJLeWK5vA51D70r7eS8VJAGs SNUMIm4GyshgV/6nPoPROv9ALIkjO3i23K1/Batv9vc0PPfODoB6aOZ5INlMDTa99FY3 hJpABMKRhlh0VUWIWAa+JTUqXiMAnmOzpX73Mz3rvfMRItIQo0SkK9N2NGwsCOXoDnCv 2klA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=euRwx6QF/OV6RpXiKr7BIdAc00ukRSAUiOkpbL7iCKU=; b=fnI2i95qx8mmkP5bweIYqRJ3vRRRnTdfJc/LnZbrwcCjVZHzCeAXY56otoALhRP8uZ 2FHEeTG8WErtOu9wN5khd7Gu/1X7j/X+17K32K9o1ipiFLu+/jPfAqEu6jh7kXhokIv7 Qu7x+5pP42vzanJrY/DU2CERlsXW18mXgR1AjUAWXmXe69bA+ljwjYiNlBNnKFWLwMEP pAKccFvB6yVnZZTW/q+T0h3uiaeZ4hGrvxBAZtGGsKnVCH70QVvW5Jt0XvOBiOx2ZiVI 9m9mw+nwaZvrSkkaKcZCXgHiUL3SkcJLhao/FqyM29GNbDrLaYae7UhYArJIH4l8HsA0 5bbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XjKNtQpN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a056402440b00b0048ea26ce021si5719864eda.68.2023.01.03.15.48.05; Tue, 03 Jan 2023 15:48:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XjKNtQpN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230367AbjACXqa (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Tue, 3 Jan 2023 18:46:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230352AbjACXq0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 3 Jan 2023 18:46:26 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58CE1393 for <linux-kernel@vger.kernel.org>; Tue, 3 Jan 2023 15:46:25 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id d9so17536336pll.9 for <linux-kernel@vger.kernel.org>; Tue, 03 Jan 2023 15:46:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=euRwx6QF/OV6RpXiKr7BIdAc00ukRSAUiOkpbL7iCKU=; b=XjKNtQpNLJ8aqo7xjHoll4+DdwZrxKRZXlYp6JqqXGXYzu6avm3dJLbOsMQuy89EdG OIWBFWbEMo8JNz8qp4S5dPsIzqCFDBkzKAK65Fd3iUKktYjLfZgxonKbHUMSqauJ6Kyx kSt3wX07D1moGHhO+wh5Wh7DHypEKw3VjuYS0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=euRwx6QF/OV6RpXiKr7BIdAc00ukRSAUiOkpbL7iCKU=; b=WgWoUAH03MaeeyFG1fWWl6puGNk7O4qlNIOx/zfT0TWFgi+tluXzY+Wl3jJ8K3VPj8 A0sjcNift34lbkeFa7jof9HHU6l7Q6KW0dJl5v79+ADInOq8V70uoDNO45YHXQemBF1f cAHLTGzYcYiVbRWOJmb2pcBFlCuntaP7Q0h009RtpWSqfnQ7j0YNP/Txg4QbMG+/4d2k 5z4yOYcy+QRYZh+dndez6/V5cE64sENypHMfza3OcVrpKPVNiwyEqpkYRbTQOi620vAV h93plsqCgNz0igB4XkD+8BP2BFbkMBClO68xCU9AN4GgXYIEg26NV9OUnSge9qPjMIMT Jj1w== X-Gm-Message-State: AFqh2kqKLYuWkfI2AxF+Fb+AEr7rkzVmaM/fPlq6mJnvfkiL21Sicz+a 5yP2DQlBLUjFb8whmlybpmKqEw== X-Received: by 2002:a05:6a20:bf19:b0:af:dc62:8abd with SMTP id gc25-20020a056a20bf1900b000afdc628abdmr50713685pzb.0.1672789584914; Tue, 03 Jan 2023 15:46:24 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a23-20020aa794b7000000b00582729b7032sm4793752pfl.97.2023.01.03.15.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 15:46:24 -0800 (PST) From: Kees Cook <keescook@chromium.org> To: tytso@mit.edu Cc: Kees Cook <keescook@chromium.org>, Andreas Dilger <adilger.kernel@dilger.ca>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: [PATCH] ext4: Fix function prototype mismatch for ext4_feat_ktype Date: Tue, 3 Jan 2023 15:46:20 -0800 Message-Id: <20230103234616.never.915-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1630; h=from:subject:message-id; bh=EPPA4fAFZuWB5pdzvby7FTtYsOyM2XQPaphR85N5tMQ=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBjtL5MF54NCvmDQY0Dd7rNnLX1L0GvWxEKudKalV75 pS6Nr92JAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCY7S+TAAKCRCJcvTf3G3AJjndD/ 47MN61Dsc0UtJKECZp7gwKoY73Pw3qTWJzGhEO8zpglulKrzEkZeTmPqhCIiQ7U8fC9E6hyPMOvGkR JL3zryAjWLo9eGZSahA3Hd7tbnnwYZ/ZF2iKqEhnkRF/dnXpC5Pa1QozMpdidQ6rZO5/v9dnLQDW0w Xi98Dw0EjbPMvKQnM7L+uJoYyyiI7kBjsYAePwWSerOGNflmjK7jj+RLCAZgdRUMgPdvSSm/BCLYqg kDeTUx8FPOHowELmcRgHBexBBzvFKb65KXlUBj4hndW/bMUjLR2s9VTm09L3DeILJrL9iH6sNLRyjL ADKZtflw7g7rUxaQX3RIK5ML2pcj/272P3g/5uNtCyBkOkNgKWsAqedOsIP4goqWAI0QCMsKY3RIm2 7du4nSWz7sQdkpIIVqNJfHoKbtKKrkjwN552ikIhXKWsDOsjDzFzi0VbHikZiWupfdcX3Yl8JIeKvW BpVAP83s1pbJS54o4CwGMT+1M/K0iX1xNpYhaieiJfX6qePvsAdYLNmi2KmdDrPVNmDv7Lp8tCudP8 NKdrr8dUolvQoy3K9oBsuxGUcStGfPSaiMfyIhuAuGaPJbXjLMpTjkygqQBdEmRgYh3HSnPqeLNyQi EeXk5XyMYgH2WqJLhtBB1KTJuOLGoSuBDmmUvEPBF5znyJD3023rRY+4SY8w== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754047142125538395?= X-GMAIL-MSGID: =?utf-8?q?1754047142125538395?= |
Series |
ext4: Fix function prototype mismatch for ext4_feat_ktype
|
|
Commit Message
Kees Cook
Jan. 3, 2023, 11:46 p.m. UTC
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
indirect call targets are validated against the expected function
pointer prototype to make sure the call target is valid to help mitigate
ROP attacks. If they are not identical, there is a failure at run time,
which manifests as either a kernel panic or thread getting killed.
ext4_feat_ktype was setting the "release" handler to "kfree", which
doesn't have a matching function prototype. Add a simple wrapper
with the correct prototype.
This was found as a result of Clang's new -Wcast-function-type-strict
flag, which is more sensitive than the simpler -Wcast-function-type,
which only checks for type width mismatches.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
fs/ext4/sysfs.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Comments
On Tue, Jan 03, 2023 at 03:46:20PM -0800, Kees Cook wrote: > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), > indirect call targets are validated against the expected function > pointer prototype to make sure the call target is valid to help mitigate > ROP attacks. If they are not identical, there is a failure at run time, > which manifests as either a kernel panic or thread getting killed. > > ext4_feat_ktype was setting the "release" handler to "kfree", which > doesn't have a matching function prototype. Add a simple wrapper > with the correct prototype. > > This was found as a result of Clang's new -Wcast-function-type-strict > flag, which is more sensitive than the simpler -Wcast-function-type, > which only checks for type width mismatches. > > Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> > --- > fs/ext4/sysfs.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c > index d233c24ea342..83cf8b5afb54 100644 > --- a/fs/ext4/sysfs.c > +++ b/fs/ext4/sysfs.c > @@ -491,6 +491,11 @@ static void ext4_sb_release(struct kobject *kobj) > complete(&sbi->s_kobj_unregister); > } > > +static void ext4_kobject_release(struct kobject *kobj) > +{ > + kfree(kobj); > +} > + > static const struct sysfs_ops ext4_attr_ops = { > .show = ext4_attr_show, > .store = ext4_attr_store, > @@ -505,7 +510,7 @@ static struct kobj_type ext4_sb_ktype = { > static struct kobj_type ext4_feat_ktype = { > .default_groups = ext4_feat_groups, > .sysfs_ops = &ext4_attr_ops, > - .release = (void (*)(struct kobject *))kfree, > + .release = ext4_kobject_release, > }; > > void ext4_notify_error_sysfs(struct ext4_sb_info *sbi) > -- > 2.34.1 >
On Tue, Jan 03, 2023 at 03:46:20PM -0800, Kees Cook wrote: > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), > indirect call targets are validated against the expected function > pointer prototype to make sure the call target is valid to help mitigate > ROP attacks. If they are not identical, there is a failure at run time, > which manifests as either a kernel panic or thread getting killed. > > ext4_feat_ktype was setting the "release" handler to "kfree", which > doesn't have a matching function prototype. Add a simple wrapper > with the correct prototype. > > This was found as a result of Clang's new -Wcast-function-type-strict > flag, which is more sensitive than the simpler -Wcast-function-type, > which only checks for type width mismatches. > > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > fs/ext4/sysfs.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c > index d233c24ea342..83cf8b5afb54 100644 > --- a/fs/ext4/sysfs.c > +++ b/fs/ext4/sysfs.c > @@ -491,6 +491,11 @@ static void ext4_sb_release(struct kobject *kobj) > complete(&sbi->s_kobj_unregister); > } > > +static void ext4_kobject_release(struct kobject *kobj) > +{ > + kfree(kobj); > +} > + > static const struct sysfs_ops ext4_attr_ops = { > .show = ext4_attr_show, > .store = ext4_attr_store, > @@ -505,7 +510,7 @@ static struct kobj_type ext4_sb_ktype = { > static struct kobj_type ext4_feat_ktype = { > .default_groups = ext4_feat_groups, > .sysfs_ops = &ext4_attr_ops, > - .release = (void (*)(struct kobject *))kfree, > + .release = ext4_kobject_release, For consistency, maybe call this ext4_feat_release? So ext4_sb_ktype would have ext4_sb_release, and ext4_feat_ktype would have ext4_feat_release. I'm also surprised that this wasn't found earlier. Is it possible that CFI does not actually distinguish between the two function prototypes here? - Eric
On Tue, Jan 03, 2023 at 03:46:20PM -0800, Kees Cook wrote: > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), > indirect call targets are validated against the expected function > pointer prototype to make sure the call target is valid to help mitigate > ROP attacks. If they are not identical, there is a failure at run time, > which manifests as either a kernel panic or thread getting killed. > > ext4_feat_ktype was setting the "release" handler to "kfree", which > doesn't have a matching function prototype. Add a simple wrapper > with the correct prototype. > > This was found as a result of Clang's new -Wcast-function-type-strict > flag, which is more sensitive than the simpler -Wcast-function-type, > which only checks for type width mismatches. > > Signed-off-by: Kees Cook <keescook@chromium.org> Build-tested-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Just for the record, this is the warning Clang reports without this patch: fs/ext4/sysfs.c:508:13: warning: cast from 'void (*)(const void *)' to 'void (*)(struct kobject *)' converts to incompatible function type [-Wcast-function-type-strict] Thanks -- Gustavo > --- > fs/ext4/sysfs.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c > index d233c24ea342..83cf8b5afb54 100644 > --- a/fs/ext4/sysfs.c > +++ b/fs/ext4/sysfs.c > @@ -491,6 +491,11 @@ static void ext4_sb_release(struct kobject *kobj) > complete(&sbi->s_kobj_unregister); > } > > +static void ext4_kobject_release(struct kobject *kobj) > +{ > + kfree(kobj); > +} > + > static const struct sysfs_ops ext4_attr_ops = { > .show = ext4_attr_show, > .store = ext4_attr_store, > @@ -505,7 +510,7 @@ static struct kobj_type ext4_sb_ktype = { > static struct kobj_type ext4_feat_ktype = { > .default_groups = ext4_feat_groups, > .sysfs_ops = &ext4_attr_ops, > - .release = (void (*)(struct kobject *))kfree, > + .release = ext4_kobject_release, > }; > > void ext4_notify_error_sysfs(struct ext4_sb_info *sbi) > -- > 2.34.1 >
On Wed, Jan 04, 2023 at 12:23:44AM +0000, Eric Biggers wrote: > I'm also surprised that this wasn't found earlier. Is it possible that CFI does > not actually distinguish between the two function prototypes here? > It's because this code is only reached when ext4 is a loadable module and it is being unloaded. I can reproduce the CFI failure by doing that. In addition to the naming tweak I requested, can you also add Fixes and Cc stable tags? By the way, here's the log from the CFI failure I got: [ 16.412498] CFI failure at kobject_put+0xbb/0x1b0 (target: kfree+0x0/0x180; expected type: 0x7c4aa698) [ 16.413716] invalid opcode: 0000 [#1] PREEMPT SMP [ 16.414299] CPU: 2 PID: 179 Comm: rmmod Tainted: G T 6.2.0-rc2 #28 [ 16.415223] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.1-1-1 04/01/2014 [ 16.416383] RIP: 0010:kobject_put+0xbb/0x1b0 [ 16.416926] Code: df e8 f9 03 00 00 4d 85 e4 74 24 49 83 3c 24 00 74 1d 0f 1f 44 00 00 48 89 df 4d 8b 1c 24 41 ba 68 59 b5 9 [ 16.419199] RSP: 0018:ffffc90000283e20 EFLAGS: 00010a13 [ 16.419842] RAX: 0000000000000000 RBX: ffff88800436c9c0 RCX: 0000000000000000 [ 16.420719] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88800436c9c0 [ 16.421595] RBP: ffffc90000283e40 R08: 0000000000000000 R09: 0000000000000000 [ 16.422465] R10: 0000000017461662 R11: ffffffff81216a20 R12: ffffffffa00f9510 [ 16.423330] R13: 0000000000000000 R14: ffff88800436ca80 R15: ffff888007643950 [ 16.424207] FS: 00007f7bf573f740(0000) GS:ffff88807dd00000(0000) knlGS:0000000000000000 [ 16.425188] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 16.425814] CR2: 0000561eb661f818 CR3: 00000000074c9000 CR4: 00000000003506e0 [ 16.426574] Call Trace: [ 16.426862] <TASK> [ 16.427098] ext4_exit_sysfs+0x14/0x60 [ext4] [ 16.427604] cleanup_module+0x67/0xedb [ext4] [ 16.428099] __se_sys_delete_module+0x22d/0x3e0 [ 16.428593] ? syscall_enter_from_user_mode+0x2a/0x1d0 [ 16.429142] ? syscall_enter_from_user_mode+0x2a/0x1d0 [ 16.429694] __x64_sys_delete_module+0x11/0x20 [ 16.430173] do_syscall_64+0x53/0xb0 [ 16.430562] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 16.431151] RIP: 0033:0x7f7bf584ccfb [ 16.431544] Code: 73 01 c3 48 8b 0d 8d f0 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 8 [ 16.433517] RSP: 002b:00007fff7d959068 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0 [ 16.434327] RAX: ffffffffffffffda RBX: 0000561eb6615750 RCX: 00007f7bf584ccfb [ 16.435090] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 0000561eb66157b8 [ 16.435852] RBP: 0000000000000000 R08: 1999999999999999 R09: 0000000000000000 [ 16.436617] R10: 00007f7bf58c2ac0 R11: 0000000000000206 R12: 0000000000000000 [ 16.437472] R13: 00007fff7d9592d0 R14: 00007fff7d959d80 R15: 0000561eb66152a0 [ 16.438307] </TASK> [ 16.438552] Modules linked in: ext4(-) crc32c_generic mbcache crc16 jbd2 [ 16.439321] ---[ end trace 0000000000000000 ]--- [ 16.439829] RIP: 0010:kobject_put+0xbb/0x1b0 [ 16.440294] Code: df e8 f9 03 00 00 4d 85 e4 74 24 49 83 3c 24 00 74 1d 0f 1f 44 00 00 48 89 df 4d 8b 1c 24 41 ba 68 59 b5 9 [ 16.442310] RSP: 0018:ffffc90000283e20 EFLAGS: 00010a13 [ 16.442960] RAX: 0000000000000000 RBX: ffff88800436c9c0 RCX: 0000000000000000 [ 16.443719] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88800436c9c0 [ 16.444472] RBP: ffffc90000283e40 R08: 0000000000000000 R09: 0000000000000000 [ 16.445231] R10: 0000000017461662 R11: ffffffff81216a20 R12: ffffffffa00f9510 [ 16.446012] R13: 0000000000000000 R14: ffff88800436ca80 R15: ffff888007643950 [ 16.446779] FS: 00007f7bf573f740(0000) GS:ffff88807dd00000(0000) knlGS:0000000000000000 [ 16.447658] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 16.448276] CR2: 0000561eb661f818 CR3: 00000000074c9000 CR4: 00000000003506e0
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c index d233c24ea342..83cf8b5afb54 100644 --- a/fs/ext4/sysfs.c +++ b/fs/ext4/sysfs.c @@ -491,6 +491,11 @@ static void ext4_sb_release(struct kobject *kobj) complete(&sbi->s_kobj_unregister); } +static void ext4_kobject_release(struct kobject *kobj) +{ + kfree(kobj); +} + static const struct sysfs_ops ext4_attr_ops = { .show = ext4_attr_show, .store = ext4_attr_store, @@ -505,7 +510,7 @@ static struct kobj_type ext4_sb_ktype = { static struct kobj_type ext4_feat_ktype = { .default_groups = ext4_feat_groups, .sysfs_ops = &ext4_attr_ops, - .release = (void (*)(struct kobject *))kfree, + .release = ext4_kobject_release, }; void ext4_notify_error_sysfs(struct ext4_sb_info *sbi)