[RTEMS Project] #2353: Error in imfs memfile when device is full

RTEMS trac trac at rtems.org
Thu Apr 7 08:37:28 UTC 2022


#2353: Error in imfs memfile when device is full
---------------------------+----------------------------
 Reporter:  Joel Sherrill  |       Owner:  Needs Funding
     Type:  defect         |      Status:  closed
 Priority:  normal         |   Milestone:  Indefinite
Component:  fs             |     Version:  4.11
 Severity:  normal         |  Resolution:  fixed
 Keywords:                 |
---------------------------+----------------------------
Changes (by Christian Mauderer <christian.mauderer@…>):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"051778e9d602c2801d8100b0c9583c3d6b75310a/rtems"
 051778e/rtems]:
 {{{
 #!CommitTicketReference repository="rtems"
 revision="051778e9d602c2801d8100b0c9583c3d6b75310a"
 imfs: Fix index underrun when extending empty file

 Currently the following sequence causes a endless loop when extending an
 IMFS file:

 - Create a file with zero length and close it.
 - Make sure nearly no allocatable memory is left.
 - Open the file and write enough data into it that more than the
   remaining memory will be used.

 In that case when extending the IMFS file, the file currently need zero
 blocks. If allocating enough new blocks fails, the already allocated new
 blocks will be freed again.

 The comparison of block>=old_blocks that has been used prior to this
 patch compared two unsigned numbers. If old_blocks was zero, the
 comparison of these two numbers always evaluated to true.

 This patch frees the last block in a separate step to avoid this
 problem.

 Note: This patch is a backport of
 43119193ef0f3fef6bc01a391ccda8a97cfc149c from RTEMS master. It only
 contains the bugfix. Adding a test case has been skipped because that
 part of the patch didn't apply without problems and is not really
 relevant for fixing the bug.

 Fixes #2353
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/2353#comment:4>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list