From: Alexey Khoroshilov Date: Fri, 22 Mar 2013 20:36:44 +0000 (+0400) Subject: SUNRPC/cache: add module_put() on error path in cache_open() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a7823c797b4d29727499f0a75ddf3ed07af8ad0a;p=openwrt%2Fstaging%2Fblogic.git SUNRPC/cache: add module_put() on error path in cache_open() 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 Signed-off-by: J. Bruce Fields --- diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 25d58e766014..1d3c5144a331 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);