[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191217.140930.477589169001575109.davem@davemloft.net>
Date: Tue, 17 Dec 2019 14:09:30 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: rahul.lakkireddy@...lsio.com
Cc: netdev@...r.kernel.org, nirranjan@...lsio.com, vishal@...lsio.com,
dt@...lsio.com
Subject: Re: [PATCH net] cxgb4: fix refcount init for TC-MQPRIO offload
From: Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>
Date: Mon, 16 Dec 2019 19:54:02 +0530
> @@ -205,7 +205,11 @@ static int cxgb4_mqprio_alloc_hw_resources(struct net_device *dev)
> cxgb4_enable_rx(adap, &eorxq->rspq);
> }
>
> - refcount_inc(&adap->tc_mqprio->refcnt);
> + if (!refcount_read(&adap->tc_mqprio->refcnt))
> + refcount_set(&adap->tc_mqprio->refcnt, 1);
> + else
> + refcount_inc(&adap->tc_mqprio->refcnt);
> +
This is not correct.
You're bypassing the whole point of the refcount_t type which is to make sure
that code that initializes a new object explicitly calls refcount_set() and
that once the refcount goes to zero the object is freed or the refcount is
initialized again using refcount_set() or similar.
I'm not applying this, it's just papering around the real problem.
Powered by blists - more mailing lists