Commit dd862da
nfs: fix incorrect handling of large-number NFS errors in nfs4_do_mkdir()
A recent commit introduced nfs4_do_mkdir() which reports an error from
nfs4_call_sync() by returning it with ERR_PTR().
This is a problem as nfs4_call_sync() can return negative NFS-specific
errors with values larger than MAX_ERRNO (4095). One example is
NFS4ERR_DELAY which has value 10008.
This "pointer" gets to PTR_ERR_OR_ZERO() in nfs4_proc_mkdir() which
chooses ZERO because it isn't in the range of value errors. Ultimately
the pointer is dereferenced.
This patch changes nfs4_do_mkdir() to report the dentry pointer and
status separately - pointer as a return value, status in an "int *"
parameter.
The same separation is used for _nfs4_proc_mkdir() and the two are
combined only in nfs4_proc_mkdir() after the status has passed through
nfs4_handle_exception(), which ensures the error code does not exceed
MAX_ERRNO.
It also fixes a problem in the even when nfs4_handle_exception() updated
the error value, the original 'alias' was still returned.
Reported-by: Anna Schumaker <[email protected]>
Fixes: 8376583 ("nfs: change mkdir inode_operation to return alternate dentry if needed.")
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>1 parent 80c4de6 commit dd862da
1 file changed
+20
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5164 | 5164 | | |
5165 | 5165 | | |
5166 | 5166 | | |
5167 | | - | |
| 5167 | + | |
5168 | 5168 | | |
5169 | | - | |
| 5169 | + | |
| 5170 | + | |
| 5171 | + | |
5170 | 5172 | | |
5171 | 5173 | | |
5172 | | - | |
5173 | | - | |
| 5174 | + | |
| 5175 | + | |
5174 | 5176 | | |
5175 | 5177 | | |
5176 | 5178 | | |
| |||
5179 | 5181 | | |
5180 | 5182 | | |
5181 | 5183 | | |
5182 | | - | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
| 5188 | + | |
5183 | 5189 | | |
5184 | 5190 | | |
5185 | 5191 | | |
| |||
5240 | 5246 | | |
5241 | 5247 | | |
5242 | 5248 | | |
5243 | | - | |
| 5249 | + | |
5244 | 5250 | | |
5245 | 5251 | | |
5246 | | - | |
| 5252 | + | |
5247 | 5253 | | |
| 5254 | + | |
5248 | 5255 | | |
5249 | 5256 | | |
5250 | 5257 | | |
5251 | 5258 | | |
5252 | 5259 | | |
5253 | | - | |
| 5260 | + | |
5254 | 5261 | | |
5255 | 5262 | | |
5256 | 5263 | | |
| |||
5273 | 5280 | | |
5274 | 5281 | | |
5275 | 5282 | | |
5276 | | - | |
5277 | | - | |
| 5283 | + | |
5278 | 5284 | | |
5279 | | - | |
5280 | | - | |
| 5285 | + | |
| 5286 | + | |
| 5287 | + | |
| 5288 | + | |
5281 | 5289 | | |
5282 | 5290 | | |
5283 | 5291 | | |
| |||
0 commit comments