diff mbox

[v2,10/35] fs: dquot: skip invalidate_bdev if bdev is NULL

Message ID 1438235311-23788-11-git-send-email-yangds.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yang Dongsheng July 30, 2015, 5:48 a.m. UTC
There would be a NULL pointer dereference if bdev is NULL

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 fs/quota/dquot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jan Kara Aug. 3, 2015, 8:04 p.m. UTC | #1
On Thu 30-07-15 13:48:06, Dongsheng Yang wrote:
> There would be a NULL pointer dereference if bdev is NULL
> 
> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>

The patch looks good. You can add:

Reviewed-by: Jan Kara <jack@suse.com>

								Honza

> ---
>  fs/quota/dquot.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 20d1f74..140397a 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -2208,7 +2208,8 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
>  		 * of the cache could fail because of other unrelated dirty
>  		 * data */
>  		sync_filesystem(sb);
> -		invalidate_bdev(sb->s_bdev);
> +		if (sb->s_bdev)
> +			invalidate_bdev(sb->s_bdev);
>  	}
>  	mutex_lock(&dqopt->dqonoff_mutex);
>  	if (sb_has_quota_loaded(sb, type)) {
> -- 
> 1.8.4.2
>
diff mbox

Patch

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 20d1f74..140397a 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2208,7 +2208,8 @@  static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
 		 * of the cache could fail because of other unrelated dirty
 		 * data */
 		sync_filesystem(sb);
-		invalidate_bdev(sb->s_bdev);
+		if (sb->s_bdev)
+			invalidate_bdev(sb->s_bdev);
 	}
 	mutex_lock(&dqopt->dqonoff_mutex);
 	if (sb_has_quota_loaded(sb, type)) {