* [PATCH] SUNRPC/cache: add module_put() on error path in cache_open()
@ 2013-03-22 20:36 Alexey Khoroshilov
[not found] ` <1363984604-17739-1-git-send-email-khoroshilov-ufN2psIa012HXe+LvDLADg@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2013-03-22 20:36 UTC (permalink / raw)
To: J. Bruce Fields, Trond Myklebust
Cc: Alexey Khoroshilov, linux-nfs, netdev, linux-kernel, ldv-project
If kmalloc() fails in cache_open(), module cd->owner left locked.
The patch adds module_put(cd->owner) on this path.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
net/sunrpc/cache.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 25d58e76..1d3c514 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -986,8 +986,10 @@ static int cache_open(struct inode *inode, struct file *filp,
nonseekable_open(inode, filp);
if (filp->f_mode & FMODE_READ) {
rp = kmalloc(sizeof(*rp), GFP_KERNEL);
- if (!rp)
+ if (!rp) {
+ module_put(cd->owner);
return -ENOMEM;
+ }
rp->offset = 0;
rp->q.reader = 1;
atomic_inc(&cd->readers);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <1363984604-17739-1-git-send-email-khoroshilov-ufN2psIa012HXe+LvDLADg@public.gmane.org>]
* Re: [PATCH] SUNRPC/cache: add module_put() on error path in cache_open() [not found] ` <1363984604-17739-1-git-send-email-khoroshilov-ufN2psIa012HXe+LvDLADg@public.gmane.org> @ 2013-04-03 19:32 ` J. Bruce Fields 0 siblings, 0 replies; 2+ messages in thread From: J. Bruce Fields @ 2013-04-03 19:32 UTC (permalink / raw) To: Alexey Khoroshilov Cc: Trond Myklebust, linux-nfs-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, ldv-project-tpLiQldItUH5n4uC9ZG1Ww Thanks, applying.--b. On Sat, Mar 23, 2013 at 12:36:44AM +0400, Alexey Khoroshilov wrote: > If kmalloc() fails in cache_open(), module cd->owner left locked. > The patch adds module_put(cd->owner) on this path. > > Found by Linux Driver Verification project (linuxtesting.org). > > Signed-off-by: Alexey Khoroshilov <khoroshilov-ufN2psIa012HXe+LvDLADg@public.gmane.org> > --- > net/sunrpc/cache.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c > index 25d58e76..1d3c514 100644 > --- a/net/sunrpc/cache.c > +++ b/net/sunrpc/cache.c > @@ -986,8 +986,10 @@ static int cache_open(struct inode *inode, struct file *filp, > nonseekable_open(inode, filp); > if (filp->f_mode & FMODE_READ) { > rp = kmalloc(sizeof(*rp), GFP_KERNEL); > - if (!rp) > + if (!rp) { > + module_put(cd->owner); > return -ENOMEM; > + } > rp->offset = 0; > rp->q.reader = 1; > atomic_inc(&cd->readers); > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-03 19:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-22 20:36 [PATCH] SUNRPC/cache: add module_put() on error path in cache_open() Alexey Khoroshilov
[not found] ` <1363984604-17739-1-git-send-email-khoroshilov-ufN2psIa012HXe+LvDLADg@public.gmane.org>
2013-04-03 19:32 ` J. Bruce Fields
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox