scsi_netlink.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. /*
  2. * scsi_netlink.c - SCSI Transport Netlink Interface
  3. *
  4. * Copyright (C) 2006 James Smart, Emulex Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. #include <linux/time.h>
  22. #include <linux/jiffies.h>
  23. #include <linux/security.h>
  24. #include <linux/delay.h>
  25. #include <net/sock.h>
  26. #include <net/netlink.h>
  27. #include <scsi/scsi_netlink.h>
  28. #include "scsi_priv.h"
  29. struct sock *scsi_nl_sock = NULL;
  30. EXPORT_SYMBOL_GPL(scsi_nl_sock);
  31. static DEFINE_SPINLOCK(scsi_nl_lock);
  32. static struct list_head scsi_nl_drivers;
  33. static u32 scsi_nl_state;
  34. #define STATE_EHANDLER_BSY 0x00000001
  35. struct scsi_nl_transport {
  36. int (*msg_handler)(struct sk_buff *);
  37. void (*event_handler)(struct notifier_block *, unsigned long, void *);
  38. unsigned int refcnt;
  39. int flags;
  40. };
  41. /* flags values (bit flags) */
  42. #define HANDLER_DELETING 0x1
  43. static struct scsi_nl_transport transports[SCSI_NL_MAX_TRANSPORTS] =
  44. { {NULL, }, };
  45. struct scsi_nl_drvr {
  46. struct list_head next;
  47. int (*dmsg_handler)(struct Scsi_Host *shost, void *payload,
  48. u32 len, u32 pid);
  49. void (*devt_handler)(struct notifier_block *nb,
  50. unsigned long event, void *notify_ptr);
  51. struct scsi_host_template *hostt;
  52. u64 vendor_id;
  53. unsigned int refcnt;
  54. int flags;
  55. };
  56. /**
  57. * scsi_nl_rcv_msg - Receive message handler.
  58. * @skb: socket receive buffer
  59. *
  60. * Description: Extracts message from a receive buffer.
  61. * Validates message header and calls appropriate transport message handler
  62. *
  63. *
  64. **/
  65. static void
  66. scsi_nl_rcv_msg(struct sk_buff *skb)
  67. {
  68. struct nlmsghdr *nlh;
  69. struct scsi_nl_hdr *hdr;
  70. unsigned long flags;
  71. u32 rlen;
  72. int err, tport;
  73. while (skb->len >= NLMSG_SPACE(0)) {
  74. err = 0;
  75. nlh = nlmsg_hdr(skb);
  76. if ((nlh->nlmsg_len < (sizeof(*nlh) + sizeof(*hdr))) ||
  77. (skb->len < nlh->nlmsg_len)) {
  78. printk(KERN_WARNING "%s: discarding partial skb\n",
  79. __func__);
  80. return;
  81. }
  82. rlen = NLMSG_ALIGN(nlh->nlmsg_len);
  83. if (rlen > skb->len)
  84. rlen = skb->len;
  85. if (nlh->nlmsg_type != SCSI_TRANSPORT_MSG) {
  86. err = -EBADMSG;
  87. goto next_msg;
  88. }
  89. hdr = NLMSG_DATA(nlh);
  90. if ((hdr->version != SCSI_NL_VERSION) ||
  91. (hdr->magic != SCSI_NL_MAGIC)) {
  92. err = -EPROTOTYPE;
  93. goto next_msg;
  94. }
  95. if (security_netlink_recv(skb, CAP_SYS_ADMIN)) {
  96. err = -EPERM;
  97. goto next_msg;
  98. }
  99. if (nlh->nlmsg_len < (sizeof(*nlh) + hdr->msglen)) {
  100. printk(KERN_WARNING "%s: discarding partial message\n",
  101. __func__);
  102. goto next_msg;
  103. }
  104. /*
  105. * Deliver message to the appropriate transport
  106. */
  107. spin_lock_irqsave(&scsi_nl_lock, flags);
  108. tport = hdr->transport;
  109. if ((tport < SCSI_NL_MAX_TRANSPORTS) &&
  110. !(transports[tport].flags & HANDLER_DELETING) &&
  111. (transports[tport].msg_handler)) {
  112. transports[tport].refcnt++;
  113. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  114. err = transports[tport].msg_handler(skb);
  115. spin_lock_irqsave(&scsi_nl_lock, flags);
  116. transports[tport].refcnt--;
  117. } else
  118. err = -ENOENT;
  119. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  120. next_msg:
  121. if ((err) || (nlh->nlmsg_flags & NLM_F_ACK))
  122. netlink_ack(skb, nlh, err);
  123. skb_pull(skb, rlen);
  124. }
  125. }
  126. /**
  127. * scsi_nl_rcv_event - Event handler for a netlink socket.
  128. * @this: event notifier block
  129. * @event: event type
  130. * @ptr: event payload
  131. *
  132. **/
  133. static int
  134. scsi_nl_rcv_event(struct notifier_block *this, unsigned long event, void *ptr)
  135. {
  136. struct netlink_notify *n = ptr;
  137. struct scsi_nl_drvr *driver;
  138. unsigned long flags;
  139. int tport;
  140. if (n->protocol != NETLINK_SCSITRANSPORT)
  141. return NOTIFY_DONE;
  142. spin_lock_irqsave(&scsi_nl_lock, flags);
  143. scsi_nl_state |= STATE_EHANDLER_BSY;
  144. /*
  145. * Pass event on to any transports that may be listening
  146. */
  147. for (tport = 0; tport < SCSI_NL_MAX_TRANSPORTS; tport++) {
  148. if (!(transports[tport].flags & HANDLER_DELETING) &&
  149. (transports[tport].event_handler)) {
  150. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  151. transports[tport].event_handler(this, event, ptr);
  152. spin_lock_irqsave(&scsi_nl_lock, flags);
  153. }
  154. }
  155. /*
  156. * Pass event on to any drivers that may be listening
  157. */
  158. list_for_each_entry(driver, &scsi_nl_drivers, next) {
  159. if (!(driver->flags & HANDLER_DELETING) &&
  160. (driver->devt_handler)) {
  161. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  162. driver->devt_handler(this, event, ptr);
  163. spin_lock_irqsave(&scsi_nl_lock, flags);
  164. }
  165. }
  166. scsi_nl_state &= ~STATE_EHANDLER_BSY;
  167. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  168. return NOTIFY_DONE;
  169. }
  170. static struct notifier_block scsi_netlink_notifier = {
  171. .notifier_call = scsi_nl_rcv_event,
  172. };
  173. /*
  174. * GENERIC SCSI transport receive and event handlers
  175. */
  176. /**
  177. * scsi_generic_msg_handler - receive message handler for GENERIC transport messages
  178. * @skb: socket receive buffer
  179. **/
  180. static int
  181. scsi_generic_msg_handler(struct sk_buff *skb)
  182. {
  183. struct nlmsghdr *nlh = nlmsg_hdr(skb);
  184. struct scsi_nl_hdr *snlh = NLMSG_DATA(nlh);
  185. struct scsi_nl_drvr *driver;
  186. struct Scsi_Host *shost;
  187. unsigned long flags;
  188. int err = 0, match, pid;
  189. pid = NETLINK_CREDS(skb)->pid;
  190. switch (snlh->msgtype) {
  191. case SCSI_NL_SHOST_VENDOR:
  192. {
  193. struct scsi_nl_host_vendor_msg *msg = NLMSG_DATA(nlh);
  194. /* Locate the driver that corresponds to the message */
  195. spin_lock_irqsave(&scsi_nl_lock, flags);
  196. match = 0;
  197. list_for_each_entry(driver, &scsi_nl_drivers, next) {
  198. if (driver->vendor_id == msg->vendor_id) {
  199. match = 1;
  200. break;
  201. }
  202. }
  203. if ((!match) || (!driver->dmsg_handler)) {
  204. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  205. err = -ESRCH;
  206. goto rcv_exit;
  207. }
  208. if (driver->flags & HANDLER_DELETING) {
  209. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  210. err = -ESHUTDOWN;
  211. goto rcv_exit;
  212. }
  213. driver->refcnt++;
  214. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  215. /* if successful, scsi_host_lookup takes a shost reference */
  216. shost = scsi_host_lookup(msg->host_no);
  217. if (!shost) {
  218. err = -ENODEV;
  219. goto driver_exit;
  220. }
  221. /* is this host owned by the vendor ? */
  222. if (shost->hostt != driver->hostt) {
  223. err = -EINVAL;
  224. goto vendormsg_put;
  225. }
  226. /* pass message on to the driver */
  227. err = driver->dmsg_handler(shost, (void *)&msg[1],
  228. msg->vmsg_datalen, pid);
  229. vendormsg_put:
  230. /* release reference by scsi_host_lookup */
  231. scsi_host_put(shost);
  232. driver_exit:
  233. /* release our own reference on the registration object */
  234. spin_lock_irqsave(&scsi_nl_lock, flags);
  235. driver->refcnt--;
  236. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  237. break;
  238. }
  239. default:
  240. err = -EBADR;
  241. break;
  242. }
  243. rcv_exit:
  244. if (err)
  245. printk(KERN_WARNING "%s: Msgtype %d failed - err %d\n",
  246. __func__, snlh->msgtype, err);
  247. return err;
  248. }
  249. /**
  250. * scsi_nl_add_transport -
  251. * Registers message and event handlers for a transport. Enables
  252. * receipt of netlink messages and events to a transport.
  253. *
  254. * @tport: transport registering handlers
  255. * @msg_handler: receive message handler callback
  256. * @event_handler: receive event handler callback
  257. **/
  258. int
  259. scsi_nl_add_transport(u8 tport,
  260. int (*msg_handler)(struct sk_buff *),
  261. void (*event_handler)(struct notifier_block *, unsigned long, void *))
  262. {
  263. unsigned long flags;
  264. int err = 0;
  265. if (tport >= SCSI_NL_MAX_TRANSPORTS)
  266. return -EINVAL;
  267. spin_lock_irqsave(&scsi_nl_lock, flags);
  268. if (scsi_nl_state & STATE_EHANDLER_BSY) {
  269. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  270. msleep(1);
  271. spin_lock_irqsave(&scsi_nl_lock, flags);
  272. }
  273. if (transports[tport].msg_handler || transports[tport].event_handler) {
  274. err = -EALREADY;
  275. goto register_out;
  276. }
  277. transports[tport].msg_handler = msg_handler;
  278. transports[tport].event_handler = event_handler;
  279. transports[tport].flags = 0;
  280. transports[tport].refcnt = 0;
  281. register_out:
  282. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  283. return err;
  284. }
  285. EXPORT_SYMBOL_GPL(scsi_nl_add_transport);
  286. /**
  287. * scsi_nl_remove_transport -
  288. * Disable transport receiption of messages and events
  289. *
  290. * @tport: transport deregistering handlers
  291. *
  292. **/
  293. void
  294. scsi_nl_remove_transport(u8 tport)
  295. {
  296. unsigned long flags;
  297. spin_lock_irqsave(&scsi_nl_lock, flags);
  298. if (scsi_nl_state & STATE_EHANDLER_BSY) {
  299. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  300. msleep(1);
  301. spin_lock_irqsave(&scsi_nl_lock, flags);
  302. }
  303. if (tport < SCSI_NL_MAX_TRANSPORTS) {
  304. transports[tport].flags |= HANDLER_DELETING;
  305. while (transports[tport].refcnt != 0) {
  306. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  307. schedule_timeout_uninterruptible(HZ/4);
  308. spin_lock_irqsave(&scsi_nl_lock, flags);
  309. }
  310. transports[tport].msg_handler = NULL;
  311. transports[tport].event_handler = NULL;
  312. transports[tport].flags = 0;
  313. }
  314. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  315. return;
  316. }
  317. EXPORT_SYMBOL_GPL(scsi_nl_remove_transport);
  318. /**
  319. * scsi_nl_add_driver -
  320. * A driver is registering its interfaces for SCSI netlink messages
  321. *
  322. * @vendor_id: A unique identification value for the driver.
  323. * @hostt: address of the driver's host template. Used
  324. * to verify an shost is bound to the driver
  325. * @nlmsg_handler: receive message handler callback
  326. * @nlevt_handler: receive event handler callback
  327. *
  328. * Returns:
  329. * 0 on Success
  330. * error result otherwise
  331. **/
  332. int
  333. scsi_nl_add_driver(u64 vendor_id, struct scsi_host_template *hostt,
  334. int (*nlmsg_handler)(struct Scsi_Host *shost, void *payload,
  335. u32 len, u32 pid),
  336. void (*nlevt_handler)(struct notifier_block *nb,
  337. unsigned long event, void *notify_ptr))
  338. {
  339. struct scsi_nl_drvr *driver;
  340. unsigned long flags;
  341. driver = kzalloc(sizeof(*driver), GFP_KERNEL);
  342. if (unlikely(!driver)) {
  343. printk(KERN_ERR "%s: allocation failure\n", __func__);
  344. return -ENOMEM;
  345. }
  346. driver->dmsg_handler = nlmsg_handler;
  347. driver->devt_handler = nlevt_handler;
  348. driver->hostt = hostt;
  349. driver->vendor_id = vendor_id;
  350. spin_lock_irqsave(&scsi_nl_lock, flags);
  351. if (scsi_nl_state & STATE_EHANDLER_BSY) {
  352. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  353. msleep(1);
  354. spin_lock_irqsave(&scsi_nl_lock, flags);
  355. }
  356. list_add_tail(&driver->next, &scsi_nl_drivers);
  357. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  358. return 0;
  359. }
  360. EXPORT_SYMBOL_GPL(scsi_nl_add_driver);
  361. /**
  362. * scsi_nl_remove_driver -
  363. * An driver is unregistering with the SCSI netlink messages
  364. *
  365. * @vendor_id: The unique identification value for the driver.
  366. **/
  367. void
  368. scsi_nl_remove_driver(u64 vendor_id)
  369. {
  370. struct scsi_nl_drvr *driver;
  371. unsigned long flags;
  372. spin_lock_irqsave(&scsi_nl_lock, flags);
  373. if (scsi_nl_state & STATE_EHANDLER_BSY) {
  374. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  375. msleep(1);
  376. spin_lock_irqsave(&scsi_nl_lock, flags);
  377. }
  378. list_for_each_entry(driver, &scsi_nl_drivers, next) {
  379. if (driver->vendor_id == vendor_id) {
  380. driver->flags |= HANDLER_DELETING;
  381. while (driver->refcnt != 0) {
  382. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  383. schedule_timeout_uninterruptible(HZ/4);
  384. spin_lock_irqsave(&scsi_nl_lock, flags);
  385. }
  386. list_del(&driver->next);
  387. kfree(driver);
  388. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  389. return;
  390. }
  391. }
  392. spin_unlock_irqrestore(&scsi_nl_lock, flags);
  393. printk(KERN_ERR "%s: removal of driver failed - vendor_id 0x%llx\n",
  394. __func__, (unsigned long long)vendor_id);
  395. return;
  396. }
  397. EXPORT_SYMBOL_GPL(scsi_nl_remove_driver);
  398. /**
  399. * scsi_netlink_init - Called by SCSI subsystem to intialize
  400. * the SCSI transport netlink interface
  401. *
  402. **/
  403. void
  404. scsi_netlink_init(void)
  405. {
  406. int error;
  407. INIT_LIST_HEAD(&scsi_nl_drivers);
  408. error = netlink_register_notifier(&scsi_netlink_notifier);
  409. if (error) {
  410. printk(KERN_ERR "%s: register of event handler failed - %d\n",
  411. __func__, error);
  412. return;
  413. }
  414. scsi_nl_sock = netlink_kernel_create(&init_net, NETLINK_SCSITRANSPORT,
  415. SCSI_NL_GRP_CNT, scsi_nl_rcv_msg, NULL,
  416. THIS_MODULE);
  417. if (!scsi_nl_sock) {
  418. printk(KERN_ERR "%s: register of recieve handler failed\n",
  419. __func__);
  420. netlink_unregister_notifier(&scsi_netlink_notifier);
  421. return;
  422. }
  423. /* Register the entry points for the generic SCSI transport */
  424. error = scsi_nl_add_transport(SCSI_NL_TRANSPORT,
  425. scsi_generic_msg_handler, NULL);
  426. if (error)
  427. printk(KERN_ERR "%s: register of GENERIC transport handler"
  428. " failed - %d\n", __func__, error);
  429. return;
  430. }
  431. /**
  432. * scsi_netlink_exit - Called by SCSI subsystem to disable the SCSI transport netlink interface
  433. *
  434. **/
  435. void
  436. scsi_netlink_exit(void)
  437. {
  438. scsi_nl_remove_transport(SCSI_NL_TRANSPORT);
  439. if (scsi_nl_sock) {
  440. netlink_kernel_release(scsi_nl_sock);
  441. netlink_unregister_notifier(&scsi_netlink_notifier);
  442. }
  443. return;
  444. }
  445. /*
  446. * Exported Interfaces
  447. */
  448. /**
  449. * scsi_nl_send_transport_msg -
  450. * Generic function to send a single message from a SCSI transport to
  451. * a single process
  452. *
  453. * @pid: receiving pid
  454. * @hdr: message payload
  455. *
  456. **/
  457. void
  458. scsi_nl_send_transport_msg(u32 pid, struct scsi_nl_hdr *hdr)
  459. {
  460. struct sk_buff *skb;
  461. struct nlmsghdr *nlh;
  462. const char *fn;
  463. char *datab;
  464. u32 len, skblen;
  465. int err;
  466. if (!scsi_nl_sock) {
  467. err = -ENOENT;
  468. fn = "netlink socket";
  469. goto msg_fail;
  470. }
  471. len = NLMSG_SPACE(hdr->msglen);
  472. skblen = NLMSG_SPACE(len);
  473. skb = alloc_skb(skblen, GFP_KERNEL);
  474. if (!skb) {
  475. err = -ENOBUFS;
  476. fn = "alloc_skb";
  477. goto msg_fail;
  478. }
  479. nlh = nlmsg_put(skb, pid, 0, SCSI_TRANSPORT_MSG, len - sizeof(*nlh), 0);
  480. if (!nlh) {
  481. err = -ENOBUFS;
  482. fn = "nlmsg_put";
  483. goto msg_fail_skb;
  484. }
  485. datab = NLMSG_DATA(nlh);
  486. memcpy(datab, hdr, hdr->msglen);
  487. err = nlmsg_unicast(scsi_nl_sock, skb, pid);
  488. if (err < 0) {
  489. fn = "nlmsg_unicast";
  490. /* nlmsg_unicast already kfree_skb'd */
  491. goto msg_fail;
  492. }
  493. return;
  494. msg_fail_skb:
  495. kfree_skb(skb);
  496. msg_fail:
  497. printk(KERN_WARNING
  498. "%s: Dropped Message : pid %d Transport %d, msgtype x%x, "
  499. "msglen %d: %s : err %d\n",
  500. __func__, pid, hdr->transport, hdr->msgtype, hdr->msglen,
  501. fn, err);
  502. return;
  503. }
  504. EXPORT_SYMBOL_GPL(scsi_nl_send_transport_msg);
  505. /**
  506. * scsi_nl_send_vendor_msg - called to send a shost vendor unique message
  507. * to a specific process id.
  508. *
  509. * @pid: process id of the receiver
  510. * @host_no: host # sending the message
  511. * @vendor_id: unique identifier for the driver's vendor
  512. * @data_len: amount, in bytes, of vendor unique payload data
  513. * @data_buf: pointer to vendor unique data buffer
  514. *
  515. * Returns:
  516. * 0 on succesful return
  517. * otherwise, failing error code
  518. *
  519. * Notes:
  520. * This routine assumes no locks are held on entry.
  521. */
  522. int
  523. scsi_nl_send_vendor_msg(u32 pid, unsigned short host_no, u64 vendor_id,
  524. char *data_buf, u32 data_len)
  525. {
  526. struct sk_buff *skb;
  527. struct nlmsghdr *nlh;
  528. struct scsi_nl_host_vendor_msg *msg;
  529. u32 len, skblen;
  530. int err;
  531. if (!scsi_nl_sock) {
  532. err = -ENOENT;
  533. goto send_vendor_fail;
  534. }
  535. len = SCSI_NL_MSGALIGN(sizeof(*msg) + data_len);
  536. skblen = NLMSG_SPACE(len);
  537. skb = alloc_skb(skblen, GFP_KERNEL);
  538. if (!skb) {
  539. err = -ENOBUFS;
  540. goto send_vendor_fail;
  541. }
  542. nlh = nlmsg_put(skb, 0, 0, SCSI_TRANSPORT_MSG,
  543. skblen - sizeof(*nlh), 0);
  544. if (!nlh) {
  545. err = -ENOBUFS;
  546. goto send_vendor_fail_skb;
  547. }
  548. msg = NLMSG_DATA(nlh);
  549. INIT_SCSI_NL_HDR(&msg->snlh, SCSI_NL_TRANSPORT,
  550. SCSI_NL_SHOST_VENDOR, len);
  551. msg->vendor_id = vendor_id;
  552. msg->host_no = host_no;
  553. msg->vmsg_datalen = data_len; /* bytes */
  554. memcpy(&msg[1], data_buf, data_len);
  555. err = nlmsg_unicast(scsi_nl_sock, skb, pid);
  556. if (err)
  557. /* nlmsg_multicast already kfree_skb'd */
  558. goto send_vendor_fail;
  559. return 0;
  560. send_vendor_fail_skb:
  561. kfree_skb(skb);
  562. send_vendor_fail:
  563. printk(KERN_WARNING
  564. "%s: Dropped SCSI Msg : host %d vendor_unique - err %d\n",
  565. __func__, host_no, err);
  566. return err;
  567. }
  568. EXPORT_SYMBOL(scsi_nl_send_vendor_msg);