Skip to content

Commit 65221a9

Browse files
committed
multirom: Fix /data/media/0 media linkage for SDCardFS
* In a MultiROM environment, /data is owned by the booted secondary ROM, specifically it can even be part of an external MicroSD (for example with EXT4) * By using a ROM supporting SDCardFS, the interal media storage will be accessed through its driver, but the fact /data/media/0 could be used under specific conditions means the /data/media mounts used by the emulated storage loop through: - /data/media (external ROM) - /data/media/0 (internal storage) * SDCardFS prevents "cross-device" linkage by returning -EXDEV, breaking internal storage access * Always use the proper /data/media path on newer APIs to avoid any cross-device linkage of internal storage, and preserve old handling up to API 22 (Android 5.1) Change-Id: Ib49db68eede289d3943b9537d542eef5082e3118 Signed-off-by: Adrian DC <[email protected]>
1 parent e4acabe commit 65221a9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

multirom.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1771,12 +1771,17 @@ int multirom_create_media_link(struct multirom_status *s)
17711771
if(!media_new) from = 0;
17721772
else from = 1;
17731773
}
1774-
else if(api_level >= 17)
1774+
else if(api_level <= 22)
17751775
{
17761776
from = 0;
17771777
if(!media_new) to = 3;
17781778
else to = 2;
17791779
}
1780+
else
1781+
{
1782+
from = 0;
1783+
to = 2;
1784+
}
17801785

17811786
ERROR("Making media dir: api %d, media_new %d, %s to %s\n", api_level, media_new, paths[from], paths[to]);
17821787
if(mkdir_recursive(paths[to], 0775) == -1)

0 commit comments

Comments
 (0)