aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/hid/usbhid/hid-core.c5
-rw-r--r--drivers/hid/usbhid/hid-quirks.c138
-rw-r--r--include/net/netlabel.h2
-rw-r--r--net/netlabel/netlabel_user.c4
-rw-r--r--net/xfrm/xfrm_policy.c5
-rw-r--r--security/selinux/hooks.c3
-rw-r--r--security/selinux/netlabel.c16
8 files changed, 162 insertions, 13 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 1e15a0edc313..e65e96a14bec 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3754,7 +3754,7 @@ L: linux-usb-devel@lists.sourceforge.net
3754W: http://www.linux-usb.org/gadget 3754W: http://www.linux-usb.org/gadget
3755S: Maintained 3755S: Maintained
3756 3756
3757USB HID/HIDBP DRIVERS 3757USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
3758P: Jiri Kosina 3758P: Jiri Kosina
3759M: jkosina@suse.cz 3759M: jkosina@suse.cz
3760L: linux-usb-devel@lists.sourceforge.net 3760L: linux-usb-devel@lists.sourceforge.net
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index b2baeaeba9be..0a1f2b52a12f 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -743,7 +743,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
743 hid->quirks = quirks; 743 hid->quirks = quirks;
744 744
745 if (!(usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL))) 745 if (!(usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL)))
746 goto fail; 746 goto fail_no_usbhid;
747 747
748 hid->driver_data = usbhid; 748 hid->driver_data = usbhid;
749 usbhid->hid = hid; 749 usbhid->hid = hid;
@@ -878,6 +878,8 @@ fail:
878 usb_free_urb(usbhid->urbout); 878 usb_free_urb(usbhid->urbout);
879 usb_free_urb(usbhid->urbctrl); 879 usb_free_urb(usbhid->urbctrl);
880 hid_free_buffers(dev, hid); 880 hid_free_buffers(dev, hid);
881 kfree(usbhid);
882fail_no_usbhid:
881 hid_free_device(hid); 883 hid_free_device(hid);
882 884
883 return NULL; 885 return NULL;
@@ -913,6 +915,7 @@ static void hid_disconnect(struct usb_interface *intf)
913 usb_free_urb(usbhid->urbout); 915 usb_free_urb(usbhid->urbout);
914 916
915 hid_free_buffers(hid_to_usb_dev(hid), hid); 917 hid_free_buffers(hid_to_usb_dev(hid), hid);
918 kfree(usbhid);
916 hid_free_device(hid); 919 hid_free_device(hid);
917} 920}
918 921
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 775b9f3b8ce3..6b21a214f419 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -61,7 +61,9 @@
61#define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c 61#define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c
62#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a 62#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
63#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b 63#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
64#define USB_DEVICE_ID_APPLE_IR 0x8240 64
65#define USB_VENDOR_ID_ASUS 0x0b05
66#define USB_DEVICE_ID_ASUS_LCM 0x1726
65 67
66#define USB_VENDOR_ID_ATEN 0x0557 68#define USB_VENDOR_ID_ATEN 0x0557
67#define USB_DEVICE_ID_ATEN_UC100KM 0x2004 69#define USB_DEVICE_ID_ATEN_UC100KM 0x2004
@@ -198,6 +200,70 @@
198 200
199#define USB_VENDOR_ID_LOGITECH 0x046d 201#define USB_VENDOR_ID_LOGITECH 0x046d
200#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 202#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101
203#define USB_DEVICE_ID_LOGITECH_HARMONY 0xc110
204#define USB_DEVICE_ID_LOGITECH_HARMONY_2 0xc111
205#define USB_DEVICE_ID_LOGITECH_HARMONY_3 0xc112
206#define USB_DEVICE_ID_LOGITECH_HARMONY_4 0xc113
207#define USB_DEVICE_ID_LOGITECH_HARMONY_5 0xc114
208#define USB_DEVICE_ID_LOGITECH_HARMONY_6 0xc115
209#define USB_DEVICE_ID_LOGITECH_HARMONY_7 0xc116
210#define USB_DEVICE_ID_LOGITECH_HARMONY_8 0xc117
211#define USB_DEVICE_ID_LOGITECH_HARMONY_9 0xc118
212#define USB_DEVICE_ID_LOGITECH_HARMONY_10 0xc119
213#define USB_DEVICE_ID_LOGITECH_HARMONY_11 0xc11a
214#define USB_DEVICE_ID_LOGITECH_HARMONY_12 0xc11b
215#define USB_DEVICE_ID_LOGITECH_HARMONY_13 0xc11c
216#define USB_DEVICE_ID_LOGITECH_HARMONY_14 0xc11d
217#define USB_DEVICE_ID_LOGITECH_HARMONY_15 0xc11e
218#define USB_DEVICE_ID_LOGITECH_HARMONY_16 0xc11f
219#define USB_DEVICE_ID_LOGITECH_HARMONY_17 0xc120
220#define USB_DEVICE_ID_LOGITECH_HARMONY_18 0xc121
221#define USB_DEVICE_ID_LOGITECH_HARMONY_19 0xc122
222#define USB_DEVICE_ID_LOGITECH_HARMONY_20 0xc123
223#define USB_DEVICE_ID_LOGITECH_HARMONY_21 0xc124
224#define USB_DEVICE_ID_LOGITECH_HARMONY_22 0xc125
225#define USB_DEVICE_ID_LOGITECH_HARMONY_23 0xc126
226#define USB_DEVICE_ID_LOGITECH_HARMONY_24 0xc127
227#define USB_DEVICE_ID_LOGITECH_HARMONY_25 0xc128
228#define USB_DEVICE_ID_LOGITECH_HARMONY_26 0xc129
229#define USB_DEVICE_ID_LOGITECH_HARMONY_27 0xc12a
230#define USB_DEVICE_ID_LOGITECH_HARMONY_28 0xc12b
231#define USB_DEVICE_ID_LOGITECH_HARMONY_29 0xc12c
232#define USB_DEVICE_ID_LOGITECH_HARMONY_30 0xc12d
233#define USB_DEVICE_ID_LOGITECH_HARMONY_31 0xc12e
234#define USB_DEVICE_ID_LOGITECH_HARMONY_32 0xc12f
235#define USB_DEVICE_ID_LOGITECH_HARMONY_33 0xc130
236#define USB_DEVICE_ID_LOGITECH_HARMONY_34 0xc131
237#define USB_DEVICE_ID_LOGITECH_HARMONY_35 0xc132
238#define USB_DEVICE_ID_LOGITECH_HARMONY_36 0xc133
239#define USB_DEVICE_ID_LOGITECH_HARMONY_37 0xc134
240#define USB_DEVICE_ID_LOGITECH_HARMONY_38 0xc135
241#define USB_DEVICE_ID_LOGITECH_HARMONY_39 0xc136
242#define USB_DEVICE_ID_LOGITECH_HARMONY_40 0xc137
243#define USB_DEVICE_ID_LOGITECH_HARMONY_41 0xc138
244#define USB_DEVICE_ID_LOGITECH_HARMONY_42 0xc139
245#define USB_DEVICE_ID_LOGITECH_HARMONY_43 0xc13a
246#define USB_DEVICE_ID_LOGITECH_HARMONY_44 0xc13b
247#define USB_DEVICE_ID_LOGITECH_HARMONY_45 0xc13c
248#define USB_DEVICE_ID_LOGITECH_HARMONY_46 0xc13d
249#define USB_DEVICE_ID_LOGITECH_HARMONY_47 0xc13e
250#define USB_DEVICE_ID_LOGITECH_HARMONY_48 0xc13f
251#define USB_DEVICE_ID_LOGITECH_HARMONY_49 0xc140
252#define USB_DEVICE_ID_LOGITECH_HARMONY_50 0xc141
253#define USB_DEVICE_ID_LOGITECH_HARMONY_51 0xc142
254#define USB_DEVICE_ID_LOGITECH_HARMONY_52 0xc143
255#define USB_DEVICE_ID_LOGITECH_HARMONY_53 0xc144
256#define USB_DEVICE_ID_LOGITECH_HARMONY_54 0xc145
257#define USB_DEVICE_ID_LOGITECH_HARMONY_55 0xc146
258#define USB_DEVICE_ID_LOGITECH_HARMONY_56 0xc147
259#define USB_DEVICE_ID_LOGITECH_HARMONY_57 0xc148
260#define USB_DEVICE_ID_LOGITECH_HARMONY_58 0xc149
261#define USB_DEVICE_ID_LOGITECH_HARMONY_59 0xc14a
262#define USB_DEVICE_ID_LOGITECH_HARMONY_60 0xc14b
263#define USB_DEVICE_ID_LOGITECH_HARMONY_61 0xc14c
264#define USB_DEVICE_ID_LOGITECH_HARMONY_62 0xc14d
265#define USB_DEVICE_ID_LOGITECH_HARMONY_63 0xc14e
266#define USB_DEVICE_ID_LOGITECH_HARMONY_64 0xc14f
201#define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 267#define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294
202#define USB_DEVICE_ID_LOGITECH_KBD 0xc311 268#define USB_DEVICE_ID_LOGITECH_KBD 0xc311
203#define USB_DEVICE_ID_S510_RECEIVER 0xc50c 269#define USB_DEVICE_ID_S510_RECEIVER 0xc50c
@@ -221,6 +287,9 @@
221#define USB_DEVICE_ID_NCR_FIRST 0x0300 287#define USB_DEVICE_ID_NCR_FIRST 0x0300
222#define USB_DEVICE_ID_NCR_LAST 0x03ff 288#define USB_DEVICE_ID_NCR_LAST 0x03ff
223 289
290#define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400
291#define USB_DEVICE_ID_N_S_HARMONY 0xc359
292
224#define USB_VENDOR_ID_NEC 0x073e 293#define USB_VENDOR_ID_NEC 0x073e
225#define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 294#define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301
226 295
@@ -315,7 +384,7 @@ static const struct hid_blacklist {
315 { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, 384 { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE },
316 { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE }, 385 { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE },
317 { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE }, 386 { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE },
318 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR, HID_QUIRK_IGNORE }, 387 { USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM, HID_QUIRK_IGNORE},
319 { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, 388 { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE },
320 { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE }, 389 { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE },
321 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE }, 390 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE },
@@ -463,6 +532,71 @@ static const struct hid_blacklist {
463 532
464 { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, 533 { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS },
465 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, 534 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS },
535 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY, HID_QUIRK_IGNORE },
536 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_2, HID_QUIRK_IGNORE },
537 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_3, HID_QUIRK_IGNORE },
538 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_4, HID_QUIRK_IGNORE },
539 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_5, HID_QUIRK_IGNORE },
540 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_6, HID_QUIRK_IGNORE },
541 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_7, HID_QUIRK_IGNORE },
542 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_8, HID_QUIRK_IGNORE },
543 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_9, HID_QUIRK_IGNORE },
544 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_10, HID_QUIRK_IGNORE },
545 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_11, HID_QUIRK_IGNORE },
546 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_12, HID_QUIRK_IGNORE },
547 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_13, HID_QUIRK_IGNORE },
548 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_14, HID_QUIRK_IGNORE },
549 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_15, HID_QUIRK_IGNORE },
550 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_16, HID_QUIRK_IGNORE },
551 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_17, HID_QUIRK_IGNORE },
552 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_18, HID_QUIRK_IGNORE },
553 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_19, HID_QUIRK_IGNORE },
554 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_20, HID_QUIRK_IGNORE },
555 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_21, HID_QUIRK_IGNORE },
556 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_22, HID_QUIRK_IGNORE },
557 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_23, HID_QUIRK_IGNORE },
558 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_24, HID_QUIRK_IGNORE },
559 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_25, HID_QUIRK_IGNORE },
560 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_26, HID_QUIRK_IGNORE },
561 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_27, HID_QUIRK_IGNORE },
562 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_28, HID_QUIRK_IGNORE },
563 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_29, HID_QUIRK_IGNORE },
564 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_30, HID_QUIRK_IGNORE },
565 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_31, HID_QUIRK_IGNORE },
566 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_32, HID_QUIRK_IGNORE },
567 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_33, HID_QUIRK_IGNORE },
568 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_34, HID_QUIRK_IGNORE },
569 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_35, HID_QUIRK_IGNORE },
570 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_36, HID_QUIRK_IGNORE },
571 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_37, HID_QUIRK_IGNORE },
572 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_38, HID_QUIRK_IGNORE },
573 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_39, HID_QUIRK_IGNORE },
574 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_40, HID_QUIRK_IGNORE },
575 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_41, HID_QUIRK_IGNORE },
576 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_42, HID_QUIRK_IGNORE },
577 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_43, HID_QUIRK_IGNORE },
578 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_44, HID_QUIRK_IGNORE },
579 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_45, HID_QUIRK_IGNORE },
580 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_46, HID_QUIRK_IGNORE },
581 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_47, HID_QUIRK_IGNORE },
582 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_48, HID_QUIRK_IGNORE },
583 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_49, HID_QUIRK_IGNORE },
584 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_50, HID_QUIRK_IGNORE },
585 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_51, HID_QUIRK_IGNORE },
586 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_52, HID_QUIRK_IGNORE },
587 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_53, HID_QUIRK_IGNORE },
588 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_54, HID_QUIRK_IGNORE },
589 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_55, HID_QUIRK_IGNORE },
590 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_56, HID_QUIRK_IGNORE },
591 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_57, HID_QUIRK_IGNORE },
592 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_58, HID_QUIRK_IGNORE },
593 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_59, HID_QUIRK_IGNORE },
594 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_60, HID_QUIRK_IGNORE },
595 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_61, HID_QUIRK_IGNORE },
596 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_62, HID_QUIRK_IGNORE },
597 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_63, HID_QUIRK_IGNORE },
598 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_64, HID_QUIRK_IGNORE },
599 { USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY, HID_QUIRK_IGNORE },
466 600
467 { 0, 0 } 601 { 0, 0 }
468}; 602};
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index ffbc7f28335a..2e5b2f6f9fa0 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -132,6 +132,8 @@ struct netlbl_lsm_secattr_catmap {
132#define NETLBL_SECATTR_CACHE 0x00000002 132#define NETLBL_SECATTR_CACHE 0x00000002
133#define NETLBL_SECATTR_MLS_LVL 0x00000004 133#define NETLBL_SECATTR_MLS_LVL 0x00000004
134#define NETLBL_SECATTR_MLS_CAT 0x00000008 134#define NETLBL_SECATTR_MLS_CAT 0x00000008
135#define NETLBL_SECATTR_CACHEABLE (NETLBL_SECATTR_MLS_LVL | \
136 NETLBL_SECATTR_MLS_CAT)
135struct netlbl_lsm_secattr { 137struct netlbl_lsm_secattr {
136 u32 flags; 138 u32 flags;
137 139
diff --git a/net/netlabel/netlabel_user.c b/net/netlabel/netlabel_user.c
index 89dcc485653b..85a96a3fddaa 100644
--- a/net/netlabel/netlabel_user.c
+++ b/net/netlabel/netlabel_user.c
@@ -113,8 +113,10 @@ struct audit_buffer *netlbl_audit_start_common(int type,
113 if (audit_info->secid != 0 && 113 if (audit_info->secid != 0 &&
114 security_secid_to_secctx(audit_info->secid, 114 security_secid_to_secctx(audit_info->secid,
115 &secctx, 115 &secctx,
116 &secctx_len) == 0) 116 &secctx_len) == 0) {
117 audit_log_format(audit_buf, " subj=%s", secctx); 117 audit_log_format(audit_buf, " subj=%s", secctx);
118 security_release_secctx(secctx, secctx_len);
119 }
118 120
119 return audit_buf; 121 return audit_buf;
120} 122}
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 95a47304336d..e5a3be03aa0d 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2195,9 +2195,10 @@ void xfrm_audit_log(uid_t auid, u32 sid, int type, int result,
2195 } 2195 }
2196 2196
2197 if (sid != 0 && 2197 if (sid != 0 &&
2198 security_secid_to_secctx(sid, &secctx, &secctx_len) == 0) 2198 security_secid_to_secctx(sid, &secctx, &secctx_len) == 0) {
2199 audit_log_format(audit_buf, " subj=%s", secctx); 2199 audit_log_format(audit_buf, " subj=%s", secctx);
2200 else 2200 security_release_secctx(secctx, secctx_len);
2201 } else
2201 audit_log_task_context(audit_buf); 2202 audit_log_task_context(audit_buf);
2202 2203
2203 if (xp) { 2204 if (xp) {
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 0fac6829c63a..6237933f7d82 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4658,8 +4658,7 @@ static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
4658 4658
4659static void selinux_release_secctx(char *secdata, u32 seclen) 4659static void selinux_release_secctx(char *secdata, u32 seclen)
4660{ 4660{
4661 if (secdata) 4661 kfree(secdata);
4662 kfree(secdata);
4663} 4662}
4664 4663
4665#ifdef CONFIG_KEYS 4664#ifdef CONFIG_KEYS
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c
index 051b14c88e2d..d243ddc723a5 100644
--- a/security/selinux/netlabel.c
+++ b/security/selinux/netlabel.c
@@ -162,9 +162,13 @@ int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, u32 base_sid, u32 *sid)
162 162
163 netlbl_secattr_init(&secattr); 163 netlbl_secattr_init(&secattr);
164 rc = netlbl_skbuff_getattr(skb, &secattr); 164 rc = netlbl_skbuff_getattr(skb, &secattr);
165 if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE) 165 if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE) {
166 rc = security_netlbl_secattr_to_sid(&secattr, base_sid, sid); 166 rc = security_netlbl_secattr_to_sid(&secattr, base_sid, sid);
167 else 167 if (rc == 0 &&
168 (secattr.flags & NETLBL_SECATTR_CACHEABLE) &&
169 (secattr.flags & NETLBL_SECATTR_CACHE))
170 netlbl_cache_add(skb, &secattr);
171 } else
168 *sid = SECSID_NULL; 172 *sid = SECSID_NULL;
169 netlbl_secattr_destroy(&secattr); 173 netlbl_secattr_destroy(&secattr);
170 174
@@ -307,11 +311,15 @@ int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec,
307 311
308 netlbl_secattr_init(&secattr); 312 netlbl_secattr_init(&secattr);
309 rc = netlbl_skbuff_getattr(skb, &secattr); 313 rc = netlbl_skbuff_getattr(skb, &secattr);
310 if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE) 314 if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE) {
311 rc = security_netlbl_secattr_to_sid(&secattr, 315 rc = security_netlbl_secattr_to_sid(&secattr,
312 SECINITSID_NETMSG, 316 SECINITSID_NETMSG,
313 &nlbl_sid); 317 &nlbl_sid);
314 else 318 if (rc == 0 &&
319 (secattr.flags & NETLBL_SECATTR_CACHEABLE) &&
320 (secattr.flags & NETLBL_SECATTR_CACHE))
321 netlbl_cache_add(skb, &secattr);
322 } else
315 nlbl_sid = SECINITSID_UNLABELED; 323 nlbl_sid = SECINITSID_UNLABELED;
316 netlbl_secattr_destroy(&secattr); 324 netlbl_secattr_destroy(&secattr);
317 if (rc != 0) 325 if (rc != 0)