)]}'
{
  "commit": "76cb69279f83889cf98fd9f16f5d50bcc2779442",
  "tree": "06e827efbfa9ad7ad36b3962b7dfac7c507ecbcd",
  "parents": [
    "523693067608f067bcbe94f23a4feb4dfcfa2db8"
  ],
  "author": {
    "name": "Jim Schutt",
    "email": "jaschut@sandia.gov",
    "time": "Fri Aug 10 10:37:38 2012 -0700"
  },
  "committer": {
    "name": "Greg Kroah-Hartman",
    "email": "gregkh@linuxfoundation.org",
    "time": "Mon Nov 26 11:38:43 2012 -0800"
  },
  "message": "libceph: avoid truncation due to racing banners\n\n(cherry picked from commit 6d4221b53707486dfad3f5bfe568d2ce7f4c9863)\n\nBecause the Ceph client messenger uses a non-blocking connect, it is\npossible for the sending of the client banner to race with the\narrival of the banner sent by the peer.\n\nWhen ceph_sock_state_change() notices the connect has completed, it\nschedules work to process the socket via con_work().  During this\ntime the peer is writing its banner, and arrival of the peer banner\nraces with con_work().\n\nIf con_work() calls try_read() before the peer banner arrives, there\nis nothing for it to do, after which con_work() calls try_write() to\nsend the client\u0027s banner.  In this case Ceph\u0027s protocol negotiation\ncan complete succesfully.\n\nThe server-side messenger immediately sends its banner and addresses\nafter accepting a connect request, *before* actually attempting to\nread or verify the banner from the client.  As a result, it is\npossible for the banner from the server to arrive before con_work()\ncalls try_read().  If that happens, try_read() will read the banner\nand prepare protocol negotiation info via prepare_write_connect().\nprepare_write_connect() calls con_out_kvec_reset(), which discards\nthe as-yet-unsent client banner.  Next, con_work() calls\ntry_write(), which sends the protocol negotiation info rather than\nthe banner that the peer is expecting.\n\nThe result is that the peer sees an invalid banner, and the client\nreports \"negotiation failed\".\n\nFix this by moving con_out_kvec_reset() out of\nprepare_write_connect() to its callers at all locations except the\none where the banner might still need to be sent.\n\n[elder@inktak.com: added note about server-side behavior]\n\nSigned-off-by: Jim Schutt \u003cjaschut@sandia.gov\u003e\nReviewed-by: Alex Elder \u003celder@inktank.com\u003e\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@linuxfoundation.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "0de5a706f2b7ef6e64711098b572aa6623ba6c01",
      "old_mode": 33188,
      "old_path": "net/ceph/messenger.c",
      "new_id": "5f312510f49caf1cc525d44dd084ce281dda0ec1",
      "new_mode": 33188,
      "new_path": "net/ceph/messenger.c"
    }
  ]
}
