{"id":2229018,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2229018/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260427162020.49723-1-agarwal.vineet2006@gmail.com/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.1/projects/8/?format=json","name":"Linux ext4 filesystem development","link_name":"linux-ext4","list_id":"linux-ext4.vger.kernel.org","list_email":"linux-ext4@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260427162020.49723-1-agarwal.vineet2006@gmail.com>","date":"2026-04-27T16:20:20","name":"ext4: avoid BUG_ON() in ext4_get_inline_entry()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c5cfb207f2bd6adca5b95d17903b85494bdce7ba","submitter":{"id":93264,"url":"http://patchwork.ozlabs.org/api/1.1/people/93264/?format=json","name":"Vineet Agarwal","email":"agarwal.vineet2006@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260427162020.49723-1-agarwal.vineet2006@gmail.com/mbox/","series":[{"id":501687,"url":"http://patchwork.ozlabs.org/api/1.1/series/501687/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=501687","date":"2026-04-27T16:20:20","name":"ext4: avoid BUG_ON() in ext4_get_inline_entry()","version":1,"mbox":"http://patchwork.ozlabs.org/series/501687/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2229018/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2229018/checks/","tags":{},"headers":{"Return-Path":"\n <SRS0=JheF=C2=vger.kernel.org=linux-ext4+bounces-16127-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ext4@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Rq7lY7ac;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=jhef=c2=vger.kernel.org=linux-ext4+bounces-16127-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c09:e001:a7::12fc:5321\"\n arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Rq7lY7ac;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16127-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"Rq7lY7ac\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.216.49","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g486f0kMHz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 02:24:57 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g486d2DwTz4wHs\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 02:24:57 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4g486d29jKz4w1k; Tue, 28 Apr 2026 02:24:57 +1000 (AEST)","from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4g486X4Kdzz4wHs\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 02:24:52 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 78B363043FB9\n\tfor <patchwork-incoming@ozlabs.org>; Mon, 27 Apr 2026 16:20:58 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 0D538348883;\n\tMon, 27 Apr 2026 16:20:47 +0000 (UTC)","from mail-pj1-f49.google.com (mail-pj1-f49.google.com\n [209.85.216.49])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E56634F27F\n\tfor <linux-ext4@vger.kernel.org>; Mon, 27 Apr 2026 16:20:44 +0000 (UTC)","by mail-pj1-f49.google.com with SMTP id\n 98e67ed59e1d1-35fbca04006so5238185a91.1\n        for <linux-ext4@vger.kernel.org>;\n Mon, 27 Apr 2026 09:20:44 -0700 (PDT)","from vini ([2401:4900:8fca:e7b6:f223:6319:a79e:7616])\n        by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b5fab28e35sm307352625ad.64.2026.04.27.09.20.40\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Mon, 27 Apr 2026 09:20:43 -0700 (PDT)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1777307097; cv=pass;\n\tb=EmEgTOVs/bYrtWg0i7Z9lylINL50fMHMmluwf0FJeN09wT4TAXn/wJIcJKh+KLgPBK/bfcVdVu/WtzfnoakS0aQSpk1pntRFgJdI5KOVcyMJ7FAV25iv9ACaXTec0jWbR4Xeey0fNsx1uN10AYhYgu2dFRdM12ZRmqrV7wEtGw9plCLLHLOBQDHrQt/k2VD9GRL6NFPWsT2rrkf8NKMz229E/9yOeeyjOk0QGUzPXloEBB8FG7481emEvthFE9W1nCw1yyDIS8N2gXjkyeeus8e9Hn63C/tSbFaDHppzWEemKRYwRCCk9IBBWNe51nYJp+JeHFnn1bH3eCbtOR1eXQ==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777306846; cv=none;\n b=rbL/i4BcKNs8BhV3h+lN0uSWwIquZMw99sNss8ZF0THeMtEcVUy14p0LN0txgUS+iEnI20zcZWTaMhgZx1kdSXCQVs1BGPanve1Wdf8+frPHrwysqEypylYcpNSwfHIPwIWAKw6StXLW+LOrV/5xgqUpkXL5lboEMEXWTe886hM="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1777307097; c=relaxed/relaxed;\n\tbh=vxA6MQ5WVPMH6RM+iJNh6xzquK0b80JHF1z9HxjdUkE=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=LnpLlNFqGY6iXL+T0P/L2fTwhZi0FEjyzQSc1cW2APiWFG/amFcXhDmf9EeQh1FoZV2p5Fxc69J0Cunpbe+5SJXMT1gUES96F+1wXsTTIOOlGc+oZQcT3iFulxl/wbX8lXa9K5RIZQgvycz3/ChSzahTgBmttVxyIG+9Ioyplb3M8Xb0S/ocErjI4KH6vg7FJl6igpojNMcrq/Yz7sw8J/yuaKe90EBht1p19H3pfJFsECdFY5cuiDOB5R00t+RCkoM3zUqgK/x82/JhGFbXQhr2cCSz3S9XOisKdjVM0uJs0XqYR6nWGo9gt+UyCW3CevOesyLvkGnqFpNLhWiqww==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777306846; c=relaxed/simple;\n\tbh=WroDfzPqTURMv0iDm0VUPBMyksj/JhESZ+u0Y7pNEqM=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=n/Qwn107H4MM3abYVK0LZcLmY/43Nuza0/dokLpVsuRzF3C+nC+tDVmzJ3m+wVS4WrASmvgr+faiQnIBQMW4KbNoDliiMAnSqJYnk6QoV93T5wjTVhg+Q3P181SNGRc8f9fvrd5OLVC4YihNsRhOrABPZbBcjreXGvLSTK4labQ="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com; dkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Rq7lY7ac; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16127-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=Rq7lY7ac; arc=none smtp.client-ip=209.85.216.49"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1777306843; x=1777911643;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=vxA6MQ5WVPMH6RM+iJNh6xzquK0b80JHF1z9HxjdUkE=;\n        b=Rq7lY7ac3FJm1V+qUxlnkjICvMkJ8ez9vfJiCrYTnGvpFe99cKwZ/unM9qz3aU0Y0a\n         uid2n+rY9hLk3JwBi9Ug58REYW0e80VIpexqoxXMVFZInRtuHv1YzizxJL4BJASkUYuu\n         +pR5LPlApMiI+tUvg8nSEcVLA3ug/oTYqE8PREw3talb9h2K+S+461uaxj5RwU4HyGXP\n         D7B2g2VAgq6VSGbsEKZIFyta2aiYeMU2r3yi5o/yVcabhCga6n+M5zaPeKpnymjH/iK2\n         Dfut8/RL+r3lU9kIZuPVgUEHvNEZH3tjQyRj/TEfM70qcT2wegpAWVOqMtJHDi69Q1kY\n         WrfA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777306843; x=1777911643;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=vxA6MQ5WVPMH6RM+iJNh6xzquK0b80JHF1z9HxjdUkE=;\n        b=M47UiTd3HHcXL1NqYFp0kbJmAHaLlFU0CPUcbqyRztUg/LqRRm3DFd1sw5JsCF/xiF\n         CzSWlAOrTjoU2Ki7QKTaWfAx9Iltf1TJaFdKUyCR5pGE5Rh3UdZdqDjt2XsqotiwLk9y\n         FKJUNkfBAd/Gk/W3Sgd5a6ZuZdYadazbYCs50+aq7kFxS2N8E/nqJ1xGKyhdtr3s00ix\n         W/H/QJMIzFI5ZeJGxUx5QW5PUo4oyXTd35z/46rieNGP5hRsA2f2/D9Sb2FQWP6VfKUt\n         iUaHI/a50TIebw2CizBsL9lR2JgMDCKovpfqLyBTWbKtVN5RU2J9EeBCqCQdOeVDF7MY\n         xgoQ==","X-Gm-Message-State":"AOJu0YxCNijQiwXAlZ/Isq3ubeUEfuAg3YscWEI16CayF2DskK98BUeD\n\tXHSgyGLPbhDp+9+N3ssFaH8zA92RJ1KXqON8VHQM6jC+V/em6UOmXA8EaHCI4rPkMiuqcQ==","X-Gm-Gg":"AeBDieujy28cfs3mYMv2Z1lsxBx4qGGVxr5ViBPlMtNl4rPfUOstxtnVxif9xjIz8ab\n\tXTOTKMaPbYxjERJvIX9sADDzr4aUfE0kPQrC5TsUHeGtw4JiqhesKkHYpJsaoyfDgtWQz/8EaTV\n\tq7nER0fHU18shChtcqgQG5G63vSq07yK6ChC0tTBHe0hJh3z4uLfZeoO2nDw7zj0OJlxyTXnNpr\n\tZ9wENeLGBo3+sxX0Ie9kLJdKNUAqQn1agZpAVMy4Ar538uekyjW2IH6Pgw2zea3OCa4tIGNXqmC\n\tYWmZNHx493/QdrWGYo2nAZa7hRsbi+kNnWhtfJiEInG4q8jF4R2euZPLKFNZ+tajRct+gSCmI5A\n\trq/mXv4vN0SXbo0DKBjoFIfaJCJf8nqyESm6K70XAxJBLLM+ZcyIvk02Rco/qfP25NjkirzJ10l\n\tX1FB5UuIctix3JkuWC5Bt9XJrgLc22CfHoGyJEK65J","X-Received":"by 2002:a17:90a:d4f:b0:362:ef3a:a153 with SMTP id\n 98e67ed59e1d1-362ef3aa62cmr9842448a91.12.1777306843438;\n        Mon, 27 Apr 2026 09:20:43 -0700 (PDT)","From":"Vineet Agarwal <agarwal.vineet2006@gmail.com>","To":"linux-ext4@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org","Cc":"tytso@mit.edu,\n\tadilger.kernel@dilger.ca,\n\tlibaokun1@huawei.com,\n\tjack@suse.cz,\n\tojaswin@linux.ibm.com,\n\tritesh.list@gmail.com,\n\tyi.zhang@huawei.com,\n\tVineet Agarwal <agarwal.vineet2006@gmail.com>","Subject":"[PATCH] ext4: avoid BUG_ON() in ext4_get_inline_entry()","Date":"Mon, 27 Apr 2026 21:50:20 +0530","Message-ID":"<20260427162020.49723-1-agarwal.vineet2006@gmail.com>","X-Mailer":"git-send-email 2.54.0","Precedence":"bulk","X-Mailing-List":"linux-ext4@vger.kernel.org","List-Id":"<linux-ext4.vger.kernel.org>","List-Subscribe":"<mailto:linux-ext4+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ext4+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Spam-Status":"No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tFREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"},"content":"Corrupted inline directory metadata can cause offset to exceed\nthe inline data size through rec_len processing in\nempty_inline_dir().\n\nThis triggers BUG_ON() in ext4_get_inline_entry(), causing a\nkernel panic before ext4_check_dir_entry() can handle the\ncorruption gracefully.\n\nReplace BUG_ON() with a NULL return and handle the invalid\noffset in the caller by emitting a warning and exiting safely.\n\nThis prevents a kernel panic from corrupted inline directory\nmetadata.\n\nSigned-off-by: Vineet Agarwal <agarwal.vineet2006@gmail.com>\n---\n fs/ext4/inline.c | 9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)","diff":"diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c\nindex 8045e4ff270c..bca9936ed6d0 100644\n--- a/fs/ext4/inline.c\n+++ b/fs/ext4/inline.c\n@@ -1718,7 +1718,8 @@ ext4_get_inline_entry(struct inode *inode,\n {\n \tvoid *inline_pos;\n \n-\tBUG_ON(offset > ext4_get_inline_size(inode));\n+\tif (offset > ext4_get_inline_size(inode))\n+\t\treturn NULL;\n \n \tif (offset < EXT4_MIN_INLINE_DATA_SIZE) {\n \t\tinline_pos = (void *)ext4_raw_inode(iloc)->i_block;\n@@ -1773,6 +1774,12 @@ bool empty_inline_dir(struct inode *dir, int *has_inline_data)\n \twhile (offset < inline_len) {\n \t\tde = ext4_get_inline_entry(dir, &iloc, offset,\n \t\t\t\t\t   &inline_pos, &inline_size);\n+\t\tif (!de) {\n+\t\t\text4_warning(dir->i_sb,\n+\t\t\t\t     \"bad inline directory (dir #%llu) - invalid offset\",\n+\t\t\t\t     dir->i_ino);\n+\t\t\tgoto out;\n+\t\t}\n \t\tif (ext4_check_dir_entry(dir, NULL, de,\n \t\t\t\t\t iloc.bh, inline_pos,\n \t\t\t\t\t inline_size, offset)) {\n","prefixes":[]}