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

RTEMS trac trac at rtems.org
Thu Apr 7 08:27:38 UTC 2022


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

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


Comment:

 In [changeset:"43119193ef0f3fef6bc01a391ccda8a97cfc149c/rtems"
 43119193/rtems]:
 {{{
 #!CommitTicketReference repository="rtems"
 revision="43119193ef0f3fef6bc01a391ccda8a97cfc149c"
 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.

 Fixes #4639
 }}}

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


More information about the bugs mailing list