• Oliver Hartkopp's avatar
    can: dev: fix crtlmode_supported check · b9c03b60
    Oliver Hartkopp authored
    commit 9b1087aa upstream.
    
    When changing flags in the CAN drivers ctrlmode the provided new content has to
    be checked whether the bits are allowed to be changed. The bits that are to be
    changed are given as a bitfield in cm->mask. Therefore checking against
    cm->flags is wrong as the content can hold any kind of values.
    
    The iproute2 tool sets the bits in cm->mask and cm->flags depending on the
    detected command line options. To be robust against bogus user space
    applications additionally sanitize the provided flags with the provided mask.
    
    Cc: Wolfgang Grandegger <wg@grandegger.com>
    Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
    Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
    b9c03b60
dev.c 21.3 KB