Commit e9bcbc97 authored by David S. Miller's avatar David S. Miller

Merge branch 's390-next'

Frank Blaschka says:

====================
s390: network patches for net-next V1

here are some s390 related patches for net-next
Added some style fixing reported by David Laight.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 078252e0 a68be015
...@@ -34,8 +34,9 @@ static ssize_t ctcm_buffer_write(struct device *dev, ...@@ -34,8 +34,9 @@ static ssize_t ctcm_buffer_write(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
struct net_device *ndev; struct net_device *ndev;
int bs1; unsigned int bs1;
struct ctcm_priv *priv = dev_get_drvdata(dev); struct ctcm_priv *priv = dev_get_drvdata(dev);
int rc;
ndev = priv->channel[CTCM_READ]->netdev; ndev = priv->channel[CTCM_READ]->netdev;
if (!(priv && priv->channel[CTCM_READ] && ndev)) { if (!(priv && priv->channel[CTCM_READ] && ndev)) {
...@@ -43,7 +44,9 @@ static ssize_t ctcm_buffer_write(struct device *dev, ...@@ -43,7 +44,9 @@ static ssize_t ctcm_buffer_write(struct device *dev,
return -ENODEV; return -ENODEV;
} }
sscanf(buf, "%u", &bs1); rc = sscanf(buf, "%u", &bs1);
if (rc != 1)
goto einval;
if (bs1 > CTCM_BUFSIZE_LIMIT) if (bs1 > CTCM_BUFSIZE_LIMIT)
goto einval; goto einval;
if (bs1 < (576 + LL_HEADER_LENGTH + 2)) if (bs1 < (576 + LL_HEADER_LENGTH + 2))
...@@ -143,13 +146,14 @@ static ssize_t ctcm_proto_show(struct device *dev, ...@@ -143,13 +146,14 @@ static ssize_t ctcm_proto_show(struct device *dev,
static ssize_t ctcm_proto_store(struct device *dev, static ssize_t ctcm_proto_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
int value; int value, rc;
struct ctcm_priv *priv = dev_get_drvdata(dev); struct ctcm_priv *priv = dev_get_drvdata(dev);
if (!priv) if (!priv)
return -ENODEV; return -ENODEV;
sscanf(buf, "%u", &value); rc = sscanf(buf, "%d", &value);
if (!((value == CTCM_PROTO_S390) || if ((rc != 1) ||
!((value == CTCM_PROTO_S390) ||
(value == CTCM_PROTO_LINUX) || (value == CTCM_PROTO_LINUX) ||
(value == CTCM_PROTO_MPC) || (value == CTCM_PROTO_MPC) ||
(value == CTCM_PROTO_OS390))) (value == CTCM_PROTO_OS390)))
......
...@@ -1943,14 +1943,16 @@ static ssize_t ...@@ -1943,14 +1943,16 @@ static ssize_t
lcs_portno_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) lcs_portno_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
struct lcs_card *card; struct lcs_card *card;
int value; int value, rc;
card = dev_get_drvdata(dev); card = dev_get_drvdata(dev);
if (!card) if (!card)
return 0; return 0;
sscanf(buf, "%u", &value); rc = sscanf(buf, "%d", &value);
if (rc != 1)
return -EINVAL;
/* TODO: sanity checks */ /* TODO: sanity checks */
card->portno = value; card->portno = value;
...@@ -1997,14 +1999,17 @@ static ssize_t ...@@ -1997,14 +1999,17 @@ static ssize_t
lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
struct lcs_card *card; struct lcs_card *card;
int value; unsigned int value;
int rc;
card = dev_get_drvdata(dev); card = dev_get_drvdata(dev);
if (!card) if (!card)
return 0; return 0;
sscanf(buf, "%u", &value); rc = sscanf(buf, "%u", &value);
if (rc != 1)
return -EINVAL;
/* TODO: sanity checks */ /* TODO: sanity checks */
card->lancmd_timeout = value; card->lancmd_timeout = value;
......
...@@ -1013,7 +1013,7 @@ static long __qeth_check_irb_error(struct ccw_device *cdev, ...@@ -1013,7 +1013,7 @@ static long __qeth_check_irb_error(struct ccw_device *cdev,
card = CARD_FROM_CDEV(cdev); card = CARD_FROM_CDEV(cdev);
if (!IS_ERR(irb)) if (!card || !IS_ERR(irb))
return 0; return 0;
switch (PTR_ERR(irb)) { switch (PTR_ERR(irb)) {
...@@ -1029,7 +1029,7 @@ static long __qeth_check_irb_error(struct ccw_device *cdev, ...@@ -1029,7 +1029,7 @@ static long __qeth_check_irb_error(struct ccw_device *cdev,
QETH_CARD_TEXT(card, 2, "ckirberr"); QETH_CARD_TEXT(card, 2, "ckirberr");
QETH_CARD_TEXT_(card, 2, " rc%d", -ETIMEDOUT); QETH_CARD_TEXT_(card, 2, " rc%d", -ETIMEDOUT);
if (intparm == QETH_RCD_PARM) { if (intparm == QETH_RCD_PARM) {
if (card && (card->data.ccwdev == cdev)) { if (card->data.ccwdev == cdev) {
card->data.state = CH_STATE_DOWN; card->data.state = CH_STATE_DOWN;
wake_up(&card->wait_q); wake_up(&card->wait_q);
} }
......
...@@ -63,7 +63,7 @@ void qeth_l3_ipaddr4_to_string(const __u8 *addr, char *buf) ...@@ -63,7 +63,7 @@ void qeth_l3_ipaddr4_to_string(const __u8 *addr, char *buf)
int qeth_l3_string_to_ipaddr4(const char *buf, __u8 *addr) int qeth_l3_string_to_ipaddr4(const char *buf, __u8 *addr)
{ {
int count = 0, rc = 0; int count = 0, rc = 0;
int in[4]; unsigned int in[4];
char c; char c;
rc = sscanf(buf, "%u.%u.%u.%u%c", rc = sscanf(buf, "%u.%u.%u.%u%c",
......
...@@ -682,6 +682,18 @@ struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock) ...@@ -682,6 +682,18 @@ struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock)
return NULL; return NULL;
} }
static void __iucv_auto_name(struct iucv_sock *iucv)
{
char name[12];
sprintf(name, "%08x", atomic_inc_return(&iucv_sk_list.autobind_name));
while (__iucv_get_sock_by_name(name)) {
sprintf(name, "%08x",
atomic_inc_return(&iucv_sk_list.autobind_name));
}
memcpy(iucv->src_name, name, 8);
}
/* Bind an unbound socket */ /* Bind an unbound socket */
static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr, static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr,
int addr_len) int addr_len)
...@@ -724,8 +736,12 @@ static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr, ...@@ -724,8 +736,12 @@ static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr,
rcu_read_lock(); rcu_read_lock();
for_each_netdev_rcu(&init_net, dev) { for_each_netdev_rcu(&init_net, dev) {
if (!memcmp(dev->perm_addr, uid, 8)) { if (!memcmp(dev->perm_addr, uid, 8)) {
memcpy(iucv->src_name, sa->siucv_name, 8);
memcpy(iucv->src_user_id, sa->siucv_user_id, 8); memcpy(iucv->src_user_id, sa->siucv_user_id, 8);
/* Check for unitialized siucv_name */
if (strncmp(sa->siucv_name, " ", 8) == 0)
__iucv_auto_name(iucv);
else
memcpy(iucv->src_name, sa->siucv_name, 8);
sk->sk_bound_dev_if = dev->ifindex; sk->sk_bound_dev_if = dev->ifindex;
iucv->hs_dev = dev; iucv->hs_dev = dev;
dev_hold(dev); dev_hold(dev);
...@@ -763,7 +779,6 @@ static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr, ...@@ -763,7 +779,6 @@ static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr,
static int iucv_sock_autobind(struct sock *sk) static int iucv_sock_autobind(struct sock *sk)
{ {
struct iucv_sock *iucv = iucv_sk(sk); struct iucv_sock *iucv = iucv_sk(sk);
char name[12];
int err = 0; int err = 0;
if (unlikely(!pr_iucv)) if (unlikely(!pr_iucv))
...@@ -772,17 +787,9 @@ static int iucv_sock_autobind(struct sock *sk) ...@@ -772,17 +787,9 @@ static int iucv_sock_autobind(struct sock *sk)
memcpy(iucv->src_user_id, iucv_userid, 8); memcpy(iucv->src_user_id, iucv_userid, 8);
write_lock_bh(&iucv_sk_list.lock); write_lock_bh(&iucv_sk_list.lock);
__iucv_auto_name(iucv);
sprintf(name, "%08x", atomic_inc_return(&iucv_sk_list.autobind_name));
while (__iucv_get_sock_by_name(name)) {
sprintf(name, "%08x",
atomic_inc_return(&iucv_sk_list.autobind_name));
}
write_unlock_bh(&iucv_sk_list.lock); write_unlock_bh(&iucv_sk_list.lock);
memcpy(&iucv->src_name, name, 8);
if (!iucv->msglimit) if (!iucv->msglimit)
iucv->msglimit = IUCV_QUEUELEN_DEFAULT; iucv->msglimit = IUCV_QUEUELEN_DEFAULT;
...@@ -1936,11 +1943,10 @@ static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb) ...@@ -1936,11 +1943,10 @@ static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb)
sk_acceptq_is_full(sk) || sk_acceptq_is_full(sk) ||
!nsk) { !nsk) {
/* error on server socket - connection refused */ /* error on server socket - connection refused */
if (nsk)
sk_free(nsk);
afiucv_swap_src_dest(skb); afiucv_swap_src_dest(skb);
trans_hdr->flags = AF_IUCV_FLAG_SYN | AF_IUCV_FLAG_FIN; trans_hdr->flags = AF_IUCV_FLAG_SYN | AF_IUCV_FLAG_FIN;
err = dev_queue_xmit(skb); err = dev_queue_xmit(skb);
iucv_sock_kill(nsk);
bh_unlock_sock(sk); bh_unlock_sock(sk);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment