Skip to content

Commit

Permalink
ipc,sysv: return -EINVAL upon incorrect id/seqnum
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Manfred Spraul <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Davidlohr Bueso authored and torvalds committed Jul 1, 2015
1 parent f8b5918 commit 6157dbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ipc/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,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;
}
Expand Down

0 comments on commit 6157dbb

Please sign in to comment.