diff mbox series

[02/11] quota: Only module_put the format when existing

Message ID 20190814121834.13983-3-s.hauer@pengutronix.de
State Changes Requested
Headers show
Series Add quota support to UBIFS | expand

Commit Message

Sascha Hauer Aug. 14, 2019, 12:18 p.m. UTC
For filesystems which do not have a quota_format_type such as upcoming
UBIFS quota fmt may be NULL. Only put the format when it's non NULL.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/quota/dquot.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jan Kara Aug. 15, 2019, 11:18 a.m. UTC | #1
On Wed 14-08-19 14:18:25, Sascha Hauer wrote:
> For filesystems which do not have a quota_format_type such as upcoming
> UBIFS quota fmt may be NULL. Only put the format when it's non NULL.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

But you do have quota format in the end. So is this patch needed?

								Honza

> ---
>  fs/quota/dquot.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 3cb836351c22..b043468e53f2 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -218,6 +218,9 @@ static struct quota_format_type *find_quota_format(int id)
>  
>  static void put_quota_format(struct quota_format_type *fmt)
>  {
> +	if (!fmt)
> +		return;
> +
>  	module_put(fmt->qf_owner);
>  }
>  
> -- 
> 2.20.1
> 
>
Sascha Hauer Aug. 16, 2019, 11:49 a.m. UTC | #2
On Thu, Aug 15, 2019 at 01:18:00PM +0200, Jan Kara wrote:
> On Wed 14-08-19 14:18:25, Sascha Hauer wrote:
> > For filesystems which do not have a quota_format_type such as upcoming
> > UBIFS quota fmt may be NULL. Only put the format when it's non NULL.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> 
> But you do have quota format in the end. So is this patch needed?

I have quota_format_ops, but as I do not store any quota data I do not
have a quota_format_type. Yes, this patch is needed.

Sascha
diff mbox series

Patch

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 3cb836351c22..b043468e53f2 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -218,6 +218,9 @@  static struct quota_format_type *find_quota_format(int id)
 
 static void put_quota_format(struct quota_format_type *fmt)
 {
+	if (!fmt)
+		return;
+
 	module_put(fmt->qf_owner);
 }