Browse Source

nfs: add error check in nfs_idmap_prepare_message()

Even though the caller of nfs_idmap_prepare_message() checks return
code in their side but it's better to add an error check for match_int()
so that we can avoid unnecessary operations when bad int arg is
detected.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Chengguang Xu 7 years ago
parent
commit
12b289cfac
1 changed files with 2 additions and 0 deletions
  1. 2 0
      fs/nfs/nfs4idmap.c

+ 2 - 0
fs/nfs/nfs4idmap.c

@@ -516,6 +516,8 @@ static int nfs_idmap_prepare_message(char *desc, struct idmap *idmap,
 	case Opt_find_group:
 	case Opt_find_group:
 		im->im_conv = IDMAP_CONV_IDTONAME;
 		im->im_conv = IDMAP_CONV_IDTONAME;
 		ret = match_int(&substr, &im->im_id);
 		ret = match_int(&substr, &im->im_id);
+		if (ret)
+			goto out;
 		break;
 		break;
 
 
 	default:
 	default: