Message ID | 1481690673-7019-1-git-send-email-liq3ea@gmail.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
On Tue, 13 Dec 2016 23:44:33 -0500 Li Qiang <liq3ea@gmail.com> wrote: > The v9fs may allocate 'v9ses->cachetag' if the macro > CONFIG_9P_FSCACHE if defined. In the v9fs_session_init function, > it doesn't free this field if an error occurs. This patch avoid > this. > > Signed-off-by: Li Qiang <liq3ea@gmail.com> > --- Reviewed-by: Greg Kurz <groug@kaod.org> BTW, I have the impression that v9ses->cachetag may also be leaked by v9fs_session_close() if it got allocated in v9fs_cache_session_get_cookie() and fscache_acquire_cookie() returned NULL (which can happen). Cheers. -- Greg > fs/9p/v9fs.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c > index 072e759..fac421a 100644 > --- a/fs/9p/v9fs.c > +++ b/fs/9p/v9fs.c > @@ -413,6 +413,9 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, > return fid; > > err_clnt: > +#ifdef CONFIG_9P_FSCACHE > + kfree(v9ses->cachetag); > +#endif > p9_client_destroy(v9ses->clnt); > err_bdi: > bdi_destroy(&v9ses->bdi); ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 072e759..fac421a 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -413,6 +413,9 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, return fid; err_clnt: +#ifdef CONFIG_9P_FSCACHE + kfree(v9ses->cachetag); +#endif p9_client_destroy(v9ses->clnt); err_bdi: bdi_destroy(&v9ses->bdi);
The v9fs may allocate 'v9ses->cachetag' if the macro CONFIG_9P_FSCACHE if defined. In the v9fs_session_init function, it doesn't free this field if an error occurs. This patch avoid this. Signed-off-by: Li Qiang <liq3ea@gmail.com> --- fs/9p/v9fs.c | 3 +++ 1 file changed, 3 insertions(+)