netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: pgynther@google.com
Cc: netdev@vger.kernel.org, f.fainelli@gmail.com,
	thomas.petazzoni@free-electrons.com
Subject: Re: [PATCH v2 net-next] net: phy: adjust fixed_phy_register() return value
Date: Tue, 07 Oct 2014 00:07:54 -0400 (EDT)	[thread overview]
Message-ID: <20141007.000754.1011567266866832634.davem@davemloft.net> (raw)
In-Reply-To: <20141006183830.D4E82100BC1@puck.mtv.corp.google.com>

From: Petri Gynther <pgynther@google.com>
Date: Mon,  6 Oct 2014 11:38:30 -0700 (PDT)

> Adjust fixed_phy_register() to return struct phy_device *, so that
> it becomes easy to use fixed PHYs without device tree support:
> 
>   phydev = fixed_phy_register(PHY_POLL, &fixed_phy_status, NULL);
>   fixed_phy_set_link_update(phydev, fixed_phy_link_update);
>   phy_connect_direct(netdev, phydev, handler_fn, phy_interface);
> 
> This change is a prerequisite for modifying bcmgenet driver to work
> without a device tree on Broadcom's MIPS-based 7xxx platforms.
> 
> Signed-off-by: Petri Gynther <pgynther@google.com>

If the caller gets this 'phy' pointer and does something with it,
something seems amiss.

We don't hold an extra reference to the 'phy' object for the caller,
so another thread of control can unregister it and kill that last
reference and therefore free it up.

I think to be legitimate, you have to hold an extra reference on
'phy' for the caller.  And now that means that code paths that
don't need to do anything with 'phy' now will need to release
that reference.

  reply	other threads:[~2014-10-07  4:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06 18:38 [PATCH v2 net-next] net: phy: adjust fixed_phy_register() return value Petri Gynther
2014-10-07  4:07 ` David Miller [this message]
2014-10-07 16:48   ` Petri Gynther
     [not found]   ` <CAGXr9JF8fx6YH3szY=nwxTJeJgopBCW9Kzhcs33q4oFG5GNOBQ@mail.gmail.com>
2014-10-07 17:02     ` David Miller

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=20141007.000754.1011567266866832634.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pgynther@google.com \
    --cc=thomas.petazzoni@free-electrons.com \
    /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;
as well as URLs for NNTP newsgroup(s).