All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Ryzhov <iryzhov@nfware.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: stable@dpdk.org, dev@dpdk.org
Subject: Re: [PATCH] kni: fix rte_kni_update_link
Date: Mon, 28 Jan 2019 14:45:36 +0300	[thread overview]
Message-ID: <CAF+s_FxDRtAtOQQTpiu-bXqDArJuagQZULaK9JGtEj1RDwwe+g@mail.gmail.com> (raw)
In-Reply-To: <20190124204749.49912-1-iryzhov@nfware.com>

Hi Ferruh,

Can you, please, take a look at this patch?
The current implementation is broken, I think the patch should be merged
into 19.02 and 18.11.1.

Best regards,
Igor

On Thu, Jan 24, 2019 at 11:47 PM Igor Ryzhov <iryzhov@nfware.com> wrote:

> After read, file offset must be set to 0 before write.
> Otherwise, the third byte will be overwritten instead of the first.
>
> Fixes: c6fd54f28c24 ("kni: add function to set link state on kernel
> interface")
> Cc: stable@dpdk.org
>
> Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
> ---
>  lib/librte_kni/rte_kni.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
> index 73aeccccf..5899bb14a 100644
> --- a/lib/librte_kni/rte_kni.c
> +++ b/lib/librte_kni/rte_kni.c
> @@ -746,6 +746,12 @@ rte_kni_update_link(struct rte_kni *kni, unsigned int
> linkup)
>         }
>         old_linkup = (old_carrier[0] == '1');
>
> +       if (lseek(fd, 0, SEEK_SET) == -1) {
> +               RTE_LOG(ERR, KNI, "Failed to change file position: %s.\n",
> path);
> +               close(fd);
> +               return -1;
> +       }
> +
>         new_carrier = linkup ? "1" : "0";
>         ret = write(fd, new_carrier, 1);
>         if (ret < 1) {
> --
> 2.20.1
>
>

  reply	other threads:[~2019-01-28 11:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 20:47 [PATCH] kni: fix rte_kni_update_link Igor Ryzhov
2019-01-28 11:45 ` Igor Ryzhov [this message]
2019-01-28 13:49   ` Igor Ryzhov
2019-01-28 14:00     ` Ferruh Yigit
2019-02-05 22:45 ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAF+s_FxDRtAtOQQTpiu-bXqDArJuagQZULaK9JGtEj1RDwwe+g@mail.gmail.com \
    --to=iryzhov@nfware.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.