From nobody Mon Sep 28 13:17:35 2026 Received: from smtpbg150.qq.com (smtpbg150.qq.com [18.132.163.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF35A357A25 for ; Fri, 21 Aug 2026 07:36:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.132.163.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787297771; cv=none; b=QyfwgHNLFCsverGlve2Ky/EK9IoqvMzOawje7znM4PRG1tWFpPAe3dGw0BnToN7VOkhQaSD6SmVBdZbRs2QtgDE72qPv69BHydmVuiWpuIW887jGEtv6NegLLF3RzFRHBXrAy3iaiuub70hr50oWEenVGEnyXu0wXXukVOFH6CU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787297771; c=relaxed/simple; bh=54CYfH2xaF8On3WK4CWx/qmlDiSvVGaE7bwb31vSoKg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=UrXaZw71tAxKgsshLLhNPt85ZGeMIbDRRIQSJ7Hi5qVhsxoHHRBBwgUfZZpak4RjLovGuaTffWnHlH/WcdqJ9xUT1R0saruwI1Udc9VFNSh/wsfLd43pARUUOaXGyTUTJussQPVNrMrW08DCtq15uclsJWdr4N1r4BoMuhgv5Zg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b=PraKBhsB; arc=none smtp.client-ip=18.132.163.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b="PraKBhsB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1787297641; bh=oReXDUjLYpZ2tSAEkM59NpAPWcXFw9bugP+mGnhvZbA=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=PraKBhsBd9kySRv983RWkBiOGTBQxU1QUb0ge+d3RmbhhRWRPOuT/gFl4v8ezgULR xKpjvPFpoVVCjXmGvquZUYKDiKNd32TC4JvbAoHi2WiNWPPv/XVCba9cQ13U00BE1R 0J2ouvjb6GIj3bb/YHxOFp+UMA/FKJ36g7wARFuo= X-QQ-mid: zesmtpsz7t1787297626t921b9880 X-QQ-Originating-IP: vzMFvoqTJa7YS4I5CucPFyK3mpDi/nDXNkrrF7JCEb4= Received: from uniontech.com ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 21 Aug 2026 15:33:44 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 5778898843765619100 EX-QQ-RecipientCnt: 5 From: Yichong Chen To: a.hindborg@kernel.org Cc: leitao@debian.org, pantelis.antoniou@konsulko.com, linux-kernel@vger.kernel.org, Yichong Chen Subject: [PATCH] configfs: avoid committing failed binary attribute writes Date: Fri, 21 Aug 2026 15:33:41 +0800 Message-Id: <20260821073341.2006955-1-chenyichong@uniontech.com> X-Mailer: git-send-email 2.20.1 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 X-QQ-SENDSIZE: 520 Feedback-ID: zesmtpsz:uniontech.com:qybglogicsvrgz:qybglogicsvrgz3a-0 X-QQ-XMAILINFO: NcfXIs+Ms1qHAer3LNnqBQImrErwmDdvPx/810S8hTWncoQxHGGURkh5 N2g9iWMc7YnYMtIe4uGAbIlwYPrUc/4wX2YpRZ+OSXKABiaH9Qw31MY41xqvy6fnDm/xeCU rvpTc7hPvOl2ZCLtI5KKAQ/mkH6CDvlItU+v9LgW+p7TUCvfiYyAQLsoVz49Hw0/dqDcicX oDcsaccf37hQQijfE9+xMkdF6bLtUjPygt+ZUqWAZ/fQz7wMuiQK8Tw4KWcewsdt0w7WlS/ 52jc+hI+/tOzcWuFthnEMTQy57za4gSUJI/dxiLv5SC6xZ4r3ffWoIC1vOsPrPr50eyCHLd ebkFk6ewMbgeImNRdIIyIUPfPPveC8yAOMqOhIgtOPfPYuD2sWtgKtOZpPBRl7xmMeudh5u FWe9RWJVJHT6/cHWuUtfNPtI6naqERFjeQAuCQN/UrDLJFJzzCC+25vj1iE+o1ajl2I1qIG gOAFoPMnadIQRc+lcXcRBfMSRYajlrpsR9iUWHOeOpVxSslhU/zp9IOThbsqVJN2a/PdbZy Zj8PRXzmLBPqCqIOPEGqn0lyMdHcWj32NEFoPHwAez49VNIPqrpC8FEgg/wPTg1073VqTxH 8e+B/ngbIsUtTdZK+acZlGTbZafpiEu6jNsKG2Q6gVz51jzfx2rbrOH4uVzDks9xRLMOZSg dc6CBTi7mT+wIwzOo2vbiWagpSF7miB/9wIVCsBtokepxiqV+AzSAlVWd/sIXhhWz4zTWIZ ilUlmvJTRz23T6FfiHd2iCDTp1KGdghnURG/cSNE2nnmr22wYoRiwC5wiZZlwq5gUCYS5ed yRjYXDT/qqY22zryLo/XGfF/96mj3S+YZ6xEEHjedK3PGBJcqLv8J3dB78bJuWZq9fll3GA g2+VrWWWC33oaNJMPrUvyS0twtfynyBWjqAUVDeaCEhn1Jlj/FoFO3LJCz8EKaWiUMSuzmI GJdYCuaR2n6FbFVbO/uCO3uzV59mMrkczBJhacMgkqu0U161j3NzeaFpe0EjmzB4lPHvHLR BhfQbMuwRpLqJ2RJWL X-QQ-XMRINFO: NI4Ajvh11aEjEMj13RCX7UuhPEoou2bs1g== X-QQ-RECHKSPAM: 0 Content-Type: text/plain; charset="utf-8" Configfs binary attributes buffer write data and submit the final buffer on release. The write path sets write_in_progress before it knows whether the current write can be accepted. If the first write fails before any data is copied, for example because the write exceeds cb_max_size or the buffer allocation fails, release still treats the file as having a pending binary write and calls the attribute write callback with the current buffer state. For ACPI configfs, an oversized first write to the aml attribute can therefore fail with -EFBIG and then oops on close when acpi_table_aml_write() is called with a NULL buffer. Only mark the binary attribute as having a write in progress after data has actually been copied into the buffer. Fixes: 03607ace807b ("configfs: implement binary attributes") Signed-off-by: Yichong Chen Reviewed-by: Breno Leitao --- fs/configfs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/configfs/file.c b/fs/configfs/file.c index a48cece775a3..c55634931c05 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c @@ -249,7 +249,6 @@ static ssize_t configfs_bin_write_iter(struct kiocb *io= cb, len =3D -ETXTBSY; goto out; } - buffer->write_in_progress =3D true; =20 /* buffer grows? */ end_offset =3D iocb->ki_pos + iov_iter_count(from); @@ -281,6 +280,8 @@ static ssize_t configfs_bin_write_iter(struct kiocb *io= cb, =20 len =3D copy_from_iter(buffer->bin_buffer + iocb->ki_pos, buffer->bin_buffer_size - iocb->ki_pos, from); + if (len > 0) + buffer->write_in_progress =3D true; iocb->ki_pos +=3D len; out: mutex_unlock(&buffer->mutex); --=20 2.51.0