[dpdk-dev,v2,1/3] security: fix device operation type

Message ID 5ed1354d41a6370faa8887a6f3acd1e20ef09668.1511431327.git.nelio.laranjeiro@6wind.com
State Accepted, archived
Delegated to: Pablo de Lara Guarch
Headers show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Nélio Laranjeiro Nov. 23, 2017, 10:02 a.m.
Device operation pointers should be constant to avoid any modification
while it is in use.

Fixes: c261d1431bd8 ("security: introduce security API and framework")
Cc: akhil.goyal@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 lib/librte_security/rte_security.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Akhil Goyal Nov. 24, 2017, 9:33 a.m. | #1
Hi Nelio,
On 11/23/2017 3:32 PM, Nelio Laranjeiro wrote:
> Device operation pointers should be constant to avoid any modification
> while it is in use.
> 
> Fixes: c261d1431bd8 ("security: introduce security API and framework")
> Cc: akhil.goyal@nxp.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
>   lib/librte_security/rte_security.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
> index aa3a471a3..679c0a696 100644
> --- a/lib/librte_security/rte_security.h
> +++ b/lib/librte_security/rte_security.h
> @@ -94,7 +94,7 @@ enum rte_security_ipsec_tunnel_type {
>   struct rte_security_ctx {
>   	void *device;
>   	/**< Crypto/ethernet device attached */
> -	struct rte_security_ops *ops;
> +	const struct rte_security_ops *ops;
Do we require this change for crypto ops as well.
>   	/**< Pointer to security ops for the device */
>   	uint16_t sess_cnt;
>   	/**< Number of sessions attached to this context */
>
Nélio Laranjeiro Nov. 24, 2017, 12:07 p.m. | #2
On Fri, Nov 24, 2017 at 03:03:52PM +0530, Akhil Goyal wrote:
> Hi Nelio,
> On 11/23/2017 3:32 PM, Nelio Laranjeiro wrote:
> > Device operation pointers should be constant to avoid any modification
> > while it is in use.
> > 
> > Fixes: c261d1431bd8 ("security: introduce security API and framework")
> > Cc: akhil.goyal@nxp.com
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > ---
> >   lib/librte_security/rte_security.h | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
> > index aa3a471a3..679c0a696 100644
> > --- a/lib/librte_security/rte_security.h
> > +++ b/lib/librte_security/rte_security.h
> > @@ -94,7 +94,7 @@ enum rte_security_ipsec_tunnel_type {
> >   struct rte_security_ctx {
> >   	void *device;
> >   	/**< Crypto/ethernet device attached */
> > -	struct rte_security_ops *ops;
> > +	const struct rte_security_ops *ops;
> Do we require this change for crypto ops as well.

Yes, only drivers should be able to change modify this pointer.

> >   	/**< Pointer to security ops for the device */
> >   	uint16_t sess_cnt;
> >   	/**< Number of sessions attached to this context */
> > 
 
Thanks,
De Lara Guarch, Pablo Jan. 8, 2018, 9:58 a.m. | #3
> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Nelio
> Laranjeiro
> Sent: Friday, November 24, 2017 12:07 PM
> To: Akhil Goyal <akhil.goyal@nxp.com>
> Cc: Doherty, Declan <declan.doherty@intel.com>; dev@dpdk.org; Gaetan
> Rivet <gaetan.rivet@6wind.com>; stable@dpdk.org
> Subject: Re: [dpdk-stable] [PATCH v2 1/3] security: fix device operation type
> 
> On Fri, Nov 24, 2017 at 03:03:52PM +0530, Akhil Goyal wrote:
> > Hi Nelio,
> > On 11/23/2017 3:32 PM, Nelio Laranjeiro wrote:
> > > Device operation pointers should be constant to avoid any
> > > modification while it is in use.
> > >
> > > Fixes: c261d1431bd8 ("security: introduce security API and
> > > framework")
> > > Cc: akhil.goyal@nxp.com
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Akhil, do you agree with the change? I am waiting for an ack here to integrate this patch with the rest of the patchset.

Thanks,
Pablo
Akhil Goyal Jan. 8, 2018, 10:05 a.m. | #4
On 1/8/2018 3:28 PM, De Lara Guarch, Pablo wrote:
> 
> 
>> -----Original Message-----
>> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Nelio
>> Laranjeiro
>> Sent: Friday, November 24, 2017 12:07 PM
>> To: Akhil Goyal <akhil.goyal@nxp.com>
>> Cc: Doherty, Declan <declan.doherty@intel.com>; dev@dpdk.org; Gaetan
>> Rivet <gaetan.rivet@6wind.com>; stable@dpdk.org
>> Subject: Re: [dpdk-stable] [PATCH v2 1/3] security: fix device operation type
>>
>> On Fri, Nov 24, 2017 at 03:03:52PM +0530, Akhil Goyal wrote:
>>> Hi Nelio,
>>> On 11/23/2017 3:32 PM, Nelio Laranjeiro wrote:
>>>> Device operation pointers should be constant to avoid any
>>>> modification while it is in use.
>>>>
>>>> Fixes: c261d1431bd8 ("security: introduce security API and
>>>> framework")
>>>> Cc: akhil.goyal@nxp.com
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> 
> Akhil, do you agree with the change? I am waiting for an ack here to integrate this patch with the rest of the patchset.
> 
> Thanks,
> Pablo
> 
> 
Yes I agree to this change.
Just suggesting this change for crypto ops as well.

Acked-by: Akhil Goyal <akhil.goyal@nxp.com
De Lara Guarch, Pablo Jan. 8, 2018, 12:34 p.m. | #5
> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Nelio
> Laranjeiro
> Sent: Thursday, November 23, 2017 10:03 AM
> To: Akhil Goyal <akhil.goyal@nxp.com>; Doherty, Declan
> <declan.doherty@intel.com>
> Cc: dev@dpdk.org; Gaetan Rivet <gaetan.rivet@6wind.com>;
> stable@dpdk.org
> Subject: [dpdk-stable] [PATCH v2 1/3] security: fix device operation type
> 
> Device operation pointers should be constant to avoid any modification
> while it is in use.
> 
> Fixes: c261d1431bd8 ("security: introduce security API and framework")
> Cc: akhil.goyal@nxp.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

Patch

diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
index aa3a471a3..679c0a696 100644
--- a/lib/librte_security/rte_security.h
+++ b/lib/librte_security/rte_security.h
@@ -94,7 +94,7 @@  enum rte_security_ipsec_tunnel_type {
 struct rte_security_ctx {
 	void *device;
 	/**< Crypto/ethernet device attached */
-	struct rte_security_ops *ops;
+	const struct rte_security_ops *ops;
 	/**< Pointer to security ops for the device */
 	uint16_t sess_cnt;
 	/**< Number of sessions attached to this context */