hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/iucv/af_iucv.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * IUCV protocol stack for Linux on zSeries
34 *
....@@ -15,6 +16,7 @@
1516 #include <linux/module.h>
1617 #include <linux/netdevice.h>
1718 #include <linux/types.h>
19
+#include <linux/limits.h>
1820 #include <linux/list.h>
1921 #include <linux/errno.h>
2022 #include <linux/kernel.h>
....@@ -35,8 +37,6 @@
3537
3638 static char iucv_userid[80];
3739
38
-static const struct proto_ops iucv_sock_ops;
39
-
4040 static struct proto iucv_proto = {
4141 .name = "AF_IUCV",
4242 .owner = THIS_MODULE,
....@@ -49,7 +49,7 @@
4949 static const u8 iprm_shutdown[8] =
5050 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
5151
52
-#define TRGCLS_SIZE (sizeof(((struct iucv_message *)0)->class))
52
+#define TRGCLS_SIZE sizeof_field(struct iucv_message, class)
5353
5454 #define __iucv_sock_wait(sk, condition, timeo, ret) \
5555 do { \
....@@ -84,14 +84,11 @@
8484 __ret; \
8585 })
8686
87
+static struct sock *iucv_accept_dequeue(struct sock *parent,
88
+ struct socket *newsock);
8789 static void iucv_sock_kill(struct sock *sk);
8890 static void iucv_sock_close(struct sock *sk);
89
-static void iucv_sever_path(struct sock *, int);
9091
91
-static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev,
92
- struct packet_type *pt, struct net_device *orig_dev);
93
-static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock,
94
- struct sk_buff *skb, u8 flags);
9592 static void afiucv_hs_callback_txnotify(struct sk_buff *, enum iucv_tx_notify);
9693
9794 /* Call Back functions */
....@@ -125,110 +122,6 @@
125122 {
126123 memcpy(&dst[8], src, 8);
127124 }
128
-
129
-static int afiucv_pm_prepare(struct device *dev)
130
-{
131
-#ifdef CONFIG_PM_DEBUG
132
- printk(KERN_WARNING "afiucv_pm_prepare\n");
133
-#endif
134
- return 0;
135
-}
136
-
137
-static void afiucv_pm_complete(struct device *dev)
138
-{
139
-#ifdef CONFIG_PM_DEBUG
140
- printk(KERN_WARNING "afiucv_pm_complete\n");
141
-#endif
142
-}
143
-
144
-/**
145
- * afiucv_pm_freeze() - Freeze PM callback
146
- * @dev: AFIUCV dummy device
147
- *
148
- * Sever all established IUCV communication pathes
149
- */
150
-static int afiucv_pm_freeze(struct device *dev)
151
-{
152
- struct iucv_sock *iucv;
153
- struct sock *sk;
154
-
155
-#ifdef CONFIG_PM_DEBUG
156
- printk(KERN_WARNING "afiucv_pm_freeze\n");
157
-#endif
158
- read_lock(&iucv_sk_list.lock);
159
- sk_for_each(sk, &iucv_sk_list.head) {
160
- iucv = iucv_sk(sk);
161
- switch (sk->sk_state) {
162
- case IUCV_DISCONN:
163
- case IUCV_CLOSING:
164
- case IUCV_CONNECTED:
165
- iucv_sever_path(sk, 0);
166
- break;
167
- case IUCV_OPEN:
168
- case IUCV_BOUND:
169
- case IUCV_LISTEN:
170
- case IUCV_CLOSED:
171
- default:
172
- break;
173
- }
174
- skb_queue_purge(&iucv->send_skb_q);
175
- skb_queue_purge(&iucv->backlog_skb_q);
176
- }
177
- read_unlock(&iucv_sk_list.lock);
178
- return 0;
179
-}
180
-
181
-/**
182
- * afiucv_pm_restore_thaw() - Thaw and restore PM callback
183
- * @dev: AFIUCV dummy device
184
- *
185
- * socket clean up after freeze
186
- */
187
-static int afiucv_pm_restore_thaw(struct device *dev)
188
-{
189
- struct sock *sk;
190
-
191
-#ifdef CONFIG_PM_DEBUG
192
- printk(KERN_WARNING "afiucv_pm_restore_thaw\n");
193
-#endif
194
- read_lock(&iucv_sk_list.lock);
195
- sk_for_each(sk, &iucv_sk_list.head) {
196
- switch (sk->sk_state) {
197
- case IUCV_CONNECTED:
198
- sk->sk_err = EPIPE;
199
- sk->sk_state = IUCV_DISCONN;
200
- sk->sk_state_change(sk);
201
- break;
202
- case IUCV_DISCONN:
203
- case IUCV_CLOSING:
204
- case IUCV_LISTEN:
205
- case IUCV_BOUND:
206
- case IUCV_OPEN:
207
- default:
208
- break;
209
- }
210
- }
211
- read_unlock(&iucv_sk_list.lock);
212
- return 0;
213
-}
214
-
215
-static const struct dev_pm_ops afiucv_pm_ops = {
216
- .prepare = afiucv_pm_prepare,
217
- .complete = afiucv_pm_complete,
218
- .freeze = afiucv_pm_freeze,
219
- .thaw = afiucv_pm_restore_thaw,
220
- .restore = afiucv_pm_restore_thaw,
221
-};
222
-
223
-static struct device_driver af_iucv_driver = {
224
- .owner = THIS_MODULE,
225
- .name = "afiucv",
226
- .bus = NULL,
227
- .pm = &afiucv_pm_ops,
228
-};
229
-
230
-/* dummy device used as trigger for PM functions */
231
-static struct device *af_iucv_dev;
232125
233126 /**
234127 * iucv_msg_length() - Returns the length of an iucv message.
....@@ -321,13 +214,9 @@
321214 struct sk_buff *nskb;
322215 int err, confirm_recv = 0;
323216
324
- memset(skb->head, 0, ETH_HLEN);
325
- phs_hdr = skb_push(skb, sizeof(struct af_iucv_trans_hdr));
326
- skb_reset_mac_header(skb);
217
+ phs_hdr = skb_push(skb, sizeof(*phs_hdr));
218
+ memset(phs_hdr, 0, sizeof(*phs_hdr));
327219 skb_reset_network_header(skb);
328
- skb_push(skb, ETH_HLEN);
329
- skb_reset_mac_header(skb);
330
- memset(phs_hdr, 0, sizeof(struct af_iucv_trans_hdr));
331220
332221 phs_hdr->magic = ETH_P_AF_IUCV;
333222 phs_hdr->version = 1;
....@@ -438,6 +327,20 @@
438327 parent->sk_state = IUCV_CLOSED;
439328 }
440329
330
+static void iucv_sock_link(struct iucv_sock_list *l, struct sock *sk)
331
+{
332
+ write_lock_bh(&l->lock);
333
+ sk_add_node(sk, &l->head);
334
+ write_unlock_bh(&l->lock);
335
+}
336
+
337
+static void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *sk)
338
+{
339
+ write_lock_bh(&l->lock);
340
+ sk_del_node_init(sk);
341
+ write_unlock_bh(&l->lock);
342
+}
343
+
441344 /* Kill socket (only if zapped and orphaned) */
442345 static void iucv_sock_kill(struct sock *sk)
443346 {
....@@ -515,7 +418,9 @@
515418 sk->sk_state = IUCV_DISCONN;
516419 sk->sk_state_change(sk);
517420 }
518
- case IUCV_DISCONN: /* fall through */
421
+ fallthrough;
422
+
423
+ case IUCV_DISCONN:
519424 sk->sk_state = IUCV_CLOSING;
520425 sk->sk_state_change(sk);
521426
....@@ -528,8 +433,9 @@
528433 iucv_sock_in_state(sk, IUCV_CLOSED, 0),
529434 timeo);
530435 }
436
+ fallthrough;
531437
532
- case IUCV_CLOSING: /* fall through */
438
+ case IUCV_CLOSING:
533439 sk->sk_state = IUCV_CLOSED;
534440 sk->sk_state_change(sk);
535441
....@@ -538,8 +444,9 @@
538444
539445 skb_queue_purge(&iucv->send_skb_q);
540446 skb_queue_purge(&iucv->backlog_skb_q);
447
+ fallthrough;
541448
542
- default: /* fall through */
449
+ default:
543450 iucv_sever_path(sk, 1);
544451 }
545452
....@@ -596,7 +503,6 @@
596503
597504 sk->sk_destruct = iucv_sock_destruct;
598505 sk->sk_sndtimeo = IUCV_CONN_TIMEOUT;
599
- sk->sk_allocation = GFP_DMA;
600506
601507 sock_reset_flag(sk, SOCK_ZAPPED);
602508
....@@ -607,53 +513,7 @@
607513 return sk;
608514 }
609515
610
-/* Create an IUCV socket */
611
-static int iucv_sock_create(struct net *net, struct socket *sock, int protocol,
612
- int kern)
613
-{
614
- struct sock *sk;
615
-
616
- if (protocol && protocol != PF_IUCV)
617
- return -EPROTONOSUPPORT;
618
-
619
- sock->state = SS_UNCONNECTED;
620
-
621
- switch (sock->type) {
622
- case SOCK_STREAM:
623
- sock->ops = &iucv_sock_ops;
624
- break;
625
- case SOCK_SEQPACKET:
626
- /* currently, proto ops can handle both sk types */
627
- sock->ops = &iucv_sock_ops;
628
- break;
629
- default:
630
- return -ESOCKTNOSUPPORT;
631
- }
632
-
633
- sk = iucv_sock_alloc(sock, protocol, GFP_KERNEL, kern);
634
- if (!sk)
635
- return -ENOMEM;
636
-
637
- iucv_sock_init(sk, NULL);
638
-
639
- return 0;
640
-}
641
-
642
-void iucv_sock_link(struct iucv_sock_list *l, struct sock *sk)
643
-{
644
- write_lock_bh(&l->lock);
645
- sk_add_node(sk, &l->head);
646
- write_unlock_bh(&l->lock);
647
-}
648
-
649
-void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *sk)
650
-{
651
- write_lock_bh(&l->lock);
652
- sk_del_node_init(sk);
653
- write_unlock_bh(&l->lock);
654
-}
655
-
656
-void iucv_accept_enqueue(struct sock *parent, struct sock *sk)
516
+static void iucv_accept_enqueue(struct sock *parent, struct sock *sk)
657517 {
658518 unsigned long flags;
659519 struct iucv_sock *par = iucv_sk(parent);
....@@ -666,7 +526,7 @@
666526 sk_acceptq_added(parent);
667527 }
668528
669
-void iucv_accept_unlink(struct sock *sk)
529
+static void iucv_accept_unlink(struct sock *sk)
670530 {
671531 unsigned long flags;
672532 struct iucv_sock *par = iucv_sk(iucv_sk(sk)->parent);
....@@ -679,7 +539,8 @@
679539 sock_put(sk);
680540 }
681541
682
-struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock)
542
+static struct sock *iucv_accept_dequeue(struct sock *parent,
543
+ struct socket *newsock)
683544 {
684545 struct iucv_sock *isk, *n;
685546 struct sock *sk;
....@@ -727,11 +588,11 @@
727588 int addr_len)
728589 {
729590 struct sockaddr_iucv *sa = (struct sockaddr_iucv *) addr;
591
+ char uid[sizeof(sa->siucv_user_id)];
730592 struct sock *sk = sock->sk;
731593 struct iucv_sock *iucv;
732594 int err = 0;
733595 struct net_device *dev;
734
- char uid[9];
735596
736597 /* Verify the input sockaddr */
737598 if (addr_len < sizeof(struct sockaddr_iucv) ||
....@@ -790,6 +651,7 @@
790651 memcpy(iucv->src_user_id, iucv_userid, 8);
791652 sk->sk_state = IUCV_BOUND;
792653 iucv->transport = AF_IUCV_TRANS_IUCV;
654
+ sk->sk_allocation |= GFP_DMA;
793655 if (!iucv->msglimit)
794656 iucv->msglimit = IUCV_QUEUELEN_DEFAULT;
795657 goto done_unlock;
....@@ -814,6 +676,8 @@
814676 return -EPROTO;
815677
816678 memcpy(iucv->src_user_id, iucv_userid, 8);
679
+ iucv->transport = AF_IUCV_TRANS_IUCV;
680
+ sk->sk_allocation |= GFP_DMA;
817681
818682 write_lock_bh(&iucv_sk_list.lock);
819683 __iucv_auto_name(iucv);
....@@ -1097,7 +961,6 @@
1097961
1098962 /* initialize defaults */
1099963 cmsg_done = 0; /* check for duplicate headers */
1100
- txmsg.class = 0;
1101964
1102965 /* iterate over control messages */
1103966 for_each_cmsghdr(cmsg, msg) {
....@@ -1508,8 +1371,8 @@
15081371 return 0;
15091372 }
15101373
1511
-__poll_t iucv_sock_poll(struct file *file, struct socket *sock,
1512
- poll_table *wait)
1374
+static __poll_t iucv_sock_poll(struct file *file, struct socket *sock,
1375
+ poll_table *wait)
15131376 {
15141377 struct sock *sk = sock->sk;
15151378 __poll_t mask = 0;
....@@ -1632,7 +1495,7 @@
16321495
16331496 /* getsockopt and setsockopt */
16341497 static int iucv_sock_setsockopt(struct socket *sock, int level, int optname,
1635
- char __user *optval, unsigned int optlen)
1498
+ sockptr_t optval, unsigned int optlen)
16361499 {
16371500 struct sock *sk = sock->sk;
16381501 struct iucv_sock *iucv = iucv_sk(sk);
....@@ -1645,7 +1508,7 @@
16451508 if (optlen < sizeof(int))
16461509 return -EINVAL;
16471510
1648
- if (get_user(val, (int __user *) optval))
1511
+ if (copy_from_sockptr(&val, optval, sizeof(int)))
16491512 return -EFAULT;
16501513
16511514 rc = 0;
....@@ -1662,7 +1525,7 @@
16621525 switch (sk->sk_state) {
16631526 case IUCV_OPEN:
16641527 case IUCV_BOUND:
1665
- if (val < 1 || val > (u16)(~0))
1528
+ if (val < 1 || val > U16_MAX)
16661529 rc = -EINVAL;
16671530 else
16681531 iucv->msglimit = val;
....@@ -1791,6 +1654,8 @@
17911654
17921655 niucv = iucv_sk(nsk);
17931656 iucv_sock_init(nsk, sk);
1657
+ niucv->transport = AF_IUCV_TRANS_IUCV;
1658
+ nsk->sk_allocation |= GFP_DMA;
17941659
17951660 /* Set the new iucv_sock */
17961661 memcpy(niucv->dst_name, ipuser + 8, 8);
....@@ -1884,30 +1749,26 @@
18841749 struct sock *sk = path->private;
18851750 struct sk_buff *this = NULL;
18861751 struct sk_buff_head *list = &iucv_sk(sk)->send_skb_q;
1887
- struct sk_buff *list_skb = list->next;
1752
+ struct sk_buff *list_skb;
18881753 unsigned long flags;
18891754
18901755 bh_lock_sock(sk);
1891
- if (!skb_queue_empty(list)) {
1892
- spin_lock_irqsave(&list->lock, flags);
18931756
1894
- while (list_skb != (struct sk_buff *)list) {
1895
- if (msg->tag == IUCV_SKB_CB(list_skb)->tag) {
1896
- this = list_skb;
1897
- break;
1898
- }
1899
- list_skb = list_skb->next;
1757
+ spin_lock_irqsave(&list->lock, flags);
1758
+ skb_queue_walk(list, list_skb) {
1759
+ if (msg->tag == IUCV_SKB_CB(list_skb)->tag) {
1760
+ this = list_skb;
1761
+ break;
19001762 }
1901
- if (this)
1902
- __skb_unlink(this, list);
1763
+ }
1764
+ if (this)
1765
+ __skb_unlink(this, list);
1766
+ spin_unlock_irqrestore(&list->lock, flags);
19031767
1904
- spin_unlock_irqrestore(&list->lock, flags);
1905
-
1906
- if (this) {
1907
- kfree_skb(this);
1908
- /* wake up any process waiting for sending */
1909
- iucv_sock_wake_msglim(sk);
1910
- }
1768
+ if (this) {
1769
+ kfree_skb(this);
1770
+ /* wake up any process waiting for sending */
1771
+ iucv_sock_wake_msglim(sk);
19111772 }
19121773
19131774 if (sk->sk_state == IUCV_CLOSING) {
....@@ -1953,8 +1814,7 @@
19531814 /***************** HiperSockets transport callbacks ********************/
19541815 static void afiucv_swap_src_dest(struct sk_buff *skb)
19551816 {
1956
- struct af_iucv_trans_hdr *trans_hdr =
1957
- (struct af_iucv_trans_hdr *)skb->data;
1817
+ struct af_iucv_trans_hdr *trans_hdr = iucv_trans_hdr(skb);
19581818 char tmpID[8];
19591819 char tmpName[8];
19601820
....@@ -1977,13 +1837,12 @@
19771837 **/
19781838 static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb)
19791839 {
1840
+ struct af_iucv_trans_hdr *trans_hdr = iucv_trans_hdr(skb);
19801841 struct sock *nsk;
19811842 struct iucv_sock *iucv, *niucv;
1982
- struct af_iucv_trans_hdr *trans_hdr;
19831843 int err;
19841844
19851845 iucv = iucv_sk(sk);
1986
- trans_hdr = (struct af_iucv_trans_hdr *)skb->data;
19871846 if (!iucv) {
19881847 /* no sock - connection refused */
19891848 afiucv_swap_src_dest(skb);
....@@ -2044,15 +1903,13 @@
20441903 static int afiucv_hs_callback_synack(struct sock *sk, struct sk_buff *skb)
20451904 {
20461905 struct iucv_sock *iucv = iucv_sk(sk);
2047
- struct af_iucv_trans_hdr *trans_hdr =
2048
- (struct af_iucv_trans_hdr *)skb->data;
20491906
20501907 if (!iucv)
20511908 goto out;
20521909 if (sk->sk_state != IUCV_BOUND)
20531910 goto out;
20541911 bh_lock_sock(sk);
2055
- iucv->msglimit_peer = trans_hdr->window;
1912
+ iucv->msglimit_peer = iucv_trans_hdr(skb)->window;
20561913 sk->sk_state = IUCV_CONNECTED;
20571914 sk->sk_state_change(sk);
20581915 bh_unlock_sock(sk);
....@@ -2108,8 +1965,6 @@
21081965 static int afiucv_hs_callback_win(struct sock *sk, struct sk_buff *skb)
21091966 {
21101967 struct iucv_sock *iucv = iucv_sk(sk);
2111
- struct af_iucv_trans_hdr *trans_hdr =
2112
- (struct af_iucv_trans_hdr *)skb->data;
21131968
21141969 if (!iucv)
21151970 return NET_RX_SUCCESS;
....@@ -2117,7 +1972,7 @@
21171972 if (sk->sk_state != IUCV_CONNECTED)
21181973 return NET_RX_SUCCESS;
21191974
2120
- atomic_sub(trans_hdr->window, &iucv->msg_sent);
1975
+ atomic_sub(iucv_trans_hdr(skb)->window, &iucv->msg_sent);
21211976 iucv_sock_wake_msglim(sk);
21221977 return NET_RX_SUCCESS;
21231978 }
....@@ -2180,22 +2035,12 @@
21802035 int err = NET_RX_SUCCESS;
21812036 char nullstring[8];
21822037
2183
- if (skb->len < (ETH_HLEN + sizeof(struct af_iucv_trans_hdr))) {
2184
- WARN_ONCE(1, "AF_IUCV too short skb, len=%d, min=%d",
2185
- (int)skb->len,
2186
- (int)(ETH_HLEN + sizeof(struct af_iucv_trans_hdr)));
2038
+ if (!pskb_may_pull(skb, sizeof(*trans_hdr))) {
21872039 kfree_skb(skb);
21882040 return NET_RX_SUCCESS;
21892041 }
2190
- if (skb_headlen(skb) < (ETH_HLEN + sizeof(struct af_iucv_trans_hdr)))
2191
- if (skb_linearize(skb)) {
2192
- WARN_ONCE(1, "AF_IUCV skb_linearize failed, len=%d",
2193
- (int)skb->len);
2194
- kfree_skb(skb);
2195
- return NET_RX_SUCCESS;
2196
- }
2197
- skb_pull(skb, ETH_HLEN);
2198
- trans_hdr = (struct af_iucv_trans_hdr *)skb->data;
2042
+
2043
+ trans_hdr = iucv_trans_hdr(skb);
21992044 EBCASC(trans_hdr->destAppName, sizeof(trans_hdr->destAppName));
22002045 EBCASC(trans_hdr->destUserID, sizeof(trans_hdr->destUserID));
22012046 EBCASC(trans_hdr->srcAppName, sizeof(trans_hdr->srcAppName));
....@@ -2266,10 +2111,10 @@
22662111 kfree_skb(skb);
22672112 break;
22682113 }
2269
- /* fall through and receive non-zero length data */
2114
+ fallthrough; /* and receive non-zero length data */
22702115 case (AF_IUCV_FLAG_SHT):
22712116 /* shutdown request */
2272
- /* fall through and receive zero length data */
2117
+ fallthrough; /* and receive zero length data */
22732118 case 0:
22742119 /* plain data frame */
22752120 IUCV_SKB_CB(skb)->class = trans_hdr->iucv_hdr.class;
....@@ -2310,11 +2155,7 @@
23102155
23112156 list = &iucv->send_skb_q;
23122157 spin_lock_irqsave(&list->lock, flags);
2313
- if (skb_queue_empty(list))
2314
- goto out_unlock;
2315
- list_skb = list->next;
2316
- nskb = list_skb->next;
2317
- while (list_skb != (struct sk_buff *)list) {
2158
+ skb_queue_walk_safe(list, list_skb, nskb) {
23182159 if (skb_shinfo(list_skb) == skb_shinfo(skb)) {
23192160 switch (n) {
23202161 case TX_NOTIFY_OK:
....@@ -2347,10 +2188,7 @@
23472188 }
23482189 break;
23492190 }
2350
- list_skb = nskb;
2351
- nskb = nskb->next;
23522191 }
2353
-out_unlock:
23542192 spin_unlock_irqrestore(&list->lock, flags);
23552193
23562194 if (sk->sk_state == IUCV_CLOSING) {
....@@ -2418,6 +2256,35 @@
24182256 .getsockopt = iucv_sock_getsockopt,
24192257 };
24202258
2259
+static int iucv_sock_create(struct net *net, struct socket *sock, int protocol,
2260
+ int kern)
2261
+{
2262
+ struct sock *sk;
2263
+
2264
+ if (protocol && protocol != PF_IUCV)
2265
+ return -EPROTONOSUPPORT;
2266
+
2267
+ sock->state = SS_UNCONNECTED;
2268
+
2269
+ switch (sock->type) {
2270
+ case SOCK_STREAM:
2271
+ case SOCK_SEQPACKET:
2272
+ /* currently, proto ops can handle both sk types */
2273
+ sock->ops = &iucv_sock_ops;
2274
+ break;
2275
+ default:
2276
+ return -ESOCKTNOSUPPORT;
2277
+ }
2278
+
2279
+ sk = iucv_sock_alloc(sock, protocol, GFP_KERNEL, kern);
2280
+ if (!sk)
2281
+ return -ENOMEM;
2282
+
2283
+ iucv_sock_init(sk, NULL);
2284
+
2285
+ return 0;
2286
+}
2287
+
24212288 static const struct net_proto_family iucv_sock_family_ops = {
24222289 .family = AF_IUCV,
24232290 .owner = THIS_MODULE,
....@@ -2431,45 +2298,11 @@
24312298
24322299 static int afiucv_iucv_init(void)
24332300 {
2434
- int err;
2435
-
2436
- err = pr_iucv->iucv_register(&af_iucv_handler, 0);
2437
- if (err)
2438
- goto out;
2439
- /* establish dummy device */
2440
- af_iucv_driver.bus = pr_iucv->bus;
2441
- err = driver_register(&af_iucv_driver);
2442
- if (err)
2443
- goto out_iucv;
2444
- af_iucv_dev = kzalloc(sizeof(struct device), GFP_KERNEL);
2445
- if (!af_iucv_dev) {
2446
- err = -ENOMEM;
2447
- goto out_driver;
2448
- }
2449
- dev_set_name(af_iucv_dev, "af_iucv");
2450
- af_iucv_dev->bus = pr_iucv->bus;
2451
- af_iucv_dev->parent = pr_iucv->root;
2452
- af_iucv_dev->release = (void (*)(struct device *))kfree;
2453
- af_iucv_dev->driver = &af_iucv_driver;
2454
- err = device_register(af_iucv_dev);
2455
- if (err)
2456
- goto out_iucv_dev;
2457
- return 0;
2458
-
2459
-out_iucv_dev:
2460
- put_device(af_iucv_dev);
2461
-out_driver:
2462
- driver_unregister(&af_iucv_driver);
2463
-out_iucv:
2464
- pr_iucv->iucv_unregister(&af_iucv_handler, 0);
2465
-out:
2466
- return err;
2301
+ return pr_iucv->iucv_register(&af_iucv_handler, 0);
24672302 }
24682303
24692304 static void afiucv_iucv_exit(void)
24702305 {
2471
- device_unregister(af_iucv_dev);
2472
- driver_unregister(&af_iucv_driver);
24732306 pr_iucv->iucv_unregister(&af_iucv_handler, 0);
24742307 }
24752308