Skip to content
  • Martin Fuzzey's avatar
    iio: core: Fix double free. · c1b03ab5
    Martin Fuzzey authored
    When an error occurred during event registration memory was freed twice
    resulting in kernel memory corruption and a crash in unrelated code.
    
    The problem was caused by
    	iio_device_unregister_eventset()
    	iio_device_unregister_sysfs()
    
    being called twice, once on the error path and then
    again via iio_dev_release().
    
    Fix this by making these two functions idempotent so they
    may be called multiple times.
    
    The problem was observed before applying
    	78b33216
    
     iio:core: Handle error when mask type is not separate
    
    Signed-off-by: default avatarMartin Fuzzey <mfuzzey@parkeon.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
    c1b03ab5