)]}'
{
  "commit": "40a2159abf3d0107bba359246554bd7d56f2171b",
  "tree": "b7a0ee28b4e112e6f134efb6b567f38589fc4689",
  "parents": [
    "08acd4f8af42affd8cbed81cc1b69fa12ddb213f"
  ],
  "author": {
    "name": "Ben Hutchings",
    "email": "bhutchings@solarflare.com",
    "time": "Mon Apr 28 15:59:58 2008 +0100"
  },
  "committer": {
    "name": "Greg Kroah-Hartman",
    "email": "gregkh@suse.de",
    "time": "Wed Apr 30 16:52:46 2008 -0700"
  },
  "message": "sysfs: Disallow truncation of files in sysfs\n\nsysfs allows attribute files to be truncated, e.g. using ftruncate(), with the\nexpected effect on their inode.   For most attributes, this doesn\u0027t change the\n\"real\" size of the file i.e. how much can be read from it.  However, the\nparameter validation for reading and writing binary attribute files is based\non the inode size and not the size specified in the file\u0027s bin_attribute, so it\ncan be broken by this. For example, if we try using dd to write to such a file:\n\n# pwd\n/sys/bus/pci/devices/0000:08:00.0\n# ls -l config\n-rw-r--r--  1 root root 4096 Feb  1 17:35 config\n# dd if\u003d/dev/zero of\u003dconfig bs\u003d4 count\u003d1\n1+0 records in\n1+0 records out\n# ls -l config\n-rw-r--r--  1 root root 0 Feb  1 17:50 config\n# dd if\u003d/dev/zero of\u003dconfig bs\u003d4 count\u003d1 seek\u003d128\ndd: writing `config\u0027: No space left on device\n1+0 records in\n0+0 records out\n\nAlso, after truncation to 0, parameter validation for read and write is\ndisabled.  Most bin_attribute read and write methods also validate the size and\noffset, but for some this will allow out-of-range access.  This may be a\nsecurity issue, though access to such files is often limited to root.  In any\ncase, the validation should remain for safety\u0027s sake!)\n\nThis was previously reported in Bugzilla as bug 9867.\n\nsysfs should ignore size changes or else refuse them (by returning -EINVAL).\nThis patch makes it ignore them.\n\nSigned-off-by: Ben Hutchings \u003cbhutchings@solarflare.com\u003e\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@suse.de\u003e\n\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "f8b82e73b3bf0ee8a7d9403d6ffdf06ad15f5411",
      "old_mode": 33188,
      "old_path": "fs/sysfs/inode.c",
      "new_id": "eb53c632f8564a100d92e4670b8c6764776a3514",
      "new_mode": 33188,
      "new_path": "fs/sysfs/inode.c"
    }
  ]
}
