sio: do not follow symlinks

This commit is contained in:
Thomas Schoebel-Theuer 2020-07-28 18:26:01 +02:00
parent 3883b2bf10
commit a5576d5ad3
1 changed files with 7 additions and 3 deletions

View File

@ -625,7 +625,7 @@ static int sio_switch(struct sio_brick *brick)
int status = 0; int status = 0;
if (brick->power.button) { if (brick->power.button) {
int flags = O_CREAT | O_RDWR | O_LARGEFILE; int flags = O_CREAT | O_NOFOLLOW | O_RDWR | O_LARGEFILE;
int index; int index;
if (brick->power.led_on) if (brick->power.led_on)
@ -640,8 +640,12 @@ static int sio_switch(struct sio_brick *brick)
output->mf = mapfree_get(path, flags); output->mf = mapfree_get(path, flags);
if (unlikely(IS_ERR(output->mf))) { if (unlikely(IS_ERR(output->mf))) {
MARS_ERR("could not open file = '%s' flags = %d\n", path, flags); status = PTR_ERR(output->mf);
status = -ENOENT; output->mf = NULL;
MARS_ERR("open '%s' flags=%d status=%d\n",
path,
flags,
status);
goto done; goto done;
} }