[PATCH 3/4] ipc: handle MSG_PEEK_ALL flag ifCONFIG_CHECKPOINT_RESTORE is dropped

From: Stanislav Kinsbursky
Date: Mon Apr 09 2012 - 13:54:31 EST


Return -ENOSYS, if user called sys_msgrcv() with MSG_PEEK_ALL flag set and
checkpoint/restore code wasn't compiled.

---
ipc/compat.c | 5 ++++-
ipc/msg.c | 4 ++++
2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ipc/compat.c b/ipc/compat.c
index bb9350d..0163aa1 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -377,7 +377,10 @@ long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
return -EINVAL;
if (second < 0)
return -EINVAL;
-
+#ifndef CONFIG_CHECKPOINT_RESTORE
+ if (third & MSG_PEEK_ALL)
+ return -ENOSYS;
+#endif
if (!version) {
struct compat_ipc_kludge ipck;
if (!uptr)
diff --git a/ipc/msg.c b/ipc/msg.c
index 8d63cc7..9d8f249 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -819,6 +819,10 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,

if (msqid < 0 || (long) bufsz < 0)
return -EINVAL;
+#ifndef CONFIG_CHECKPOINT_RESTORE
+ if (msgflg & MSG_PEEK_ALL)
+ return -ENOSYS;
+#endif
mode = convert_mode(&msgtyp, msgflg);
ns = current->nsproxy->ipc_ns;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/