sunrpc/cache: fix module refcnt leak in a failure path
Subsystems (3)
PATCH 2/2 sunrpc/cache: fix module refcnt leak in a failure path
From: Li Zefan <[email protected]>
Don't forget to release the module refcnt if seq_open() returns failure.
Signed-off-by Li Zefan <[email protected]>
Cc J. Bruce Fields <[email protected]>
Cc Neil Brown <[email protected]>
Cc Trond Myklebust <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
net/sunrpc/cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sunrpc/cache.c renamed from net/sunrpc/cache.c~sunrpc-cache-fix-module-refcnt-leak-in-a-failure-path +3 -1
@@ -1233,8 +1233,10 @@ static int content_open(struct inode *inif (!cd || !try_module_get (cd->owner))return -EACCES ; han =__seq_open_private (file, &cache_content_op,sizeof (*han)); -if (han ==NULL ) +if (han ==NULL ) { +module_put (cd->owner);return -ENOMEM ; + } han->cd = cd;return 0 ;
_
A message that is not in the archive (sent off-list or not yet received): 201003112208.o2BM8Bng013520-AB4EexQrvXRQetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
J. Bruce Fields
AppliedQuoted 3 lines · On Thu, Mar 11, 2010 at 02:08:10PM -0800, [email protected] wrote:
From: Li Zefan <[email protected]>
Don't forget to release the module refcnt if
seq_open()returns failure.
Thanks, applied for 2.6.35.--b.
Quoted 27 lines
Signed-off-by Li Zefan <[email protected]>Cc J. Bruce Fields <[email protected]>Cc Neil Brown <[email protected]>Cc Trond Myklebust <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
net/sunrpc/cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)diff -puN
net/sunrpc/cache.c~sunrpc-cache-fix-module-refcnt-leak-in-a-failure-pathnet/sunrpc/cache.cnet/sunrpc/cache.c renamed from net/sunrpc/cache.c~sunrpc-cache-fix-module-refcnt-leak-in-a-failure-path +3
-1@@ -1233,8 +1233,10 @@ static int content_open(struct inode *inif (!cd || !try_module_get (cd->owner))return -EACCES ; han =__seq_open_private (file, &cache_content_op,sizeof (*han)); -if (han ==NULL ) +if (han ==NULL ) { +module_put (cd->owner);return -ENOMEM ; + } han->cd = cd;return 0 ;_