Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1159909

[PATCH 5/5] ipc,sysv: return -EINVAL upon incorrect id/seqnum

From Davidlohr Bueso <dave@stgolabs.net>
Newsgroups linux.kernel
Subject [PATCH 5/5] ipc,sysv: return -EINVAL upon incorrect id/seqnum
Date 2015-06-06 15:40 +0200
Message-ID <pymum-1tT-29@gated-at.bofh.it> (permalink)
References <pymul-1tT-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


In ipc_obtain_object_check we return -EIDRM when a bogus
sequence number is detected via ipc_checkid, while the ipc
manpages state the following return codes for such errors:

   EIDRM  <ID> points to a removed identifier.
   EINVAL Invalid <ID> value, or unaligned, etc.

EIDRM should only be returned upon a RMID call (->deleted
check), and thus return EINVAL for wrong seq. This difference
in semantics has also caused real bugs, ie:
https://bugzilla.redhat.com/show_bug.cgi?id=246509

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 ipc/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/util.c b/ipc/util.c
index 15e750d..468b225 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -625,7 +625,7 @@ struct kern_ipc_perm *ipc_obtain_object_check(struct ipc_ids *ids, int id)
 		goto out;
 
 	if (ipc_checkid(out, id))
-		return ERR_PTR(-EIDRM);
+		return ERR_PTR(-EINVAL);
 out:
 	return out;
 }
-- 
2.1.4

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

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH -next 0/5] ipc: EIDRM/EINVAL returns & misc updates Davidlohr Bueso <dave@stgolabs.net> - 2015-06-06 15:40 +0200
  [PATCH 1/5] ipc,shm: move BUG_ON check into shm_lock Davidlohr Bueso <dave@stgolabs.net> - 2015-06-06 15:40 +0200
  [PATCH 2/5] ipc,msg: provide barrier pairings for lockless receive Davidlohr Bueso <dave@stgolabs.net> - 2015-06-06 15:40 +0200
  [PATCH 4/5] ipc,sysv: make return -EIDRM when racing with RMID consistent Davidlohr Bueso <dave@stgolabs.net> - 2015-06-06 15:40 +0200
  [PATCH 3/5] ipc: rename ipc_obtain_object Davidlohr Bueso <dave@stgolabs.net> - 2015-06-06 15:40 +0200
  [PATCH 5/5] ipc,sysv: return -EINVAL upon incorrect id/seqnum Davidlohr Bueso <dave@stgolabs.net> - 2015-06-06 15:40 +0200

csiph-web