Skip to content

Commit

Permalink
target: Don't return success from module_init() if setup fails
Browse files Browse the repository at this point in the history
If the call to core_dev_release_virtual_lun0() fails, then nothing
sets ret to anything other than 0, so even though everything is
torn down and freed, target_core_init_configfs() will seem to succeed
and the module will be loaded.  Fix this by passing the return value
on up the chain.

Signed-off-by: Roland Dreier <[email protected]>
Cc: [email protected]
Signed-off-by: Nicholas Bellinger <[email protected]>
  • Loading branch information
rolandd authored and Nicholas Bellinger committed Nov 1, 2012
1 parent dea5f09 commit 0d0f9df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/target/target_core_configfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3206,7 +3206,8 @@ static int __init target_core_init_configfs(void)
if (ret < 0)
goto out;

if (core_dev_setup_virtual_lun0() < 0)
ret = core_dev_setup_virtual_lun0();
if (ret < 0)
goto out;

return 0;
Expand Down

0 comments on commit 0d0f9df

Please sign in to comment.