• Thomas Graf's avatar
    sctp: Allow struct sctp_event_subscribe to grow without breaking binaries · acdd5985
    Thomas Graf authored
    getsockopt(..., SCTP_EVENTS, ...) performs a length check and returns
    an error if the user provides less bytes than the size of struct
    sctp_event_subscribe.
    
    Struct sctp_event_subscribe needs to be extended by an u8 for every
    new event or notification type that is added.
    
    This obviously makes getsockopt fail for binaries that are compiled
    against an older versions of <net/sctp/user.h> which do not contain
    all event types.
    
    This patch changes getsockopt behaviour to no longer return an error
    if not enough bytes are being provided by the user. Instead, it
    returns as much of sctp_event_subscribe as fits into the provided buffer.
    
    This leads to the new behavior that users see what they have been aware
    of at compile time.
    
    The setsockopt(..., SCTP_EVENTS, ...) API is already behaving like this.
    Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
    Acked-by: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    acdd5985
socket.c 194 KB