diff options
Diffstat (limited to 'fs/afs/cmservice.c')
-rw-r--r-- | fs/afs/cmservice.c | 78 |
1 files changed, 34 insertions, 44 deletions
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c index 4b0eff6da674..85737e96ab8b 100644 --- a/fs/afs/cmservice.c +++ b/fs/afs/cmservice.c | |||
@@ -189,11 +189,8 @@ static int afs_deliver_cb_callback(struct afs_call *call, struct sk_buff *skb, | |||
189 | case 1: | 189 | case 1: |
190 | _debug("extract FID count"); | 190 | _debug("extract FID count"); |
191 | ret = afs_extract_data(call, skb, last, &call->tmp, 4); | 191 | ret = afs_extract_data(call, skb, last, &call->tmp, 4); |
192 | switch (ret) { | 192 | if (ret < 0) |
193 | case 0: break; | 193 | return ret; |
194 | case -EAGAIN: return 0; | ||
195 | default: return ret; | ||
196 | } | ||
197 | 194 | ||
198 | call->count = ntohl(call->tmp); | 195 | call->count = ntohl(call->tmp); |
199 | _debug("FID count: %u", call->count); | 196 | _debug("FID count: %u", call->count); |
@@ -210,11 +207,8 @@ static int afs_deliver_cb_callback(struct afs_call *call, struct sk_buff *skb, | |||
210 | _debug("extract FID array"); | 207 | _debug("extract FID array"); |
211 | ret = afs_extract_data(call, skb, last, call->buffer, | 208 | ret = afs_extract_data(call, skb, last, call->buffer, |
212 | call->count * 3 * 4); | 209 | call->count * 3 * 4); |
213 | switch (ret) { | 210 | if (ret < 0) |
214 | case 0: break; | 211 | return ret; |
215 | case -EAGAIN: return 0; | ||
216 | default: return ret; | ||
217 | } | ||
218 | 212 | ||
219 | _debug("unmarshall FID array"); | 213 | _debug("unmarshall FID array"); |
220 | call->request = kcalloc(call->count, | 214 | call->request = kcalloc(call->count, |
@@ -239,11 +233,8 @@ static int afs_deliver_cb_callback(struct afs_call *call, struct sk_buff *skb, | |||
239 | case 3: | 233 | case 3: |
240 | _debug("extract CB count"); | 234 | _debug("extract CB count"); |
241 | ret = afs_extract_data(call, skb, last, &call->tmp, 4); | 235 | ret = afs_extract_data(call, skb, last, &call->tmp, 4); |
242 | switch (ret) { | 236 | if (ret < 0) |
243 | case 0: break; | 237 | return ret; |
244 | case -EAGAIN: return 0; | ||
245 | default: return ret; | ||
246 | } | ||
247 | 238 | ||
248 | tmp = ntohl(call->tmp); | 239 | tmp = ntohl(call->tmp); |
249 | _debug("CB count: %u", tmp); | 240 | _debug("CB count: %u", tmp); |
@@ -258,11 +249,8 @@ static int afs_deliver_cb_callback(struct afs_call *call, struct sk_buff *skb, | |||
258 | _debug("extract CB array"); | 249 | _debug("extract CB array"); |
259 | ret = afs_extract_data(call, skb, last, call->request, | 250 | ret = afs_extract_data(call, skb, last, call->request, |
260 | call->count * 3 * 4); | 251 | call->count * 3 * 4); |
261 | switch (ret) { | 252 | if (ret < 0) |
262 | case 0: break; | 253 | return ret; |
263 | case -EAGAIN: return 0; | ||
264 | default: return ret; | ||
265 | } | ||
266 | 254 | ||
267 | _debug("unmarshall CB array"); | 255 | _debug("unmarshall CB array"); |
268 | cb = call->request; | 256 | cb = call->request; |
@@ -278,9 +266,9 @@ static int afs_deliver_cb_callback(struct afs_call *call, struct sk_buff *skb, | |||
278 | call->unmarshall++; | 266 | call->unmarshall++; |
279 | 267 | ||
280 | case 5: | 268 | case 5: |
281 | _debug("trailer"); | 269 | ret = afs_data_complete(call, skb, last); |
282 | if (skb->len != 0) | 270 | if (ret < 0) |
283 | return -EBADMSG; | 271 | return ret; |
284 | 272 | ||
285 | /* Record that the message was unmarshalled successfully so | 273 | /* Record that the message was unmarshalled successfully so |
286 | * that the call destructor can know do the callback breaking | 274 | * that the call destructor can know do the callback breaking |
@@ -294,8 +282,6 @@ static int afs_deliver_cb_callback(struct afs_call *call, struct sk_buff *skb, | |||
294 | break; | 282 | break; |
295 | } | 283 | } |
296 | 284 | ||
297 | if (!last) | ||
298 | return 0; | ||
299 | 285 | ||
300 | call->state = AFS_CALL_REPLYING; | 286 | call->state = AFS_CALL_REPLYING; |
301 | 287 | ||
@@ -335,13 +321,13 @@ static int afs_deliver_cb_init_call_back_state(struct afs_call *call, | |||
335 | { | 321 | { |
336 | struct afs_server *server; | 322 | struct afs_server *server; |
337 | struct in_addr addr; | 323 | struct in_addr addr; |
324 | int ret; | ||
338 | 325 | ||
339 | _enter(",{%u},%d", skb->len, last); | 326 | _enter(",{%u},%d", skb->len, last); |
340 | 327 | ||
341 | if (skb->len > 0) | 328 | ret = afs_data_complete(call, skb, last); |
342 | return -EBADMSG; | 329 | if (ret < 0) |
343 | if (!last) | 330 | return ret; |
344 | return 0; | ||
345 | 331 | ||
346 | /* no unmarshalling required */ | 332 | /* no unmarshalling required */ |
347 | call->state = AFS_CALL_REPLYING; | 333 | call->state = AFS_CALL_REPLYING; |
@@ -371,8 +357,10 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call, | |||
371 | 357 | ||
372 | _enter(",{%u},%d", skb->len, last); | 358 | _enter(",{%u},%d", skb->len, last); |
373 | 359 | ||
360 | /* There are some arguments that we ignore */ | ||
361 | afs_data_consumed(call, skb); | ||
374 | if (!last) | 362 | if (!last) |
375 | return 0; | 363 | return -EAGAIN; |
376 | 364 | ||
377 | /* no unmarshalling required */ | 365 | /* no unmarshalling required */ |
378 | call->state = AFS_CALL_REPLYING; | 366 | call->state = AFS_CALL_REPLYING; |
@@ -408,12 +396,13 @@ static void SRXAFSCB_Probe(struct work_struct *work) | |||
408 | static int afs_deliver_cb_probe(struct afs_call *call, struct sk_buff *skb, | 396 | static int afs_deliver_cb_probe(struct afs_call *call, struct sk_buff *skb, |
409 | bool last) | 397 | bool last) |
410 | { | 398 | { |
399 | int ret; | ||
400 | |||
411 | _enter(",{%u},%d", skb->len, last); | 401 | _enter(",{%u},%d", skb->len, last); |
412 | 402 | ||
413 | if (skb->len > 0) | 403 | ret = afs_data_complete(call, skb, last); |
414 | return -EBADMSG; | 404 | if (ret < 0) |
415 | if (!last) | 405 | return ret; |
416 | return 0; | ||
417 | 406 | ||
418 | /* no unmarshalling required */ | 407 | /* no unmarshalling required */ |
419 | call->state = AFS_CALL_REPLYING; | 408 | call->state = AFS_CALL_REPLYING; |
@@ -460,10 +449,9 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call, struct sk_buff *skb, | |||
460 | 449 | ||
461 | _enter("{%u},{%u},%d", call->unmarshall, skb->len, last); | 450 | _enter("{%u},{%u},%d", call->unmarshall, skb->len, last); |
462 | 451 | ||
463 | if (skb->len > 0) | 452 | ret = afs_data_complete(call, skb, last); |
464 | return -EBADMSG; | 453 | if (ret < 0) |
465 | if (!last) | 454 | return ret; |
466 | return 0; | ||
467 | 455 | ||
468 | switch (call->unmarshall) { | 456 | switch (call->unmarshall) { |
469 | case 0: | 457 | case 0: |
@@ -509,8 +497,9 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call, struct sk_buff *skb, | |||
509 | break; | 497 | break; |
510 | } | 498 | } |
511 | 499 | ||
512 | if (!last) | 500 | ret = afs_data_complete(call, skb, last); |
513 | return 0; | 501 | if (ret < 0) |
502 | return ret; | ||
514 | 503 | ||
515 | call->state = AFS_CALL_REPLYING; | 504 | call->state = AFS_CALL_REPLYING; |
516 | 505 | ||
@@ -588,12 +577,13 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work) | |||
588 | static int afs_deliver_cb_tell_me_about_yourself(struct afs_call *call, | 577 | static int afs_deliver_cb_tell_me_about_yourself(struct afs_call *call, |
589 | struct sk_buff *skb, bool last) | 578 | struct sk_buff *skb, bool last) |
590 | { | 579 | { |
580 | int ret; | ||
581 | |||
591 | _enter(",{%u},%d", skb->len, last); | 582 | _enter(",{%u},%d", skb->len, last); |
592 | 583 | ||
593 | if (skb->len > 0) | 584 | ret = afs_data_complete(call, skb, last); |
594 | return -EBADMSG; | 585 | if (ret < 0) |
595 | if (!last) | 586 | return ret; |
596 | return 0; | ||
597 | 587 | ||
598 | /* no unmarshalling required */ | 588 | /* no unmarshalling required */ |
599 | call->state = AFS_CALL_REPLYING; | 589 | call->state = AFS_CALL_REPLYING; |