]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/sctp/socket.c
sctp: fix -ENOMEM result with invalid user space pointer in sendto() syscall
[mirror_ubuntu-bionic-kernel.git] / net / sctp / socket.c
index a60d1f8b41c5e2330e837265e175202aba322fcb..406d957d08fbcb7d9cb532a8143d363c277c3ec8 100644 (file)
@@ -1915,8 +1915,8 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
 
        /* Break the message into multiple chunks of maximum size. */
        datamsg = sctp_datamsg_from_user(asoc, sinfo, msg, msg_len);
-       if (!datamsg) {
-               err = -ENOMEM;
+       if (IS_ERR(datamsg)) {
+               err = PTR_ERR(datamsg);
                goto out_free;
        }