ip6_flowlabel.c (7c4c24168014f250241b6df66ca5bae37eda7ffc) ip6_flowlabel.c (d3c48151512922dd35f1f393b30b9138e4441d14)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * ip6_flowlabel.c IPv6 flowlabel manager.
4 *
5 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
6 */
7
8#include <linux/capability.h>

--- 387 unchanged lines hidden (view full) ---

396 err = -ENOMEM;
397 fl->opt = kmalloc(sizeof(*fl->opt) + olen, GFP_KERNEL);
398 if (!fl->opt)
399 goto done;
400
401 memset(fl->opt, 0, sizeof(*fl->opt));
402 fl->opt->tot_len = sizeof(*fl->opt) + olen;
403 err = -EFAULT;
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * ip6_flowlabel.c IPv6 flowlabel manager.
4 *
5 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
6 */
7
8#include <linux/capability.h>

--- 387 unchanged lines hidden (view full) ---

396 err = -ENOMEM;
397 fl->opt = kmalloc(sizeof(*fl->opt) + olen, GFP_KERNEL);
398 if (!fl->opt)
399 goto done;
400
401 memset(fl->opt, 0, sizeof(*fl->opt));
402 fl->opt->tot_len = sizeof(*fl->opt) + olen;
403 err = -EFAULT;
404 sockptr_advance(optval, CMSG_ALIGN(sizeof(*freq)));
405 if (copy_from_sockptr(fl->opt + 1, optval, olen))
404 if (copy_from_sockptr_offset(fl->opt + 1, optval,
405 CMSG_ALIGN(sizeof(*freq)), olen))
406 goto done;
407
408 msg.msg_controllen = olen;
409 msg.msg_control = (void *)(fl->opt+1);
410 memset(&flowi6, 0, sizeof(flowi6));
411
412 ipc6.opt = fl->opt;
413 err = ip6_datagram_send_ctl(net, sk, &msg, &flowi6, &ipc6);

--- 284 unchanged lines hidden (view full) ---

698 if (err != 0)
699 goto done;
700
701 fl1 = fl_intern(net, fl, freq->flr_label);
702 if (fl1)
703 goto recheck;
704
705 if (!freq->flr_label) {
406 goto done;
407
408 msg.msg_controllen = olen;
409 msg.msg_control = (void *)(fl->opt+1);
410 memset(&flowi6, 0, sizeof(flowi6));
411
412 ipc6.opt = fl->opt;
413 err = ip6_datagram_send_ctl(net, sk, &msg, &flowi6, &ipc6);

--- 284 unchanged lines hidden (view full) ---

698 if (err != 0)
699 goto done;
700
701 fl1 = fl_intern(net, fl, freq->flr_label);
702 if (fl1)
703 goto recheck;
704
705 if (!freq->flr_label) {
706 sockptr_advance(optval,
707 offsetof(struct in6_flowlabel_req, flr_label));
708 if (copy_to_sockptr(optval, &fl->label, sizeof(fl->label))) {
706 size_t offset = offsetof(struct in6_flowlabel_req, flr_label);
707
708 if (copy_to_sockptr_offset(optval, offset, &fl->label,
709 sizeof(fl->label))) {
709 /* Intentionally ignore fault. */
710 }
711 }
712
713 fl_link(np, sfl1, fl);
714 return 0;
715done:
716 fl_free(fl);

--- 190 unchanged lines hidden ---
710 /* Intentionally ignore fault. */
711 }
712 }
713
714 fl_link(np, sfl1, fl);
715 return 0;
716done:
717 fl_free(fl);

--- 190 unchanged lines hidden ---