public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] devlink: Add support for resource abstraction
Date: Wed, 19 Sep 2018 12:01:18 +0000	[thread overview]
Message-ID: <20180919120118.GA30149@mwanda> (raw)

[ It's weird that I didn't send this email earlier - dan ]

Hello Arkadi Sharshevsky,

The patch d9f9b9a4d05f: "devlink: Add support for resource
abstraction" from Jan 15, 2018, leads to the following static checker
warning:

	net/core/devlink.c:2604 devlink_resource_fill()
	error: double free of 'skb'

net/core/devlink.c
  2582                  }
  2583                  i++;
  2584          }
  2585          nla_nest_end(skb, resources_attr);
  2586          genlmsg_end(skb, hdr);
  2587          if (incomplete)
  2588                  goto start_again;
  2589  send_done:
  2590          nlh = nlmsg_put(skb, info->snd_portid, info->snd_seq,
  2591                          NLMSG_DONE, 0, flags | NLM_F_MULTI);
  2592          if (!nlh) {
  2593                  err = devlink_dpipe_send_and_alloc_skb(&skb, info);
                                                               ^^^^
Smatch says that some error paths free *pskb.  This seems like a legit
thing.  Of course, kfree_skb() only really frees it after we drop
the last reference and I don't know how the refcounting works here.

  2594                  if (err)
  2595                          goto err_skb_send_alloc;
                                ^^^^^^^^^^^^^^^^^^^^^^^^
  2596                  goto send_done;
  2597          }
  2598          return genlmsg_reply(skb, info);
  2599  
  2600  nla_put_failure:
  2601          err = -EMSGSIZE;
  2602  err_resource_put:
  2603  err_skb_send_alloc:
  2604          nlmsg_free(skb);
                           ^^^
  2605          return err;
  2606  }

regards,
dan carpenter

                 reply	other threads:[~2018-09-19 12:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180919120118.GA30149@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox