linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Use refcount_t for refcount
@ 2019-08-02 12:10 Chuhong Yuan
  2019-08-04 12:48 ` Leon Romanovsky
  0 siblings, 1 reply; 4+ messages in thread
From: Chuhong Yuan @ 2019-08-02 12:10 UTC (permalink / raw)
  Cc: Leon Romanovsky, Saeed Mahameed, David S . Miller, Doug Ledford,
	Jason Gunthorpe, linux-rdma, netdev, linux-kernel, Chuhong Yuan

Reference counters are preferred to use refcount_t instead of
atomic_t.
This is because the implementation of refcount_t can prevent
overflows and detect possible use-after-free.

First convert the refcount field to refcount_t in mlx5/driver.h.
Then convert the uses to refcount_() APIs.

Chuhong Yuan (3):
  mlx5: Use refcount_t for refcount
  net/mlx5: Use refcount_() APIs
  IB/mlx5: Use refcount_() APIs

 drivers/infiniband/hw/mlx5/srq_cmd.c         | 6 +++---
 drivers/net/ethernet/mellanox/mlx5/core/qp.c | 6 +++---
 include/linux/mlx5/driver.h                  | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/3] Use refcount_t for refcount
  2019-08-02 12:10 [PATCH 0/3] Use refcount_t for refcount Chuhong Yuan
@ 2019-08-04 12:48 ` Leon Romanovsky
  2019-08-04 14:58   ` Chuhong Yuan
  0 siblings, 1 reply; 4+ messages in thread
From: Leon Romanovsky @ 2019-08-04 12:48 UTC (permalink / raw)
  To: Chuhong Yuan
  Cc: Saeed Mahameed, David S . Miller, Doug Ledford, Jason Gunthorpe,
	linux-rdma, netdev, linux-kernel

On Fri, Aug 02, 2019 at 08:10:35PM +0800, Chuhong Yuan wrote:
> Reference counters are preferred to use refcount_t instead of
> atomic_t.
> This is because the implementation of refcount_t can prevent
> overflows and detect possible use-after-free.
>
> First convert the refcount field to refcount_t in mlx5/driver.h.
> Then convert the uses to refcount_() APIs.

You can't do it, because you need to ensure that driver compiles and
works between patches. By converting driver.h alone to refcount_t, you
simply broke mlx5 driver.

NAK, to be clear.

And please don't sent series of patches as standalone patches.

Thanks,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/3] Use refcount_t for refcount
  2019-08-04 12:48 ` Leon Romanovsky
@ 2019-08-04 14:58   ` Chuhong Yuan
  2019-08-05  5:57     ` Leon Romanovsky
  0 siblings, 1 reply; 4+ messages in thread
From: Chuhong Yuan @ 2019-08-04 14:58 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Saeed Mahameed, David S . Miller, Doug Ledford, Jason Gunthorpe,
	linux-rdma, Netdev, LKML

On Sun, Aug 4, 2019 at 8:48 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Fri, Aug 02, 2019 at 08:10:35PM +0800, Chuhong Yuan wrote:
> > Reference counters are preferred to use refcount_t instead of
> > atomic_t.
> > This is because the implementation of refcount_t can prevent
> > overflows and detect possible use-after-free.
> >
> > First convert the refcount field to refcount_t in mlx5/driver.h.
> > Then convert the uses to refcount_() APIs.
>
> You can't do it, because you need to ensure that driver compiles and
> works between patches. By converting driver.h alone to refcount_t, you
> simply broke mlx5 driver.
>

It is my fault... I am not clear how to send patches which cross
several subsystems, so I sent them in series.
Maybe I should merge these patches together?


> NAK, to be clear.
>
> And please don't sent series of patches as standalone patches.
>

Due to the reason mentioned above, I sent them seperately.

> Thanks,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/3] Use refcount_t for refcount
  2019-08-04 14:58   ` Chuhong Yuan
@ 2019-08-05  5:57     ` Leon Romanovsky
  0 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2019-08-05  5:57 UTC (permalink / raw)
  To: Chuhong Yuan
  Cc: Saeed Mahameed, David S . Miller, Doug Ledford, Jason Gunthorpe,
	linux-rdma, Netdev, LKML

On Sun, Aug 04, 2019 at 10:58:19PM +0800, Chuhong Yuan wrote:
> On Sun, Aug 4, 2019 at 8:48 PM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > On Fri, Aug 02, 2019 at 08:10:35PM +0800, Chuhong Yuan wrote:
> > > Reference counters are preferred to use refcount_t instead of
> > > atomic_t.
> > > This is because the implementation of refcount_t can prevent
> > > overflows and detect possible use-after-free.
> > >
> > > First convert the refcount field to refcount_t in mlx5/driver.h.
> > > Then convert the uses to refcount_() APIs.
> >
> > You can't do it, because you need to ensure that driver compiles and
> > works between patches. By converting driver.h alone to refcount_t, you
> > simply broke mlx5 driver.
> >
>
> It is my fault... I am not clear how to send patches which cross
> several subsystems, so I sent them in series.
> Maybe I should merge these patches together?

In case of conversion patches, yes, you need to perform such change
in one shot.

>
>
> > NAK, to be clear.
> >
> > And please don't sent series of patches as standalone patches.
> >
>
> Due to the reason mentioned above, I sent them seperately.

Create patch, run ./scripts/get_maintainer.pl on it and send according
to generated output. You are not doing kernel core changes and there is
no need to worry about cross subsystem complexity as long as you will
put relevant maintainers in TO: field.

Thanks

>
> > Thanks,

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-05  5:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 12:10 [PATCH 0/3] Use refcount_t for refcount Chuhong Yuan
2019-08-04 12:48 ` Leon Romanovsky
2019-08-04 14:58   ` Chuhong Yuan
2019-08-05  5:57     ` Leon Romanovsky

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).