)]}'
{
  "commit": "a04b915fd997c2e9ac58c1c2651888ef2e9e9b21",
  "tree": "9266956d91facf9d674c4e7b8657685b3b170bbd",
  "parents": [
    "7d8d3c377cc9731c3924f807c7769177ca3f0865"
  ],
  "author": {
    "name": "Takashi Iwai",
    "email": "tiwai@suse.de",
    "time": "Sun Dec 29 09:17:07 2019 +0100"
  },
  "committer": {
    "name": "Takashi Iwai",
    "email": "tiwai@suse.de",
    "time": "Mon Dec 30 09:16:11 2019 +0100"
  },
  "message": "ALSA: control: Add verification for kctl accesses\n\nThe current implementation of ALSA control API fully relies on the\ncallbacks of each driver, and there is no verification of the values\npassed via API.  This patch is an attempt to improve the situation\nslightly by adding the validation code for the values stored via info\nand get callbacks.\n\nThe patch adds a new kconfig, CONFIG_SND_CTL_VALIDATION.  It depends\non CONFIG_SND_DEBUG and off as default since the validation would\nrequire a slight overhead including the additional call of info\ncallback at each get callback invocation.\n\nWhen this config is enabled, the values stored by each info callback\ninvocation are verified, namely:\n- Whether the info type is valid\n- Whether the number of enum items is non-zero\n- Whether the given info count is within the allowed boundary\n\nSimilarly, the values stored at each get callback are verified as\nwell:\n- Whether the values are within the given range\n- Whether the values are aligned with the given step\n- Whether any further changes are seen in the data array over the\n  given info count\n\nThe last point helps identifying a possibly invalid data type access,\ntypically a case where the info callback declares the type being\nSNDRV_CTL_ELEM_TYPE_ENUMERATED while the get/put callbacks store\nthe values in value.integer.value[] array.\n\nWhen a validation fails, the ALSA core logs an error message including\nthe device and the control ID, and the API call also returns an\nerror.  So, with the new validation turned on, the driver behavior\ndifference may be visible on user-space, too -- it\u0027s intentional,\nthough, so that we can catch an error more clearly.\n\nThe patch also introduces a new ctl access type,\nSNDRV_CTL_ELEM_ACCESS_SKIP_CHECK.  A driver may pass this flag with\nother access bits to indicate that the ctl element won\u0027t be verified.\nIt\u0027s useful when a driver code is specially written to access the data\ngreater than info-\u003ecount size by some reason.  For example, this flag\nis actually set now in HD-audio HDMI codec driver which needs to clear\nthe data array in the case of the disconnected monitor.\n\nAlso, the PCM channel-map helper code is slightly modified to avoid\nthe false-positive hit by this validation code, too.\n\nLink: https://lore.kernel.org/r/20191229081707.7590-1-tiwai@suse.de\nSigned-off-by: Takashi Iwai \u003ctiwai@suse.de\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "5d7c994756844ba36139db30fe2cb3c1211f2af3",
      "old_mode": 33188,
      "old_path": "include/sound/control.h",
      "new_id": "58446411ec100c17f1990f3285c388e8c9653104",
      "new_mode": 33188,
      "new_path": "include/sound/control.h"
    },
    {
      "type": "modify",
      "old_id": "4044c42d859535b695360b4eeb204a8aa089a8f7",
      "old_mode": 33188,
      "old_path": "sound/core/Kconfig",
      "new_id": "303d769a15b74f8a9e9707bd2abf0d80bb15b654",
      "new_mode": 33188,
      "new_path": "sound/core/Kconfig"
    },
    {
      "type": "modify",
      "old_id": "4728f6828890629cce0cf70639de87eab9a4b365",
      "old_mode": 33188,
      "old_path": "sound/core/control.c",
      "new_id": "6d27f0baff5e2742a7507db250d03ec0cbb5da6f",
      "new_mode": 33188,
      "new_path": "sound/core/control.c"
    },
    {
      "type": "modify",
      "old_id": "ce3a36cb58da8636aa6602feb8b5debe29df2218",
      "old_mode": 33188,
      "old_path": "sound/core/pcm_lib.c",
      "new_id": "18f498ab7af1bf2838b04dfca3755bc26879e117",
      "new_mode": 33188,
      "new_path": "sound/core/pcm_lib.c"
    },
    {
      "type": "modify",
      "old_id": "630b1f5c276d4eb348e65603ffbcd1e6e087660b",
      "old_mode": 33188,
      "old_path": "sound/pci/hda/patch_hdmi.c",
      "new_id": "3beb842817ff456d1e0581955ec413a31d49ee1e",
      "new_mode": 33188,
      "new_path": "sound/pci/hda/patch_hdmi.c"
    }
  ]
}
