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

RTEMS trac trac at rtems.org
Thu Apr 7 08:29:40 UTC 2022


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

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


Comment:

 In [changeset:"fc89cc76804499eba3f3bc4097b795a84f07571a/rtems"
 fc89cc7/rtems]:
 {{{
 #!CommitTicketReference repository="rtems"
 revision="fc89cc76804499eba3f3bc4097b795a84f07571a"
 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 #4638
 }}}

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


More information about the bugs mailing list