lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 14 Mar 2011 15:09:15 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Kurt Van Dijck <kurt.van.dijck@....be>
Cc:	socketcan-core@...ts.berlios.de, netdev@...r.kernel.org
Subject: Re: [RFC v3 3/6] can: make struct proto const

Le lundi 14 mars 2011 à 14:47 +0100, Kurt Van Dijck a écrit :
> can_ioctl is the only reason for struct proto to be non-const.
> script/check-patch.pl suggests struct proto be const.
> This patch performs the necessary change.
> 
> Signed-off-by: Kurt Van Dijck <kurt.van.dijck@....be>
> ---
> diff --git a/include/linux/can/core.h b/include/linux/can/core.h
> index 430c446..0767cc6 100644
> --- a/include/linux/can/core.h
> +++ b/include/linux/can/core.h
> @@ -39,7 +39,7 @@
>  struct can_proto {
>  	int              type;
>  	int              protocol;
> -	struct proto_ops *ops;
> +	const struct proto_ops *ops;
>  	struct proto     *prot;
>  
>  	const struct rtnl_af_ops *rtnl_link_ops;
> @@ -78,6 +78,8 @@ struct rtgencanmsg {
>  
>  extern int  can_proto_register(const struct can_proto *cp);
>  extern void can_proto_unregister(const struct can_proto *cp);
> +extern int can_sock_ioctl(struct socket *sock, unsigned int cmd,
> +		unsigned long arg);
>  
>  extern int  can_rx_register(struct net_device *dev, canid_t can_id,
>  			    canid_t mask,
> diff --git a/net/can/af_can.c b/net/can/af_can.c
> index db59c6e..c1f8c05 100644
> --- a/net/can/af_can.c
> +++ b/net/can/af_can.c
> @@ -139,7 +139,7 @@ static inline void can_put_proto(const struct can_proto *cp)
>   * af_can socket functions
>   */
>  
> -static int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
> +int can_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
>  {
>  	struct sock *sk = sock->sk;
>  
> @@ -152,6 +152,7 @@ static int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
>  		return -ENOIOCTLCMD;
>  	}
>  }
> +EXPORT_SYMBOL(can_sock_ioctl);
>  
>  static void can_sock_destruct(struct sock *sk)
>  {
> @@ -720,10 +721,6 @@ int can_proto_register(const struct can_proto *cp)
>  		err = -EBUSY;
>  	} else {
>  		proto_tab[proto] = cp;
> -
> -		/* use generic ioctl function if not defined by module */
> -		if (!cp->ops->ioctl)
> -			cp->ops->ioctl = can_ioctl;

Hmm, you actually fixed a race / bug, since we installed in proto_tab[]
a pointer to a not yet initted ops structure.

I suggest you change patch title and changelog to properly describe the
bug fix.



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ