Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libzfs: Fix missing va_end call on ENOSPC and EDQUOT cases #4901

Closed
wants to merge 2 commits into from

Conversation

ColinIanKing
Copy link
Contributor

The switch statement in function zfs_standard_error_fmt for the
ENOSPC and EDQUOT cases returns immediately and unlike all other
cases in the switch this does not perform the va_end call.

Perform a break which ends up calling va_end rather than retutning
immediately.

Found by static analysis with CoverityScan 0.8.5

Closes #4900

Signed-off-by: Colin Ian King [email protected]

The switch statement in function zfs_standard_error_fmt for the
ENOSPC and EDQUOT cases returns immediately and unlike all other
cases in the switch this does not perform the va_end call.

Perform a break which ends up calling va_end rather than retutning
immediately.

Found by static analysis with CoverityScan 0.8.5

Closes openzfs#4900

Signed-off-by: Colin Ian King <[email protected]>
Currently there is no file open failure check when opening
/etc/dfs/sharetab.  The NULL hdl->libzfs_sharelib file pointer
will lead to a null pointer deference when this is closed, for
example, in the case where libzfs_core_init() fails and the
subsequent cleanup closes hdl->libzfs_sharelib.

Fix this by checking for an open failure and performing the
necessary clean up if it fails and return NULL.

Found by static analysis with CoverityScan 0.8.5

Closes openzfs#4902

Signed-off-by: Colin Ian King <[email protected]>
(void) fclose(hdl->libzfs_mnttab);
free(hdl);
return (NULL);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably better to remove this entirely from libzfs_init() / libzfs_close(). It's only used in It's only ever used in is_shared() and it would be better to just handle the open/close there.

@behlendorf
Copy link
Contributor

39447c Fix missing va_end call... - LGTM

@behlendorf
Copy link
Contributor

Merged as:

b264d9b libzfs: Fix missing va_end call on ENOSPC and EDQUOT cases

@behlendorf behlendorf closed this Jul 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants