Commit 02f3127
ntfs3: fix use-after-free of sbi->options in cmp_fnames
The root cause is that sbi->options points directly to fc->fs_private.
If fc->fs_private is freed while sbi still exists, sbi->options becomes
a dangling pointer.
This patch ensures that sbi->options is a separate copy of fc->fs_private
and duplicates nls_name if present. On superblock release or error,
sbi->options->nls_name and sbi->options are freed and sbi->options
is set to NULL to avoid any dangling pointer.
Reported-by: syzbot+d77c546c60db651a389c@syzkaller.appspotmail.com
Signed-off-by: YangWen <anmuxixixi@gmail.com>
[almaz.alexandrovich@paragon-software.com: remove syzbot logs from description]
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>1 parent 68f6bd1 commit 02f3127
1 file changed
Lines changed: 39 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
702 | 702 | | |
703 | 703 | | |
704 | 704 | | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
705 | 713 | | |
706 | 714 | | |
707 | 715 | | |
| |||
1203 | 1211 | | |
1204 | 1212 | | |
1205 | 1213 | | |
1206 | | - | |
| 1214 | + | |
| 1215 | + | |
1207 | 1216 | | |
1208 | 1217 | | |
1209 | 1218 | | |
| |||
1220 | 1229 | | |
1221 | 1230 | | |
1222 | 1231 | | |
1223 | | - | |
1224 | | - | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
1225 | 1249 | | |
1226 | 1250 | | |
1227 | 1251 | | |
1228 | 1252 | | |
1229 | 1253 | | |
1230 | 1254 | | |
1231 | | - | |
| 1255 | + | |
1232 | 1256 | | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
1237 | 1261 | | |
1238 | 1262 | | |
1239 | 1263 | | |
| |||
1645 | 1669 | | |
1646 | 1670 | | |
1647 | 1671 | | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
1648 | 1679 | | |
1649 | 1680 | | |
1650 | 1681 | | |
| |||
0 commit comments