Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 119087 - Fix double decrement of mqueue_mnt->mnt_count in sys_mq_open (CVE-2005-3356)
Summary: Fix double decrement of mqueue_mnt->mnt_count in sys_mq_open (CVE-2005-3356)
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Kernel (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Security
Whiteboard: [linux <]
Depends on:
Reported: 2006-01-15 06:24 UTC by Sune Kloppenborg Jeppesen
Modified: 2009-05-03 16:01 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---

fix-double-decrement-in-sys_mq_open.patch (fix-double-decrement-in-sys_mq_open.patch,2.60 KB, patch)
2006-01-15 20:30 UTC, Kerin Millar
no flags Details | Diff
fix-double-decrement-in-sys_mq_open.patch (inc. git header) (fix-double-decrement-in-sys_mq_open.patch,3.71 KB, patch)
2006-01-15 20:35 UTC, Kerin Millar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Kloppenborg Jeppesen gentoo-dev 2006-01-15 06:24:20 UTC
From: Alexander Viro <>
Date: Sat, 14 Jan 2006 20:29:55 +0000 (-0500)
Subject: [PATCH] Fix double decrement of mqueue_mnt->mnt_count in sys_mq_open

[PATCH] Fix double decrement of mqueue_mnt->mnt_count in sys_mq_open

Fixed the refcounting on failure exits in sys_mq_open() and
cleaned the logics up.  Rules are actually pretty simple - dentry_open()
expects vfsmount and dentry to be pinned down and it either transfers
them into created struct file or drops them.  Old code had been very
confused in that area - if dentry_open() had failed either in do_open()
or do_create(), we ended up dentry and mqueue_mnt dropped twice, once
by dentry_open() cleanup and then by sys_mq_open().

Fix consists of making the rules for do_create() and do_open()
same as for dentry_open() and updating the sys_mq_open() accordingly;
that actually leads to more straightforward code and less work on
normal path.

Signed-off-by: Al Viro <>
Signed-off-by: Linus Torvalds <>
Comment 1 Tim Yamin (RETIRED) gentoo-dev 2006-01-15 06:57:41 UTC
CCing maintainers:

ck-sources-2.6: marineam
gentoo-sources-2.6: dsd
hardened-sources-2.6: kerframil/hardened
hppa-sources-2.6: GMSoft
mips-sources-2.6: Kumba
rsbac-sources-2.6: kang
suspend2-sources-2.6: brix
xbox-sources-2.6: gimli
Comment 2 Kerin Millar 2006-01-15 20:30:06 UTC
Created attachment 77224 [details, diff]

Patch. Applies against 2.6.14 and 2.6.15 (not sure about earlier versions).
Comment 3 Kerin Millar 2006-01-15 20:35:07 UTC
Created attachment 77226 [details, diff]
fix-double-decrement-in-sys_mq_open.patch (inc. git header)

Revision. Exactly the same, just added the git header stuff and commit message at the top.
Comment 4 Guy Martin (RETIRED) gentoo-dev 2006-01-16 08:16:49 UTC
hppa-sources- in CVS.
Comment 5 Daniel Drake (RETIRED) gentoo-dev 2006-01-31 15:49:58 UTC
Fixed in gentoo-sources-2.6.15-r2 (genpatches-2.6.15-4) and Linux
Comment 6 Kerin Millar 2006-02-01 10:23:43 UTC
Fixed in hardened-sources-2.6.15-r5 and genpatches-2.6.14-10.
Comment 7 Henrik Brix Andersen 2006-02-02 04:34:18 UTC
Fixed in suspend2-sources-2.6.15-r5.
Comment 8 Tim Yamin (RETIRED) gentoo-dev 2006-04-20 10:54:56 UTC
All fixed now, thanks!