Repository navigation
Commit 82a10a8
USB: g_file_storage: fix use-after-free bug when closing files
This patch (as1231) fixes a use-after-free bug in g_file_storage. A
device's name may not be available after the device is unregistered,
even if the device structure itself is still allocated. Since
close_backing_file() prints a LUN's name for debugging, it shouldn't
be called after the LUN has been unregistered.
That whole area needed to be cleaned up; the backing files were
getting closed in a couple of different places. The patch fixes
things so that they get closed in just one place, as part of the
unbind procedure, immediately before the LUN is unregistered.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>1 parent c065c60 commit 82a10a8
1 file changed
Lines changed: 4 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
738 | 738 | | |
739 | 739 | | |
740 | 740 | | |
741 | | - | |
742 | 741 | | |
743 | 742 | | |
744 | 743 | | |
| |||
3593 | 3592 | | |
3594 | 3593 | | |
3595 | 3594 | | |
3596 | | - | |
3597 | | - | |
3598 | | - | |
| 3595 | + | |
| 3596 | + | |
| 3597 | + | |
3599 | 3598 | | |
3600 | | - | |
3601 | | - | |
3602 | 3599 | | |
3603 | 3600 | | |
3604 | 3601 | | |
| |||
3703 | 3700 | | |
3704 | 3701 | | |
3705 | 3702 | | |
3706 | | - | |
3707 | | - | |
3708 | | - | |
3709 | | - | |
3710 | | - | |
3711 | | - | |
3712 | | - | |
3713 | | - | |
3714 | 3703 | | |
3715 | 3704 | | |
3716 | 3705 | | |
| |||
3845 | 3834 | | |
3846 | 3835 | | |
3847 | 3836 | | |
| 3837 | + | |
3848 | 3838 | | |
3849 | 3839 | | |
3850 | 3840 | | |
| |||
4190 | 4180 | | |
4191 | 4181 | | |
4192 | 4182 | | |
4193 | | - | |
4194 | 4183 | | |
4195 | 4184 | | |
4196 | 4185 | | |
| |||
4284 | 4273 | | |
4285 | 4274 | | |
4286 | 4275 | | |
4287 | | - | |
4288 | 4276 | | |
4289 | 4277 | | |
4290 | 4278 | | |
0 commit comments