kernel/fd: Add missing NULL checks in user_io routines.
I am not sure how this path could be hit besides having O_APPEND set on a socket, which appears to be possible, though I don't know what purpose that would serve. Tested by adding these two lines between the sleep() and close() in the in-tree tcp_connection_test: fcntl(fd, F_SETFL, O_APPEND); write(fd, "Hello", 5); Before this commit, the above lines cause a KDL. May fix #18133, but I don't presently have access to the reproduction setup described in that ticket.
This commit is contained in:
parent
d1aa4a4295
commit
997adc7e61
@ -747,7 +747,7 @@ common_user_io(int fd, off_t pos, void* buffer, size_t length, bool write)
|
||||
}
|
||||
|
||||
bool movePosition = false;
|
||||
if (pos == -1) {
|
||||
if (pos == -1 && descriptor->ops->fd_seek != NULL) {
|
||||
pos = descriptor->pos;
|
||||
movePosition = true;
|
||||
}
|
||||
@ -806,7 +806,7 @@ common_user_vector_io(int fd, off_t pos, const iovec* userVecs, size_t count,
|
||||
}
|
||||
|
||||
bool movePosition = false;
|
||||
if (pos == -1) {
|
||||
if (pos == -1 && descriptor->ops->fd_seek != NULL) {
|
||||
pos = descriptor->pos;
|
||||
movePosition = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user