diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2013-04-01 03:40:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-02 13:09:01 -0400 |
commit | 2dc958fa2fe6987e7ab106bd97029a09a82fcd8d (patch) | |
tree | c260602e6d7233a0e05f252c0dfcb4dae587b9d2 /ipc | |
parent | 118c9a45fdacc6fe57910fa1d048e2d5bbc193f4 (diff) |
ipc: set msg back to -EAGAIN if copy wasn't performed
Make sure that msg pointer is set back to error value in case of
MSG_COPY flag is set and desired message to copy wasn't found. This
garantees that msg is either a error pointer or a copy address.
Otherwise the last message in queue will be freed without unlinking from
the queue (which leads to memory corruption) and the dummy allocated
copy won't be released.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/msg.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -872,6 +872,7 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, | |||
872 | goto out_unlock; | 872 | goto out_unlock; |
873 | break; | 873 | break; |
874 | } | 874 | } |
875 | msg = ERR_PTR(-EAGAIN); | ||
875 | } else | 876 | } else |
876 | break; | 877 | break; |
877 | msg_counter++; | 878 | msg_counter++; |