static bool start_in_transfer(struct fsg_common *common, struct fsg_buffhd *bh)
 {
+       int rc;
+
        if (!fsg_is_set(common))
                return false;
        bh->state = BUF_STATE_SENDING;
-       if (start_transfer(common->fsg, common->fsg->bulk_in, bh->inreq))
+       rc = start_transfer(common->fsg, common->fsg->bulk_in, bh->inreq);
+       if (rc) {
                bh->state = BUF_STATE_EMPTY;
+               if (rc == -ESHUTDOWN) {
+                       common->running = 0;
+                       return false;
+               }
+       }
        return true;
 }
 
 static bool start_out_transfer(struct fsg_common *common, struct fsg_buffhd *bh)
 {
+       int rc;
+
        if (!fsg_is_set(common))
                return false;
        bh->state = BUF_STATE_RECEIVING;
-       if (start_transfer(common->fsg, common->fsg->bulk_out, bh->outreq))
+       rc = start_transfer(common->fsg, common->fsg->bulk_out, bh->outreq);
+       if (rc) {
                bh->state = BUF_STATE_FULL;
+               if (rc == -ESHUTDOWN) {
+                       common->running = 0;
+                       return false;
+               }
+       }
        return true;
 }