Merge 4.19.179 into android-4.19-stable

Changes in 4.19.179
	net: usb: qmi_wwan: support ZTE P685M modem
	hugetlb: fix update_and_free_page contig page struct assumption
	drm/virtio: use kvmalloc for large allocations
	virtio/s390: implement virtio-ccw revision 2 correctly
	arm64 module: set plt* section addresses to 0x0
	arm64: Avoid redundant type conversions in xchg() and cmpxchg()
	arm64: cmpxchg: Use "K" instead of "L" for ll/sc immediate constraint
	arm64: Use correct ll/sc atomic constraints
	MIPS: VDSO: Use CLANG_FLAGS instead of filtering out '--target='
	JFS: more checks for invalid superblock
	udlfb: Fix memory leak in dlfb_usb_probe
	media: mceusb: sanity check for prescaler value
	xfs: Fix assert failure in xfs_setattr_size()
	smackfs: restrict bytes count in smackfs write functions
	net: fix up truesize of cloned skb in skb_prepare_for_shift()
	mm/hugetlb.c: fix unnecessary address expansion of pmd sharing
	net: bridge: use switchdev for port flags set through sysfs too
	dt-bindings: net: btusb: DT fix s/interrupt-name/interrupt-names/
	rsi: Fix TX EAPOL packet handling against iwlwifi AP
	rsi: Move card interrupt handling to RX thread
	staging: fwserial: Fix error handling in fwserial_create
	x86/reboot: Add Zotac ZBOX CI327 nano PCI reboot quirk
	vt/consolemap: do font sum unsigned
	wlcore: Fix command execute failure 19 for wl12xx
	Bluetooth: hci_h5: Set HCI_QUIRK_SIMULTANEOUS_DISCOVERY for btrtl
	pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()
	ath10k: fix wmi mgmt tx queue full due to race condition
	x86/build: Treat R_386_PLT32 relocation as R_386_PC32
	Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data
	staging: most: sound: add sanity check for function argument
	crypto: tcrypt - avoid signed overflow in byte count
	PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse
	drm/amd/display: Guard against NULL pointer deref when get_i2c_info fails
	media: uvcvideo: Allow entities with no pads
	f2fs: handle unallocated section and zone on pinned/atgc
	f2fs: fix to set/clear I_LINKABLE under i_lock
	btrfs: fix error handling in commit_fs_roots
	parisc: Bump 64-bit IRQ stack size to 64 KB
	ASoC: Intel: bytcr_rt5640: Add quirk for the Estar Beauty HD MID 7316R tablet
	ASoC: Intel: bytcr_rt5640: Add quirk for the Voyo Winpad A15 tablet
	ASoC: Intel: bytcr_rt5640: Add quirk for the Acer One S1002 tablet
	scsi: iscsi: Restrict sessions and handles to admin capabilities
	sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output
	scsi: iscsi: Ensure sysfs attributes are limited to PAGE_SIZE
	scsi: iscsi: Verify lengths on passthrough PDUs
	Xen/gnttab: handle p2m update errors on a per-slot basis
	xen-netback: respect gnttab_map_refs()'s return value
	zsmalloc: account the number of compacted pages correctly
	swap: fix swapfile read/write offset
	media: v4l: ioctl: Fix memory leak in video_usercopy
	ALSA: hda/realtek: Add quirk for Clevo NH55RZQ
	ALSA: hda/realtek: Apply dual codec quirks for MSI Godlike X570 board
	Linux 4.19.179

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3a22f45d69254beca09db0f33bc3cab3a0cadf80
This commit is contained in:
Greg Kroah-Hartman
2021-03-07 12:45:27 +01:00
59 changed files with 650 additions and 398 deletions

View File

@@ -35,7 +35,7 @@ Following example uses irq pin number 3 of gpio0 for out of band wake-on-bt:
compatible = "usb1286,204e"; compatible = "usb1286,204e";
reg = <1>; reg = <1>;
interrupt-parent = <&gpio0>; interrupt-parent = <&gpio0>;
interrupt-name = "wakeup"; interrupt-names = "wakeup";
interrupts = <3 IRQ_TYPE_LEVEL_LOW>; interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
}; };
}; };

View File

@@ -211,12 +211,10 @@ Other notes:
is 4096. is 4096.
- show() methods should return the number of bytes printed into the - show() methods should return the number of bytes printed into the
buffer. This is the return value of scnprintf(). buffer.
- show() must not use snprintf() when formatting the value to be - show() should only use sysfs_emit() or sysfs_emit_at() when formatting
returned to user space. If you can guarantee that an overflow the value to be returned to user space.
will never happen you can use sprintf() otherwise you must use
scnprintf().
- store() should return the number of bytes used from the buffer. If the - store() should return the number of bytes used from the buffer. If the
entire buffer has been used, just return the count argument. entire buffer has been used, just return the count argument.

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
VERSION = 4 VERSION = 4
PATCHLEVEL = 19 PATCHLEVEL = 19
SUBLEVEL = 178 SUBLEVEL = 179
EXTRAVERSION = EXTRAVERSION =
NAME = "People's Front" NAME = "People's Front"

View File

@@ -91,12 +91,39 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
int i; int i;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
struct gnttab_unmap_grant_ref unmap;
int rc;
if (map_ops[i].status) if (map_ops[i].status)
continue; continue;
if (unlikely(!set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT, if (likely(set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT,
map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT))) { map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT)))
return -ENOMEM; continue;
}
/*
* Signal an error for this slot. This in turn requires
* immediate unmapping.
*/
map_ops[i].status = GNTST_general_error;
unmap.host_addr = map_ops[i].host_addr,
unmap.handle = map_ops[i].handle;
map_ops[i].handle = ~0;
if (map_ops[i].flags & GNTMAP_device_map)
unmap.dev_bus_addr = map_ops[i].dev_bus_addr;
else
unmap.dev_bus_addr = 0;
/*
* Pre-populate the status field, to be recognizable in
* the log message below.
*/
unmap.status = 1;
rc = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
&unmap, 1);
if (rc || unmap.status != GNTST_okay)
pr_err_once("gnttab unmap failed: rc=%d st=%d\n",
rc, unmap.status);
} }
return 0; return 0;

View File

@@ -37,7 +37,7 @@
* (the optimize attribute silently ignores these options). * (the optimize attribute silently ignores these options).
*/ */
#define ATOMIC_OP(op, asm_op) \ #define ATOMIC_OP(op, asm_op, constraint) \
__LL_SC_INLINE void \ __LL_SC_INLINE void \
__LL_SC_PREFIX(atomic_##op(int i, atomic_t *v)) \ __LL_SC_PREFIX(atomic_##op(int i, atomic_t *v)) \
{ \ { \
@@ -51,11 +51,11 @@ __LL_SC_PREFIX(atomic_##op(int i, atomic_t *v)) \
" stxr %w1, %w0, %2\n" \ " stxr %w1, %w0, %2\n" \
" cbnz %w1, 1b" \ " cbnz %w1, 1b" \
: "=&r" (result), "=&r" (tmp), "+Q" (v->counter) \ : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) \
: "Ir" (i)); \ : #constraint "r" (i)); \
} \ } \
__LL_SC_EXPORT(atomic_##op); __LL_SC_EXPORT(atomic_##op);
#define ATOMIC_OP_RETURN(name, mb, acq, rel, cl, op, asm_op) \ #define ATOMIC_OP_RETURN(name, mb, acq, rel, cl, op, asm_op, constraint)\
__LL_SC_INLINE int \ __LL_SC_INLINE int \
__LL_SC_PREFIX(atomic_##op##_return##name(int i, atomic_t *v)) \ __LL_SC_PREFIX(atomic_##op##_return##name(int i, atomic_t *v)) \
{ \ { \
@@ -70,14 +70,14 @@ __LL_SC_PREFIX(atomic_##op##_return##name(int i, atomic_t *v)) \
" cbnz %w1, 1b\n" \ " cbnz %w1, 1b\n" \
" " #mb \ " " #mb \
: "=&r" (result), "=&r" (tmp), "+Q" (v->counter) \ : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) \
: "Ir" (i) \ : #constraint "r" (i) \
: cl); \ : cl); \
\ \
return result; \ return result; \
} \ } \
__LL_SC_EXPORT(atomic_##op##_return##name); __LL_SC_EXPORT(atomic_##op##_return##name);
#define ATOMIC_FETCH_OP(name, mb, acq, rel, cl, op, asm_op) \ #define ATOMIC_FETCH_OP(name, mb, acq, rel, cl, op, asm_op, constraint) \
__LL_SC_INLINE int \ __LL_SC_INLINE int \
__LL_SC_PREFIX(atomic_fetch_##op##name(int i, atomic_t *v)) \ __LL_SC_PREFIX(atomic_fetch_##op##name(int i, atomic_t *v)) \
{ \ { \
@@ -92,7 +92,7 @@ __LL_SC_PREFIX(atomic_fetch_##op##name(int i, atomic_t *v)) \
" cbnz %w2, 1b\n" \ " cbnz %w2, 1b\n" \
" " #mb \ " " #mb \
: "=&r" (result), "=&r" (val), "=&r" (tmp), "+Q" (v->counter) \ : "=&r" (result), "=&r" (val), "=&r" (tmp), "+Q" (v->counter) \
: "Ir" (i) \ : #constraint "r" (i) \
: cl); \ : cl); \
\ \
return result; \ return result; \
@@ -110,8 +110,8 @@ __LL_SC_EXPORT(atomic_fetch_##op##name);
ATOMIC_FETCH_OP (_acquire, , a, , "memory", __VA_ARGS__)\ ATOMIC_FETCH_OP (_acquire, , a, , "memory", __VA_ARGS__)\
ATOMIC_FETCH_OP (_release, , , l, "memory", __VA_ARGS__) ATOMIC_FETCH_OP (_release, , , l, "memory", __VA_ARGS__)
ATOMIC_OPS(add, add) ATOMIC_OPS(add, add, I)
ATOMIC_OPS(sub, sub) ATOMIC_OPS(sub, sub, J)
#undef ATOMIC_OPS #undef ATOMIC_OPS
#define ATOMIC_OPS(...) \ #define ATOMIC_OPS(...) \
@@ -121,17 +121,17 @@ ATOMIC_OPS(sub, sub)
ATOMIC_FETCH_OP (_acquire, , a, , "memory", __VA_ARGS__)\ ATOMIC_FETCH_OP (_acquire, , a, , "memory", __VA_ARGS__)\
ATOMIC_FETCH_OP (_release, , , l, "memory", __VA_ARGS__) ATOMIC_FETCH_OP (_release, , , l, "memory", __VA_ARGS__)
ATOMIC_OPS(and, and) ATOMIC_OPS(and, and, )
ATOMIC_OPS(andnot, bic) ATOMIC_OPS(andnot, bic, )
ATOMIC_OPS(or, orr) ATOMIC_OPS(or, orr, )
ATOMIC_OPS(xor, eor) ATOMIC_OPS(xor, eor, )
#undef ATOMIC_OPS #undef ATOMIC_OPS
#undef ATOMIC_FETCH_OP #undef ATOMIC_FETCH_OP
#undef ATOMIC_OP_RETURN #undef ATOMIC_OP_RETURN
#undef ATOMIC_OP #undef ATOMIC_OP
#define ATOMIC64_OP(op, asm_op) \ #define ATOMIC64_OP(op, asm_op, constraint) \
__LL_SC_INLINE void \ __LL_SC_INLINE void \
__LL_SC_PREFIX(atomic64_##op(long i, atomic64_t *v)) \ __LL_SC_PREFIX(atomic64_##op(long i, atomic64_t *v)) \
{ \ { \
@@ -145,11 +145,11 @@ __LL_SC_PREFIX(atomic64_##op(long i, atomic64_t *v)) \
" stxr %w1, %0, %2\n" \ " stxr %w1, %0, %2\n" \
" cbnz %w1, 1b" \ " cbnz %w1, 1b" \
: "=&r" (result), "=&r" (tmp), "+Q" (v->counter) \ : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) \
: "Ir" (i)); \ : #constraint "r" (i)); \
} \ } \
__LL_SC_EXPORT(atomic64_##op); __LL_SC_EXPORT(atomic64_##op);
#define ATOMIC64_OP_RETURN(name, mb, acq, rel, cl, op, asm_op) \ #define ATOMIC64_OP_RETURN(name, mb, acq, rel, cl, op, asm_op, constraint)\
__LL_SC_INLINE long \ __LL_SC_INLINE long \
__LL_SC_PREFIX(atomic64_##op##_return##name(long i, atomic64_t *v)) \ __LL_SC_PREFIX(atomic64_##op##_return##name(long i, atomic64_t *v)) \
{ \ { \
@@ -164,14 +164,14 @@ __LL_SC_PREFIX(atomic64_##op##_return##name(long i, atomic64_t *v)) \
" cbnz %w1, 1b\n" \ " cbnz %w1, 1b\n" \
" " #mb \ " " #mb \
: "=&r" (result), "=&r" (tmp), "+Q" (v->counter) \ : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) \
: "Ir" (i) \ : #constraint "r" (i) \
: cl); \ : cl); \
\ \
return result; \ return result; \
} \ } \
__LL_SC_EXPORT(atomic64_##op##_return##name); __LL_SC_EXPORT(atomic64_##op##_return##name);
#define ATOMIC64_FETCH_OP(name, mb, acq, rel, cl, op, asm_op) \ #define ATOMIC64_FETCH_OP(name, mb, acq, rel, cl, op, asm_op, constraint)\
__LL_SC_INLINE long \ __LL_SC_INLINE long \
__LL_SC_PREFIX(atomic64_fetch_##op##name(long i, atomic64_t *v)) \ __LL_SC_PREFIX(atomic64_fetch_##op##name(long i, atomic64_t *v)) \
{ \ { \
@@ -186,7 +186,7 @@ __LL_SC_PREFIX(atomic64_fetch_##op##name(long i, atomic64_t *v)) \
" cbnz %w2, 1b\n" \ " cbnz %w2, 1b\n" \
" " #mb \ " " #mb \
: "=&r" (result), "=&r" (val), "=&r" (tmp), "+Q" (v->counter) \ : "=&r" (result), "=&r" (val), "=&r" (tmp), "+Q" (v->counter) \
: "Ir" (i) \ : #constraint "r" (i) \
: cl); \ : cl); \
\ \
return result; \ return result; \
@@ -204,8 +204,8 @@ __LL_SC_EXPORT(atomic64_fetch_##op##name);
ATOMIC64_FETCH_OP (_acquire,, a, , "memory", __VA_ARGS__) \ ATOMIC64_FETCH_OP (_acquire,, a, , "memory", __VA_ARGS__) \
ATOMIC64_FETCH_OP (_release,, , l, "memory", __VA_ARGS__) ATOMIC64_FETCH_OP (_release,, , l, "memory", __VA_ARGS__)
ATOMIC64_OPS(add, add) ATOMIC64_OPS(add, add, I)
ATOMIC64_OPS(sub, sub) ATOMIC64_OPS(sub, sub, J)
#undef ATOMIC64_OPS #undef ATOMIC64_OPS
#define ATOMIC64_OPS(...) \ #define ATOMIC64_OPS(...) \
@@ -215,10 +215,10 @@ ATOMIC64_OPS(sub, sub)
ATOMIC64_FETCH_OP (_acquire,, a, , "memory", __VA_ARGS__) \ ATOMIC64_FETCH_OP (_acquire,, a, , "memory", __VA_ARGS__) \
ATOMIC64_FETCH_OP (_release,, , l, "memory", __VA_ARGS__) ATOMIC64_FETCH_OP (_release,, , l, "memory", __VA_ARGS__)
ATOMIC64_OPS(and, and) ATOMIC64_OPS(and, and, L)
ATOMIC64_OPS(andnot, bic) ATOMIC64_OPS(andnot, bic, )
ATOMIC64_OPS(or, orr) ATOMIC64_OPS(or, orr, L)
ATOMIC64_OPS(xor, eor) ATOMIC64_OPS(xor, eor, L)
#undef ATOMIC64_OPS #undef ATOMIC64_OPS
#undef ATOMIC64_FETCH_OP #undef ATOMIC64_FETCH_OP
@@ -248,48 +248,54 @@ __LL_SC_PREFIX(atomic64_dec_if_positive(atomic64_t *v))
} }
__LL_SC_EXPORT(atomic64_dec_if_positive); __LL_SC_EXPORT(atomic64_dec_if_positive);
#define __CMPXCHG_CASE(w, sz, name, mb, acq, rel, cl) \ #define __CMPXCHG_CASE(w, sfx, name, sz, mb, acq, rel, cl, constraint) \
__LL_SC_INLINE unsigned long \ __LL_SC_INLINE u##sz \
__LL_SC_PREFIX(__cmpxchg_case_##name(volatile void *ptr, \ __LL_SC_PREFIX(__cmpxchg_case_##name##sz(volatile void *ptr, \
unsigned long old, \ unsigned long old, \
unsigned long new)) \ u##sz new)) \
{ \ { \
unsigned long tmp, oldval; \ unsigned long tmp; \
u##sz oldval; \
\ \
asm volatile( \ asm volatile( \
" prfm pstl1strm, %[v]\n" \ " prfm pstl1strm, %[v]\n" \
"1: ld" #acq "xr" #sz "\t%" #w "[oldval], %[v]\n" \ "1: ld" #acq "xr" #sfx "\t%" #w "[oldval], %[v]\n" \
" eor %" #w "[tmp], %" #w "[oldval], %" #w "[old]\n" \ " eor %" #w "[tmp], %" #w "[oldval], %" #w "[old]\n" \
" cbnz %" #w "[tmp], 2f\n" \ " cbnz %" #w "[tmp], 2f\n" \
" st" #rel "xr" #sz "\t%w[tmp], %" #w "[new], %[v]\n" \ " st" #rel "xr" #sfx "\t%w[tmp], %" #w "[new], %[v]\n" \
" cbnz %w[tmp], 1b\n" \ " cbnz %w[tmp], 1b\n" \
" " #mb "\n" \ " " #mb "\n" \
"2:" \ "2:" \
: [tmp] "=&r" (tmp), [oldval] "=&r" (oldval), \ : [tmp] "=&r" (tmp), [oldval] "=&r" (oldval), \
[v] "+Q" (*(unsigned long *)ptr) \ [v] "+Q" (*(u##sz *)ptr) \
: [old] "Lr" (old), [new] "r" (new) \ : [old] #constraint "r" (old), [new] "r" (new) \
: cl); \ : cl); \
\ \
return oldval; \ return oldval; \
} \ } \
__LL_SC_EXPORT(__cmpxchg_case_##name); __LL_SC_EXPORT(__cmpxchg_case_##name##sz);
__CMPXCHG_CASE(w, b, 1, , , , ) /*
__CMPXCHG_CASE(w, h, 2, , , , ) * Earlier versions of GCC (no later than 8.1.0) appear to incorrectly
__CMPXCHG_CASE(w, , 4, , , , ) * handle the 'K' constraint for the value 4294967295 - thus we use no
__CMPXCHG_CASE( , , 8, , , , ) * constraint for 32 bit operations.
__CMPXCHG_CASE(w, b, acq_1, , a, , "memory") */
__CMPXCHG_CASE(w, h, acq_2, , a, , "memory") __CMPXCHG_CASE(w, b, , 8, , , , , )
__CMPXCHG_CASE(w, , acq_4, , a, , "memory") __CMPXCHG_CASE(w, h, , 16, , , , , )
__CMPXCHG_CASE( , , acq_8, , a, , "memory") __CMPXCHG_CASE(w, , , 32, , , , , )
__CMPXCHG_CASE(w, b, rel_1, , , l, "memory") __CMPXCHG_CASE( , , , 64, , , , , L)
__CMPXCHG_CASE(w, h, rel_2, , , l, "memory") __CMPXCHG_CASE(w, b, acq_, 8, , a, , "memory", )
__CMPXCHG_CASE(w, , rel_4, , , l, "memory") __CMPXCHG_CASE(w, h, acq_, 16, , a, , "memory", )
__CMPXCHG_CASE( , , rel_8, , , l, "memory") __CMPXCHG_CASE(w, , acq_, 32, , a, , "memory", )
__CMPXCHG_CASE(w, b, mb_1, dmb ish, , l, "memory") __CMPXCHG_CASE( , , acq_, 64, , a, , "memory", L)
__CMPXCHG_CASE(w, h, mb_2, dmb ish, , l, "memory") __CMPXCHG_CASE(w, b, rel_, 8, , , l, "memory", )
__CMPXCHG_CASE(w, , mb_4, dmb ish, , l, "memory") __CMPXCHG_CASE(w, h, rel_, 16, , , l, "memory", )
__CMPXCHG_CASE( , , mb_8, dmb ish, , l, "memory") __CMPXCHG_CASE(w, , rel_, 32, , , l, "memory", )
__CMPXCHG_CASE( , , rel_, 64, , , l, "memory", L)
__CMPXCHG_CASE(w, b, mb_, 8, dmb ish, , l, "memory", )
__CMPXCHG_CASE(w, h, mb_, 16, dmb ish, , l, "memory", )
__CMPXCHG_CASE(w, , mb_, 32, dmb ish, , l, "memory", )
__CMPXCHG_CASE( , , mb_, 64, dmb ish, , l, "memory", L)
#undef __CMPXCHG_CASE #undef __CMPXCHG_CASE

View File

@@ -480,24 +480,24 @@ static inline long atomic64_dec_if_positive(atomic64_t *v)
#define __LL_SC_CMPXCHG(op) __LL_SC_CALL(__cmpxchg_case_##op) #define __LL_SC_CMPXCHG(op) __LL_SC_CALL(__cmpxchg_case_##op)
#define __CMPXCHG_CASE(w, sz, name, mb, cl...) \ #define __CMPXCHG_CASE(w, sfx, name, sz, mb, cl...) \
static inline unsigned long __cmpxchg_case_##name(volatile void *ptr, \ static inline u##sz __cmpxchg_case_##name##sz(volatile void *ptr, \
unsigned long old, \ unsigned long old, \
unsigned long new) \ u##sz new) \
{ \ { \
register unsigned long x0 asm ("x0") = (unsigned long)ptr; \ register unsigned long x0 asm ("x0") = (unsigned long)ptr; \
register unsigned long x1 asm ("x1") = old; \ register unsigned long x1 asm ("x1") = old; \
register unsigned long x2 asm ("x2") = new; \ register u##sz x2 asm ("x2") = new; \
\ \
asm volatile( \ asm volatile( \
__LSE_PREAMBLE \ __LSE_PREAMBLE \
ARM64_LSE_ATOMIC_INSN( \ ARM64_LSE_ATOMIC_INSN( \
/* LL/SC */ \ /* LL/SC */ \
__LL_SC_CMPXCHG(name) \ __LL_SC_CMPXCHG(name##sz) \
__nops(2), \ __nops(2), \
/* LSE atomics */ \ /* LSE atomics */ \
" mov " #w "30, %" #w "[old]\n" \ " mov " #w "30, %" #w "[old]\n" \
" cas" #mb #sz "\t" #w "30, %" #w "[new], %[v]\n" \ " cas" #mb #sfx "\t" #w "30, %" #w "[new], %[v]\n" \
" mov %" #w "[ret], " #w "30") \ " mov %" #w "[ret], " #w "30") \
: [ret] "+r" (x0), [v] "+Q" (*(unsigned long *)ptr) \ : [ret] "+r" (x0), [v] "+Q" (*(unsigned long *)ptr) \
: [old] "r" (x1), [new] "r" (x2) \ : [old] "r" (x1), [new] "r" (x2) \
@@ -506,22 +506,22 @@ static inline unsigned long __cmpxchg_case_##name(volatile void *ptr, \
return x0; \ return x0; \
} }
__CMPXCHG_CASE(w, b, 1, ) __CMPXCHG_CASE(w, b, , 8, )
__CMPXCHG_CASE(w, h, 2, ) __CMPXCHG_CASE(w, h, , 16, )
__CMPXCHG_CASE(w, , 4, ) __CMPXCHG_CASE(w, , , 32, )
__CMPXCHG_CASE(x, , 8, ) __CMPXCHG_CASE(x, , , 64, )
__CMPXCHG_CASE(w, b, acq_1, a, "memory") __CMPXCHG_CASE(w, b, acq_, 8, a, "memory")
__CMPXCHG_CASE(w, h, acq_2, a, "memory") __CMPXCHG_CASE(w, h, acq_, 16, a, "memory")
__CMPXCHG_CASE(w, , acq_4, a, "memory") __CMPXCHG_CASE(w, , acq_, 32, a, "memory")
__CMPXCHG_CASE(x, , acq_8, a, "memory") __CMPXCHG_CASE(x, , acq_, 64, a, "memory")
__CMPXCHG_CASE(w, b, rel_1, l, "memory") __CMPXCHG_CASE(w, b, rel_, 8, l, "memory")
__CMPXCHG_CASE(w, h, rel_2, l, "memory") __CMPXCHG_CASE(w, h, rel_, 16, l, "memory")
__CMPXCHG_CASE(w, , rel_4, l, "memory") __CMPXCHG_CASE(w, , rel_, 32, l, "memory")
__CMPXCHG_CASE(x, , rel_8, l, "memory") __CMPXCHG_CASE(x, , rel_, 64, l, "memory")
__CMPXCHG_CASE(w, b, mb_1, al, "memory") __CMPXCHG_CASE(w, b, mb_, 8, al, "memory")
__CMPXCHG_CASE(w, h, mb_2, al, "memory") __CMPXCHG_CASE(w, h, mb_, 16, al, "memory")
__CMPXCHG_CASE(w, , mb_4, al, "memory") __CMPXCHG_CASE(w, , mb_, 32, al, "memory")
__CMPXCHG_CASE(x, , mb_8, al, "memory") __CMPXCHG_CASE(x, , mb_, 64, al, "memory")
#undef __LL_SC_CMPXCHG #undef __LL_SC_CMPXCHG
#undef __CMPXCHG_CASE #undef __CMPXCHG_CASE

View File

@@ -30,46 +30,46 @@
* barrier case is generated as release+dmb for the former and * barrier case is generated as release+dmb for the former and
* acquire+release for the latter. * acquire+release for the latter.
*/ */
#define __XCHG_CASE(w, sz, name, mb, nop_lse, acq, acq_lse, rel, cl) \ #define __XCHG_CASE(w, sfx, name, sz, mb, nop_lse, acq, acq_lse, rel, cl) \
static inline unsigned long __xchg_case_##name(unsigned long x, \ static inline u##sz __xchg_case_##name##sz(u##sz x, volatile void *ptr) \
volatile void *ptr) \ { \
{ \ u##sz ret; \
unsigned long ret, tmp; \ unsigned long tmp; \
\ \
asm volatile(ARM64_LSE_ATOMIC_INSN( \ asm volatile(ARM64_LSE_ATOMIC_INSN( \
/* LL/SC */ \ /* LL/SC */ \
" prfm pstl1strm, %2\n" \ " prfm pstl1strm, %2\n" \
"1: ld" #acq "xr" #sz "\t%" #w "0, %2\n" \ "1: ld" #acq "xr" #sfx "\t%" #w "0, %2\n" \
" st" #rel "xr" #sz "\t%w1, %" #w "3, %2\n" \ " st" #rel "xr" #sfx "\t%w1, %" #w "3, %2\n" \
" cbnz %w1, 1b\n" \ " cbnz %w1, 1b\n" \
" " #mb, \ " " #mb, \
/* LSE atomics */ \ /* LSE atomics */ \
" swp" #acq_lse #rel #sz "\t%" #w "3, %" #w "0, %2\n" \ " swp" #acq_lse #rel #sfx "\t%" #w "3, %" #w "0, %2\n" \
__nops(3) \ __nops(3) \
" " #nop_lse) \ " " #nop_lse) \
: "=&r" (ret), "=&r" (tmp), "+Q" (*(unsigned long *)ptr) \ : "=&r" (ret), "=&r" (tmp), "+Q" (*(u##sz *)ptr) \
: "r" (x) \ : "r" (x) \
: cl); \ : cl); \
\ \
return ret; \ return ret; \
} }
__XCHG_CASE(w, b, 1, , , , , , ) __XCHG_CASE(w, b, , 8, , , , , , )
__XCHG_CASE(w, h, 2, , , , , , ) __XCHG_CASE(w, h, , 16, , , , , , )
__XCHG_CASE(w, , 4, , , , , , ) __XCHG_CASE(w, , , 32, , , , , , )
__XCHG_CASE( , , 8, , , , , , ) __XCHG_CASE( , , , 64, , , , , , )
__XCHG_CASE(w, b, acq_1, , , a, a, , "memory") __XCHG_CASE(w, b, acq_, 8, , , a, a, , "memory")
__XCHG_CASE(w, h, acq_2, , , a, a, , "memory") __XCHG_CASE(w, h, acq_, 16, , , a, a, , "memory")
__XCHG_CASE(w, , acq_4, , , a, a, , "memory") __XCHG_CASE(w, , acq_, 32, , , a, a, , "memory")
__XCHG_CASE( , , acq_8, , , a, a, , "memory") __XCHG_CASE( , , acq_, 64, , , a, a, , "memory")
__XCHG_CASE(w, b, rel_1, , , , , l, "memory") __XCHG_CASE(w, b, rel_, 8, , , , , l, "memory")
__XCHG_CASE(w, h, rel_2, , , , , l, "memory") __XCHG_CASE(w, h, rel_, 16, , , , , l, "memory")
__XCHG_CASE(w, , rel_4, , , , , l, "memory") __XCHG_CASE(w, , rel_, 32, , , , , l, "memory")
__XCHG_CASE( , , rel_8, , , , , l, "memory") __XCHG_CASE( , , rel_, 64, , , , , l, "memory")
__XCHG_CASE(w, b, mb_1, dmb ish, nop, , a, l, "memory") __XCHG_CASE(w, b, mb_, 8, dmb ish, nop, , a, l, "memory")
__XCHG_CASE(w, h, mb_2, dmb ish, nop, , a, l, "memory") __XCHG_CASE(w, h, mb_, 16, dmb ish, nop, , a, l, "memory")
__XCHG_CASE(w, , mb_4, dmb ish, nop, , a, l, "memory") __XCHG_CASE(w, , mb_, 32, dmb ish, nop, , a, l, "memory")
__XCHG_CASE( , , mb_8, dmb ish, nop, , a, l, "memory") __XCHG_CASE( , , mb_, 64, dmb ish, nop, , a, l, "memory")
#undef __XCHG_CASE #undef __XCHG_CASE
@@ -80,13 +80,13 @@ static __always_inline unsigned long __xchg##sfx(unsigned long x, \
{ \ { \
switch (size) { \ switch (size) { \
case 1: \ case 1: \
return __xchg_case##sfx##_1(x, ptr); \
case 2: \
return __xchg_case##sfx##_2(x, ptr); \
case 4: \
return __xchg_case##sfx##_4(x, ptr); \
case 8: \
return __xchg_case##sfx##_8(x, ptr); \ return __xchg_case##sfx##_8(x, ptr); \
case 2: \
return __xchg_case##sfx##_16(x, ptr); \
case 4: \
return __xchg_case##sfx##_32(x, ptr); \
case 8: \
return __xchg_case##sfx##_64(x, ptr); \
default: \ default: \
BUILD_BUG(); \ BUILD_BUG(); \
} \ } \
@@ -123,13 +123,13 @@ static __always_inline unsigned long __cmpxchg##sfx(volatile void *ptr, \
{ \ { \
switch (size) { \ switch (size) { \
case 1: \ case 1: \
return __cmpxchg_case##sfx##_1(ptr, (u8)old, new); \ return __cmpxchg_case##sfx##_8(ptr, (u8)old, new); \
case 2: \ case 2: \
return __cmpxchg_case##sfx##_2(ptr, (u16)old, new); \ return __cmpxchg_case##sfx##_16(ptr, (u16)old, new); \
case 4: \ case 4: \
return __cmpxchg_case##sfx##_4(ptr, old, new); \ return __cmpxchg_case##sfx##_32(ptr, old, new); \
case 8: \ case 8: \
return __cmpxchg_case##sfx##_8(ptr, old, new); \ return __cmpxchg_case##sfx##_64(ptr, old, new); \
default: \ default: \
BUILD_BUG(); \ BUILD_BUG(); \
} \ } \
@@ -197,16 +197,16 @@ __CMPXCHG_GEN(_mb)
__ret; \ __ret; \
}) })
#define __CMPWAIT_CASE(w, sz, name) \ #define __CMPWAIT_CASE(w, sfx, sz) \
static inline void __cmpwait_case_##name(volatile void *ptr, \ static inline void __cmpwait_case_##sz(volatile void *ptr, \
unsigned long val) \ unsigned long val) \
{ \ { \
unsigned long tmp; \ unsigned long tmp; \
\ \
asm volatile( \ asm volatile( \
" sevl\n" \ " sevl\n" \
" wfe\n" \ " wfe\n" \
" ldxr" #sz "\t%" #w "[tmp], %[v]\n" \ " ldxr" #sfx "\t%" #w "[tmp], %[v]\n" \
" eor %" #w "[tmp], %" #w "[tmp], %" #w "[val]\n" \ " eor %" #w "[tmp], %" #w "[tmp], %" #w "[val]\n" \
" cbnz %" #w "[tmp], 1f\n" \ " cbnz %" #w "[tmp], 1f\n" \
" wfe\n" \ " wfe\n" \
@@ -215,10 +215,10 @@ static inline void __cmpwait_case_##name(volatile void *ptr, \
: [val] "r" (val)); \ : [val] "r" (val)); \
} }
__CMPWAIT_CASE(w, b, 1); __CMPWAIT_CASE(w, b, 8);
__CMPWAIT_CASE(w, h, 2); __CMPWAIT_CASE(w, h, 16);
__CMPWAIT_CASE(w, , 4); __CMPWAIT_CASE(w, , 32);
__CMPWAIT_CASE( , , 8); __CMPWAIT_CASE( , , 64);
#undef __CMPWAIT_CASE #undef __CMPWAIT_CASE
@@ -229,13 +229,13 @@ static __always_inline void __cmpwait##sfx(volatile void *ptr, \
{ \ { \
switch (size) { \ switch (size) { \
case 1: \ case 1: \
return __cmpwait_case##sfx##_1(ptr, (u8)val); \ return __cmpwait_case##sfx##_8(ptr, (u8)val); \
case 2: \ case 2: \
return __cmpwait_case##sfx##_2(ptr, (u16)val); \ return __cmpwait_case##sfx##_16(ptr, (u16)val); \
case 4: \ case 4: \
return __cmpwait_case##sfx##_4(ptr, val); \ return __cmpwait_case##sfx##_32(ptr, val); \
case 8: \ case 8: \
return __cmpwait_case##sfx##_8(ptr, val); \ return __cmpwait_case##sfx##_64(ptr, val); \
default: \ default: \
BUILD_BUG(); \ BUILD_BUG(); \
} \ } \

View File

@@ -1,5 +1,5 @@
SECTIONS { SECTIONS {
.plt (NOLOAD) : { BYTE(0) } .plt 0 (NOLOAD) : { BYTE(0) }
.init.plt (NOLOAD) : { BYTE(0) } .init.plt 0 (NOLOAD) : { BYTE(0) }
.text.ftrace_trampoline (NOLOAD) : { BYTE(0) } .text.ftrace_trampoline 0 (NOLOAD) : { BYTE(0) }
} }

View File

@@ -16,12 +16,9 @@ ccflags-vdso := \
$(filter -march=%,$(KBUILD_CFLAGS)) \ $(filter -march=%,$(KBUILD_CFLAGS)) \
$(filter -m%-float,$(KBUILD_CFLAGS)) \ $(filter -m%-float,$(KBUILD_CFLAGS)) \
$(filter -mno-loongson-%,$(KBUILD_CFLAGS)) \ $(filter -mno-loongson-%,$(KBUILD_CFLAGS)) \
$(CLANG_FLAGS) \
-D__VDSO__ -D__VDSO__
ifeq ($(cc-name),clang)
ccflags-vdso += $(filter --target=%,$(KBUILD_CFLAGS))
endif
# #
# The -fno-jump-tables flag only prevents the compiler from generating # The -fno-jump-tables flag only prevents the compiler from generating
# jump tables but does not prevent the compiler from emitting absolute # jump tables but does not prevent the compiler from emitting absolute

View File

@@ -380,7 +380,11 @@ static inline int eirr_to_irq(unsigned long eirr)
/* /*
* IRQ STACK - used for irq handler * IRQ STACK - used for irq handler
*/ */
#ifdef CONFIG_64BIT
#define IRQ_STACK_SIZE (4096 << 4) /* 64k irq stack size */
#else
#define IRQ_STACK_SIZE (4096 << 3) /* 32k irq stack size */ #define IRQ_STACK_SIZE (4096 << 3) /* 32k irq stack size */
#endif
union irq_stack_union { union irq_stack_union {
unsigned long stack[IRQ_STACK_SIZE/sizeof(unsigned long)]; unsigned long stack[IRQ_STACK_SIZE/sizeof(unsigned long)];

View File

@@ -126,6 +126,7 @@ int apply_relocate(Elf32_Shdr *sechdrs,
*location += sym->st_value; *location += sym->st_value;
break; break;
case R_386_PC32: case R_386_PC32:
case R_386_PLT32:
/* Add the value, subtract its position */ /* Add the value, subtract its position */
*location += sym->st_value - (uint32_t)location; *location += sym->st_value - (uint32_t)location;
break; break;

View File

@@ -477,6 +477,15 @@ static const struct dmi_system_id reboot_dmi_table[] __initconst = {
}, },
}, },
{ /* PCIe Wifi card isn't detected after reboot otherwise */
.callback = set_pci_reboot,
.ident = "Zotac ZBOX CI327 nano",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "NA"),
DMI_MATCH(DMI_PRODUCT_NAME, "ZBOX-CI327NANO-GS-01"),
},
},
/* Sony */ /* Sony */
{ /* Handle problems with rebooting on Sony VGN-Z540N */ { /* Handle problems with rebooting on Sony VGN-Z540N */
.callback = set_bios_reboot, .callback = set_bios_reboot,

View File

@@ -848,9 +848,11 @@ static int do_reloc32(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
case R_386_PC32: case R_386_PC32:
case R_386_PC16: case R_386_PC16:
case R_386_PC8: case R_386_PC8:
case R_386_PLT32:
/* /*
* NONE can be ignored and PC relative relocations don't * NONE can be ignored and PC relative relocations don't need
* need to be adjusted. * to be adjusted. Because sym must be defined, R_386_PLT32 can
* be treated the same way as R_386_PC32.
*/ */
break; break;
@@ -891,9 +893,11 @@ static int do_reloc_real(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
case R_386_PC32: case R_386_PC32:
case R_386_PC16: case R_386_PC16:
case R_386_PC8: case R_386_PC8:
case R_386_PLT32:
/* /*
* NONE can be ignored and PC relative relocations don't * NONE can be ignored and PC relative relocations don't need
* need to be adjusted. * to be adjusted. Because sym must be defined, R_386_PLT32 can
* be treated the same way as R_386_PC32.
*/ */
break; break;

View File

@@ -706,6 +706,8 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
unsigned long mfn, pfn; unsigned long mfn, pfn;
struct gnttab_unmap_grant_ref unmap[2];
int rc;
/* Do not add to override if the map failed. */ /* Do not add to override if the map failed. */
if (map_ops[i].status != GNTST_okay || if (map_ops[i].status != GNTST_okay ||
@@ -723,10 +725,46 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
WARN(pfn_to_mfn(pfn) != INVALID_P2M_ENTRY, "page must be ballooned"); WARN(pfn_to_mfn(pfn) != INVALID_P2M_ENTRY, "page must be ballooned");
if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)))) { if (likely(set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))
ret = -ENOMEM; continue;
goto out;
/*
* Signal an error for this slot. This in turn requires
* immediate unmapping.
*/
map_ops[i].status = GNTST_general_error;
unmap[0].host_addr = map_ops[i].host_addr,
unmap[0].handle = map_ops[i].handle;
map_ops[i].handle = ~0;
if (map_ops[i].flags & GNTMAP_device_map)
unmap[0].dev_bus_addr = map_ops[i].dev_bus_addr;
else
unmap[0].dev_bus_addr = 0;
if (kmap_ops) {
kmap_ops[i].status = GNTST_general_error;
unmap[1].host_addr = kmap_ops[i].host_addr,
unmap[1].handle = kmap_ops[i].handle;
kmap_ops[i].handle = ~0;
if (kmap_ops[i].flags & GNTMAP_device_map)
unmap[1].dev_bus_addr = kmap_ops[i].dev_bus_addr;
else
unmap[1].dev_bus_addr = 0;
} }
/*
* Pre-populate both status fields, to be recognizable in
* the log message below.
*/
unmap[0].status = 1;
unmap[1].status = 1;
rc = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
unmap, 1 + !!kmap_ops);
if (rc || unmap[0].status != GNTST_okay ||
unmap[1].status != GNTST_okay)
pr_err_once("gnttab unmap failed: rc=%d st0=%d st1=%d\n",
rc, unmap[0].status, unmap[1].status);
} }
out: out:

View File

@@ -202,8 +202,8 @@ static int test_mb_aead_jiffies(struct test_mb_aead_data *data, int enc,
goto out; goto out;
} }
pr_cont("%d operations in %d seconds (%ld bytes)\n", pr_cont("%d operations in %d seconds (%llu bytes)\n",
bcount * num_mb, secs, (long)bcount * blen * num_mb); bcount * num_mb, secs, (u64)bcount * blen * num_mb);
out: out:
kfree(rc); kfree(rc);
@@ -472,8 +472,8 @@ static int test_aead_jiffies(struct aead_request *req, int enc,
return ret; return ret;
} }
printk("%d operations in %d seconds (%ld bytes)\n", pr_cont("%d operations in %d seconds (%llu bytes)\n",
bcount, secs, (long)bcount * blen); bcount, secs, (u64)bcount * blen);
return 0; return 0;
} }
@@ -763,8 +763,8 @@ static int test_mb_ahash_jiffies(struct test_mb_ahash_data *data, int blen,
goto out; goto out;
} }
pr_cont("%d operations in %d seconds (%ld bytes)\n", pr_cont("%d operations in %d seconds (%llu bytes)\n",
bcount * num_mb, secs, (long)bcount * blen * num_mb); bcount * num_mb, secs, (u64)bcount * blen * num_mb);
out: out:
kfree(rc); kfree(rc);
@@ -1200,8 +1200,8 @@ static int test_mb_acipher_jiffies(struct test_mb_skcipher_data *data, int enc,
goto out; goto out;
} }
pr_cont("%d operations in %d seconds (%ld bytes)\n", pr_cont("%d operations in %d seconds (%llu bytes)\n",
bcount * num_mb, secs, (long)bcount * blen * num_mb); bcount * num_mb, secs, (u64)bcount * blen * num_mb);
out: out:
kfree(rc); kfree(rc);
@@ -1438,8 +1438,8 @@ static int test_acipher_jiffies(struct skcipher_request *req, int enc,
return ret; return ret;
} }
pr_cont("%d operations in %d seconds (%ld bytes)\n", pr_cont("%d operations in %d seconds (%llu bytes)\n",
bcount, secs, (long)bcount * blen); bcount, secs, (u64)bcount * blen);
return 0; return 0;
} }

View File

@@ -1093,7 +1093,7 @@ static ssize_t mm_stat_show(struct device *dev,
zram->limit_pages << PAGE_SHIFT, zram->limit_pages << PAGE_SHIFT,
max_used << PAGE_SHIFT, max_used << PAGE_SHIFT,
(u64)atomic64_read(&zram->stats.same_pages), (u64)atomic64_read(&zram->stats.same_pages),
pool_stats.pages_compacted, atomic_long_read(&pool_stats.pages_compacted),
(u64)atomic64_read(&zram->stats.huge_pages)); (u64)atomic64_read(&zram->stats.huge_pages));
up_read(&zram->init_lock); up_read(&zram->init_lock);

View File

@@ -885,6 +885,11 @@ static int h5_btrtl_setup(struct h5 *h5)
/* Give the device some time before the hci-core sends it a reset */ /* Give the device some time before the hci-core sends it a reset */
usleep_range(10000, 20000); usleep_range(10000, 20000);
/* Enable controller to do both LE scan and BR/EDR inquiry
* simultaneously.
*/
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &h5->hu->hdev->quirks);
out_free: out_free:
btrtl_free(btrtl_dev); btrtl_free(btrtl_dev);

View File

@@ -1124,6 +1124,11 @@ static bool construct(
goto ddc_create_fail; goto ddc_create_fail;
} }
if (!link->ddc->ddc_pin) {
DC_ERROR("Failed to get I2C info for connector!\n");
goto ddc_create_fail;
}
link->ddc_hw_inst = link->ddc_hw_inst =
dal_ddc_get_line( dal_ddc_get_line(
dal_ddc_service_get_ddc_pin(link->ddc)); dal_ddc_service_get_ddc_pin(link->ddc));

View File

@@ -685,11 +685,18 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, u8 *buf, int buf_len,
data[0], data[1]); data[0], data[1]);
break; break;
case MCE_RSP_EQIRCFS: case MCE_RSP_EQIRCFS:
if (!data[0] && !data[1]) {
dev_dbg(dev, "%s: no carrier", inout);
break;
}
// prescaler should make sense
if (data[0] > 8)
break;
period = DIV_ROUND_CLOSEST((1U << data[0] * 2) * period = DIV_ROUND_CLOSEST((1U << data[0] * 2) *
(data[1] + 1), 10); (data[1] + 1), 10);
if (!period) if (!period)
break; break;
carrier = (1000 * 1000) / period; carrier = USEC_PER_SEC / period;
dev_dbg(dev, "%s carrier of %u Hz (period %uus)", dev_dbg(dev, "%s carrier of %u Hz (period %uus)",
inout, carrier, period); inout, carrier, period);
break; break;

View File

@@ -940,7 +940,10 @@ static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id,
unsigned int i; unsigned int i;
extra_size = roundup(extra_size, sizeof(*entity->pads)); extra_size = roundup(extra_size, sizeof(*entity->pads));
num_inputs = (type & UVC_TERM_OUTPUT) ? num_pads : num_pads - 1; if (num_pads)
num_inputs = type & UVC_TERM_OUTPUT ? num_pads : num_pads - 1;
else
num_inputs = 0;
size = sizeof(*entity) + extra_size + sizeof(*entity->pads) * num_pads size = sizeof(*entity) + extra_size + sizeof(*entity->pads) * num_pads
+ num_inputs; + num_inputs;
entity = kzalloc(size, GFP_KERNEL); entity = kzalloc(size, GFP_KERNEL);
@@ -956,7 +959,7 @@ static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id,
for (i = 0; i < num_inputs; ++i) for (i = 0; i < num_inputs; ++i)
entity->pads[i].flags = MEDIA_PAD_FL_SINK; entity->pads[i].flags = MEDIA_PAD_FL_SINK;
if (!UVC_ENTITY_IS_OTERM(entity)) if (!UVC_ENTITY_IS_OTERM(entity) && num_pads)
entity->pads[num_pads-1].flags = MEDIA_PAD_FL_SOURCE; entity->pads[num_pads-1].flags = MEDIA_PAD_FL_SOURCE;
entity->bNrInPins = num_inputs; entity->bNrInPins = num_inputs;

View File

@@ -2947,7 +2947,7 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
v4l2_kioctl func) v4l2_kioctl func)
{ {
char sbuf[128]; char sbuf[128];
void *mbuf = NULL; void *mbuf = NULL, *array_buf = NULL;
void *parg = (void *)arg; void *parg = (void *)arg;
long err = -EINVAL; long err = -EINVAL;
bool has_array_args; bool has_array_args;
@@ -3006,20 +3006,14 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
has_array_args = err; has_array_args = err;
if (has_array_args) { if (has_array_args) {
/* array_buf = kvmalloc(array_size, GFP_KERNEL);
* When adding new types of array args, make sure that the
* parent argument to ioctl (which contains the pointer to the
* array) fits into sbuf (so that mbuf will still remain
* unused up to here).
*/
mbuf = kvmalloc(array_size, GFP_KERNEL);
err = -ENOMEM; err = -ENOMEM;
if (NULL == mbuf) if (array_buf == NULL)
goto out_array_args; goto out_array_args;
err = -EFAULT; err = -EFAULT;
if (copy_from_user(mbuf, user_ptr, array_size)) if (copy_from_user(array_buf, user_ptr, array_size))
goto out_array_args; goto out_array_args;
*kernel_ptr = mbuf; *kernel_ptr = array_buf;
} }
/* Handles IOCTL */ /* Handles IOCTL */
@@ -3038,7 +3032,7 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
if (has_array_args) { if (has_array_args) {
*kernel_ptr = (void __force *)user_ptr; *kernel_ptr = (void __force *)user_ptr;
if (copy_to_user(user_ptr, mbuf, array_size)) if (copy_to_user(user_ptr, array_buf, array_size))
err = -EFAULT; err = -EFAULT;
goto out_array_args; goto out_array_args;
} }
@@ -3060,6 +3054,7 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
} }
out: out:
kvfree(array_buf);
kvfree(mbuf); kvfree(mbuf);
return err; return err;
} }

View File

@@ -1217,6 +1217,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x19d2, 0x1255, 4)}, {QMI_FIXED_INTF(0x19d2, 0x1255, 4)},
{QMI_FIXED_INTF(0x19d2, 0x1256, 4)}, {QMI_FIXED_INTF(0x19d2, 0x1256, 4)},
{QMI_FIXED_INTF(0x19d2, 0x1270, 5)}, /* ZTE MF667 */ {QMI_FIXED_INTF(0x19d2, 0x1270, 5)}, /* ZTE MF667 */
{QMI_FIXED_INTF(0x19d2, 0x1275, 3)}, /* ZTE P685M */
{QMI_FIXED_INTF(0x19d2, 0x1401, 2)}, {QMI_FIXED_INTF(0x19d2, 0x1401, 2)},
{QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */ {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */
{QMI_FIXED_INTF(0x19d2, 0x1424, 2)}, {QMI_FIXED_INTF(0x19d2, 0x1424, 2)},

View File

@@ -3567,23 +3567,16 @@ bool ath10k_mac_tx_frm_has_freq(struct ath10k *ar)
static int ath10k_mac_tx_wmi_mgmt(struct ath10k *ar, struct sk_buff *skb) static int ath10k_mac_tx_wmi_mgmt(struct ath10k *ar, struct sk_buff *skb)
{ {
struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue;
int ret = 0;
spin_lock_bh(&ar->data_lock); if (skb_queue_len_lockless(q) >= ATH10K_MAX_NUM_MGMT_PENDING) {
if (skb_queue_len(q) == ATH10K_MAX_NUM_MGMT_PENDING) {
ath10k_warn(ar, "wmi mgmt tx queue is full\n"); ath10k_warn(ar, "wmi mgmt tx queue is full\n");
ret = -ENOSPC; return -ENOSPC;
goto unlock;
} }
__skb_queue_tail(q, skb); skb_queue_tail(q, skb);
ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work);
unlock: return 0;
spin_unlock_bh(&ar->data_lock);
return ret;
} }
static enum ath10k_mac_tx_path static enum ath10k_mac_tx_path

View File

@@ -238,7 +238,8 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
rsi_set_len_qno(&data_desc->len_qno, rsi_set_len_qno(&data_desc->len_qno,
(skb->len - FRAME_DESC_SZ), (skb->len - FRAME_DESC_SZ),
RSI_WIFI_MGMT_Q); RSI_WIFI_MGMT_Q);
if ((skb->len - header_size) == EAPOL4_PACKET_LEN) { if (((skb->len - header_size) == EAPOL4_PACKET_LEN) ||
((skb->len - header_size) == EAPOL4_PACKET_LEN - 2)) {
data_desc->misc_flags |= data_desc->misc_flags |=
RSI_DESC_REQUIRE_CFM_TO_HOST; RSI_DESC_REQUIRE_CFM_TO_HOST;
xtend_desc->confirm_frame_type = EAPOL4_CONFIRM; xtend_desc->confirm_frame_type = EAPOL4_CONFIRM;

View File

@@ -153,9 +153,7 @@ static void rsi_handle_interrupt(struct sdio_func *function)
if (adapter->priv->fsm_state == FSM_FW_NOT_LOADED) if (adapter->priv->fsm_state == FSM_FW_NOT_LOADED)
return; return;
dev->sdio_irq_task = current; rsi_set_event(&dev->rx_thread.event);
rsi_interrupt_handler(adapter);
dev->sdio_irq_task = NULL;
} }
/** /**
@@ -973,8 +971,6 @@ static int rsi_probe(struct sdio_func *pfunction,
rsi_dbg(ERR_ZONE, "%s: Unable to init rx thrd\n", __func__); rsi_dbg(ERR_ZONE, "%s: Unable to init rx thrd\n", __func__);
goto fail_kill_thread; goto fail_kill_thread;
} }
skb_queue_head_init(&sdev->rx_q.head);
sdev->rx_q.num_rx_pkts = 0;
sdio_claim_host(pfunction); sdio_claim_host(pfunction);
if (sdio_claim_irq(pfunction, rsi_handle_interrupt)) { if (sdio_claim_irq(pfunction, rsi_handle_interrupt)) {

View File

@@ -60,39 +60,20 @@ int rsi_sdio_master_access_msword(struct rsi_hw *adapter, u16 ms_word)
return status; return status;
} }
static void rsi_rx_handler(struct rsi_hw *adapter);
void rsi_sdio_rx_thread(struct rsi_common *common) void rsi_sdio_rx_thread(struct rsi_common *common)
{ {
struct rsi_hw *adapter = common->priv; struct rsi_hw *adapter = common->priv;
struct rsi_91x_sdiodev *sdev = adapter->rsi_dev; struct rsi_91x_sdiodev *sdev = adapter->rsi_dev;
struct sk_buff *skb;
int status;
do { do {
rsi_wait_event(&sdev->rx_thread.event, EVENT_WAIT_FOREVER); rsi_wait_event(&sdev->rx_thread.event, EVENT_WAIT_FOREVER);
rsi_reset_event(&sdev->rx_thread.event); rsi_reset_event(&sdev->rx_thread.event);
rsi_rx_handler(adapter);
} while (!atomic_read(&sdev->rx_thread.thread_done));
while (true) {
if (atomic_read(&sdev->rx_thread.thread_done))
goto out;
skb = skb_dequeue(&sdev->rx_q.head);
if (!skb)
break;
if (sdev->rx_q.num_rx_pkts > 0)
sdev->rx_q.num_rx_pkts--;
status = rsi_read_pkt(common, skb->data, skb->len);
if (status) {
rsi_dbg(ERR_ZONE, "Failed to read the packet\n");
dev_kfree_skb(skb);
break;
}
dev_kfree_skb(skb);
}
} while (1);
out:
rsi_dbg(INFO_ZONE, "%s: Terminated SDIO RX thread\n", __func__); rsi_dbg(INFO_ZONE, "%s: Terminated SDIO RX thread\n", __func__);
skb_queue_purge(&sdev->rx_q.head);
atomic_inc(&sdev->rx_thread.thread_done); atomic_inc(&sdev->rx_thread.thread_done);
complete_and_exit(&sdev->rx_thread.completion, 0); complete_and_exit(&sdev->rx_thread.completion, 0);
} }
@@ -113,10 +94,6 @@ static int rsi_process_pkt(struct rsi_common *common)
u32 rcv_pkt_len = 0; u32 rcv_pkt_len = 0;
int status = 0; int status = 0;
u8 value = 0; u8 value = 0;
struct sk_buff *skb;
if (dev->rx_q.num_rx_pkts >= RSI_MAX_RX_PKTS)
return 0;
num_blks = ((adapter->interrupt_status & 1) | num_blks = ((adapter->interrupt_status & 1) |
((adapter->interrupt_status >> RECV_NUM_BLOCKS) << 1)); ((adapter->interrupt_status >> RECV_NUM_BLOCKS) << 1));
@@ -144,22 +121,19 @@ static int rsi_process_pkt(struct rsi_common *common)
rcv_pkt_len = (num_blks * 256); rcv_pkt_len = (num_blks * 256);
skb = dev_alloc_skb(rcv_pkt_len); status = rsi_sdio_host_intf_read_pkt(adapter, dev->pktbuffer,
if (!skb) rcv_pkt_len);
return -ENOMEM;
status = rsi_sdio_host_intf_read_pkt(adapter, skb->data, rcv_pkt_len);
if (status) { if (status) {
rsi_dbg(ERR_ZONE, "%s: Failed to read packet from card\n", rsi_dbg(ERR_ZONE, "%s: Failed to read packet from card\n",
__func__); __func__);
dev_kfree_skb(skb);
return status; return status;
} }
skb_put(skb, rcv_pkt_len);
skb_queue_tail(&dev->rx_q.head, skb);
dev->rx_q.num_rx_pkts++;
rsi_set_event(&dev->rx_thread.event); status = rsi_read_pkt(common, dev->pktbuffer, rcv_pkt_len);
if (status) {
rsi_dbg(ERR_ZONE, "Failed to read the packet\n");
return status;
}
return 0; return 0;
} }
@@ -251,12 +225,12 @@ int rsi_init_sdio_slave_regs(struct rsi_hw *adapter)
} }
/** /**
* rsi_interrupt_handler() - This function read and process SDIO interrupts. * rsi_rx_handler() - Read and process SDIO interrupts.
* @adapter: Pointer to the adapter structure. * @adapter: Pointer to the adapter structure.
* *
* Return: None. * Return: None.
*/ */
void rsi_interrupt_handler(struct rsi_hw *adapter) static void rsi_rx_handler(struct rsi_hw *adapter)
{ {
struct rsi_common *common = adapter->priv; struct rsi_common *common = adapter->priv;
struct rsi_91x_sdiodev *dev = struct rsi_91x_sdiodev *dev =

View File

@@ -110,11 +110,6 @@ struct receive_info {
u32 buf_available_counter; u32 buf_available_counter;
}; };
struct rsi_sdio_rx_q {
u8 num_rx_pkts;
struct sk_buff_head head;
};
struct rsi_91x_sdiodev { struct rsi_91x_sdiodev {
struct sdio_func *pfunction; struct sdio_func *pfunction;
struct task_struct *sdio_irq_task; struct task_struct *sdio_irq_task;
@@ -127,11 +122,10 @@ struct rsi_91x_sdiodev {
u16 tx_blk_size; u16 tx_blk_size;
u8 write_fail; u8 write_fail;
bool buff_status_updated; bool buff_status_updated;
struct rsi_sdio_rx_q rx_q;
struct rsi_thread rx_thread; struct rsi_thread rx_thread;
u8 pktbuffer[8192] __aligned(4);
}; };
void rsi_interrupt_handler(struct rsi_hw *adapter);
int rsi_init_sdio_slave_regs(struct rsi_hw *adapter); int rsi_init_sdio_slave_regs(struct rsi_hw *adapter);
int rsi_sdio_read_register(struct rsi_hw *adapter, u32 addr, u8 *data); int rsi_sdio_read_register(struct rsi_hw *adapter, u32 addr, u8 *data);
int rsi_sdio_host_intf_read_pkt(struct rsi_hw *adapter, u8 *pkt, u32 length); int rsi_sdio_host_intf_read_pkt(struct rsi_hw *adapter, u8 *pkt, u32 length);

View File

@@ -649,7 +649,6 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
wl->quirks |= WLCORE_QUIRK_LEGACY_NVS | wl->quirks |= WLCORE_QUIRK_LEGACY_NVS |
WLCORE_QUIRK_DUAL_PROBE_TMPL | WLCORE_QUIRK_DUAL_PROBE_TMPL |
WLCORE_QUIRK_TKIP_HEADER_SPACE | WLCORE_QUIRK_TKIP_HEADER_SPACE |
WLCORE_QUIRK_START_STA_FAILS |
WLCORE_QUIRK_AP_ZERO_SESSION_ID; WLCORE_QUIRK_AP_ZERO_SESSION_ID;
wl->sr_fw_name = WL127X_FW_NAME_SINGLE; wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
wl->mr_fw_name = WL127X_FW_NAME_MULTI; wl->mr_fw_name = WL127X_FW_NAME_MULTI;
@@ -673,7 +672,6 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
wl->quirks |= WLCORE_QUIRK_LEGACY_NVS | wl->quirks |= WLCORE_QUIRK_LEGACY_NVS |
WLCORE_QUIRK_DUAL_PROBE_TMPL | WLCORE_QUIRK_DUAL_PROBE_TMPL |
WLCORE_QUIRK_TKIP_HEADER_SPACE | WLCORE_QUIRK_TKIP_HEADER_SPACE |
WLCORE_QUIRK_START_STA_FAILS |
WLCORE_QUIRK_AP_ZERO_SESSION_ID; WLCORE_QUIRK_AP_ZERO_SESSION_ID;
wl->plt_fw_name = WL127X_PLT_FW_NAME; wl->plt_fw_name = WL127X_PLT_FW_NAME;
wl->sr_fw_name = WL127X_FW_NAME_SINGLE; wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
@@ -702,7 +700,6 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
wl->quirks |= WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN | wl->quirks |= WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN |
WLCORE_QUIRK_DUAL_PROBE_TMPL | WLCORE_QUIRK_DUAL_PROBE_TMPL |
WLCORE_QUIRK_TKIP_HEADER_SPACE | WLCORE_QUIRK_TKIP_HEADER_SPACE |
WLCORE_QUIRK_START_STA_FAILS |
WLCORE_QUIRK_AP_ZERO_SESSION_ID; WLCORE_QUIRK_AP_ZERO_SESSION_ID;
wlcore_set_min_fw_ver(wl, WL128X_CHIP_VER, wlcore_set_min_fw_ver(wl, WL128X_CHIP_VER,

View File

@@ -2875,21 +2875,8 @@ static int wlcore_join(struct wl1271 *wl, struct wl12xx_vif *wlvif)
if (is_ibss) if (is_ibss)
ret = wl12xx_cmd_role_start_ibss(wl, wlvif); ret = wl12xx_cmd_role_start_ibss(wl, wlvif);
else { else
if (wl->quirks & WLCORE_QUIRK_START_STA_FAILS) {
/*
* TODO: this is an ugly workaround for wl12xx fw
* bug - we are not able to tx/rx after the first
* start_sta, so make dummy start+stop calls,
* and then call start_sta again.
* this should be fixed in the fw.
*/
wl12xx_cmd_role_start_sta(wl, wlvif);
wl12xx_cmd_role_stop_sta(wl, wlvif);
}
ret = wl12xx_cmd_role_start_sta(wl, wlvif); ret = wl12xx_cmd_role_start_sta(wl, wlvif);
}
return ret; return ret;
} }

View File

@@ -559,9 +559,6 @@ wlcore_set_min_fw_ver(struct wl1271 *wl, unsigned int chip,
/* Each RX/TX transaction requires an end-of-transaction transfer */ /* Each RX/TX transaction requires an end-of-transaction transfer */
#define WLCORE_QUIRK_END_OF_TRANSACTION BIT(0) #define WLCORE_QUIRK_END_OF_TRANSACTION BIT(0)
/* the first start_role(sta) sometimes doesn't work on wl12xx */
#define WLCORE_QUIRK_START_STA_FAILS BIT(1)
/* wl127x and SPI don't support SDIO block size alignment */ /* wl127x and SPI don't support SDIO block size alignment */
#define WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN BIT(2) #define WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN BIT(2)

View File

@@ -1326,11 +1326,21 @@ int xenvif_tx_action(struct xenvif_queue *queue, int budget)
return 0; return 0;
gnttab_batch_copy(queue->tx_copy_ops, nr_cops); gnttab_batch_copy(queue->tx_copy_ops, nr_cops);
if (nr_mops != 0) if (nr_mops != 0) {
ret = gnttab_map_refs(queue->tx_map_ops, ret = gnttab_map_refs(queue->tx_map_ops,
NULL, NULL,
queue->pages_to_map, queue->pages_to_map,
nr_mops); nr_mops);
if (ret) {
unsigned int i;
netdev_err(queue->vif->dev, "Map fail: nr %u ret %d\n",
nr_mops, ret);
for (i = 0; i < nr_mops; ++i)
WARN_ON_ONCE(queue->tx_map_ops[i].status ==
GNTST_okay);
}
}
work_done = xenvif_tx_submit(queue); work_done = xenvif_tx_submit(queue);

View File

@@ -3362,7 +3362,14 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
return 0; return 0;
pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap); pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap);
return (cap & PCI_REBAR_CAP_SIZES) >> 4; cap &= PCI_REBAR_CAP_SIZES;
/* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */
if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f &&
bar == 0 && cap == 0x7000)
cap = 0x3f000;
return cap >> 4;
} }
/** /**

View File

@@ -103,7 +103,7 @@ struct virtio_rev_info {
}; };
/* the highest virtio-ccw revision we support */ /* the highest virtio-ccw revision we support */
#define VIRTIO_CCW_REV_MAX 1 #define VIRTIO_CCW_REV_MAX 2
struct virtio_ccw_vq_info { struct virtio_ccw_vq_info {
struct virtqueue *vq; struct virtqueue *vq;
@@ -911,7 +911,7 @@ static u8 virtio_ccw_get_status(struct virtio_device *vdev)
u8 old_status = *vcdev->status; u8 old_status = *vcdev->status;
struct ccw1 *ccw; struct ccw1 *ccw;
if (vcdev->revision < 1) if (vcdev->revision < 2)
return *vcdev->status; return *vcdev->status;
ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL); ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);

View File

@@ -3368,125 +3368,125 @@ int iscsi_session_get_param(struct iscsi_cls_session *cls_session,
switch(param) { switch(param) {
case ISCSI_PARAM_FAST_ABORT: case ISCSI_PARAM_FAST_ABORT:
len = sprintf(buf, "%d\n", session->fast_abort); len = sysfs_emit(buf, "%d\n", session->fast_abort);
break; break;
case ISCSI_PARAM_ABORT_TMO: case ISCSI_PARAM_ABORT_TMO:
len = sprintf(buf, "%d\n", session->abort_timeout); len = sysfs_emit(buf, "%d\n", session->abort_timeout);
break; break;
case ISCSI_PARAM_LU_RESET_TMO: case ISCSI_PARAM_LU_RESET_TMO:
len = sprintf(buf, "%d\n", session->lu_reset_timeout); len = sysfs_emit(buf, "%d\n", session->lu_reset_timeout);
break; break;
case ISCSI_PARAM_TGT_RESET_TMO: case ISCSI_PARAM_TGT_RESET_TMO:
len = sprintf(buf, "%d\n", session->tgt_reset_timeout); len = sysfs_emit(buf, "%d\n", session->tgt_reset_timeout);
break; break;
case ISCSI_PARAM_INITIAL_R2T_EN: case ISCSI_PARAM_INITIAL_R2T_EN:
len = sprintf(buf, "%d\n", session->initial_r2t_en); len = sysfs_emit(buf, "%d\n", session->initial_r2t_en);
break; break;
case ISCSI_PARAM_MAX_R2T: case ISCSI_PARAM_MAX_R2T:
len = sprintf(buf, "%hu\n", session->max_r2t); len = sysfs_emit(buf, "%hu\n", session->max_r2t);
break; break;
case ISCSI_PARAM_IMM_DATA_EN: case ISCSI_PARAM_IMM_DATA_EN:
len = sprintf(buf, "%d\n", session->imm_data_en); len = sysfs_emit(buf, "%d\n", session->imm_data_en);
break; break;
case ISCSI_PARAM_FIRST_BURST: case ISCSI_PARAM_FIRST_BURST:
len = sprintf(buf, "%u\n", session->first_burst); len = sysfs_emit(buf, "%u\n", session->first_burst);
break; break;
case ISCSI_PARAM_MAX_BURST: case ISCSI_PARAM_MAX_BURST:
len = sprintf(buf, "%u\n", session->max_burst); len = sysfs_emit(buf, "%u\n", session->max_burst);
break; break;
case ISCSI_PARAM_PDU_INORDER_EN: case ISCSI_PARAM_PDU_INORDER_EN:
len = sprintf(buf, "%d\n", session->pdu_inorder_en); len = sysfs_emit(buf, "%d\n", session->pdu_inorder_en);
break; break;
case ISCSI_PARAM_DATASEQ_INORDER_EN: case ISCSI_PARAM_DATASEQ_INORDER_EN:
len = sprintf(buf, "%d\n", session->dataseq_inorder_en); len = sysfs_emit(buf, "%d\n", session->dataseq_inorder_en);
break; break;
case ISCSI_PARAM_DEF_TASKMGMT_TMO: case ISCSI_PARAM_DEF_TASKMGMT_TMO:
len = sprintf(buf, "%d\n", session->def_taskmgmt_tmo); len = sysfs_emit(buf, "%d\n", session->def_taskmgmt_tmo);
break; break;
case ISCSI_PARAM_ERL: case ISCSI_PARAM_ERL:
len = sprintf(buf, "%d\n", session->erl); len = sysfs_emit(buf, "%d\n", session->erl);
break; break;
case ISCSI_PARAM_TARGET_NAME: case ISCSI_PARAM_TARGET_NAME:
len = sprintf(buf, "%s\n", session->targetname); len = sysfs_emit(buf, "%s\n", session->targetname);
break; break;
case ISCSI_PARAM_TARGET_ALIAS: case ISCSI_PARAM_TARGET_ALIAS:
len = sprintf(buf, "%s\n", session->targetalias); len = sysfs_emit(buf, "%s\n", session->targetalias);
break; break;
case ISCSI_PARAM_TPGT: case ISCSI_PARAM_TPGT:
len = sprintf(buf, "%d\n", session->tpgt); len = sysfs_emit(buf, "%d\n", session->tpgt);
break; break;
case ISCSI_PARAM_USERNAME: case ISCSI_PARAM_USERNAME:
len = sprintf(buf, "%s\n", session->username); len = sysfs_emit(buf, "%s\n", session->username);
break; break;
case ISCSI_PARAM_USERNAME_IN: case ISCSI_PARAM_USERNAME_IN:
len = sprintf(buf, "%s\n", session->username_in); len = sysfs_emit(buf, "%s\n", session->username_in);
break; break;
case ISCSI_PARAM_PASSWORD: case ISCSI_PARAM_PASSWORD:
len = sprintf(buf, "%s\n", session->password); len = sysfs_emit(buf, "%s\n", session->password);
break; break;
case ISCSI_PARAM_PASSWORD_IN: case ISCSI_PARAM_PASSWORD_IN:
len = sprintf(buf, "%s\n", session->password_in); len = sysfs_emit(buf, "%s\n", session->password_in);
break; break;
case ISCSI_PARAM_IFACE_NAME: case ISCSI_PARAM_IFACE_NAME:
len = sprintf(buf, "%s\n", session->ifacename); len = sysfs_emit(buf, "%s\n", session->ifacename);
break; break;
case ISCSI_PARAM_INITIATOR_NAME: case ISCSI_PARAM_INITIATOR_NAME:
len = sprintf(buf, "%s\n", session->initiatorname); len = sysfs_emit(buf, "%s\n", session->initiatorname);
break; break;
case ISCSI_PARAM_BOOT_ROOT: case ISCSI_PARAM_BOOT_ROOT:
len = sprintf(buf, "%s\n", session->boot_root); len = sysfs_emit(buf, "%s\n", session->boot_root);
break; break;
case ISCSI_PARAM_BOOT_NIC: case ISCSI_PARAM_BOOT_NIC:
len = sprintf(buf, "%s\n", session->boot_nic); len = sysfs_emit(buf, "%s\n", session->boot_nic);
break; break;
case ISCSI_PARAM_BOOT_TARGET: case ISCSI_PARAM_BOOT_TARGET:
len = sprintf(buf, "%s\n", session->boot_target); len = sysfs_emit(buf, "%s\n", session->boot_target);
break; break;
case ISCSI_PARAM_AUTO_SND_TGT_DISABLE: case ISCSI_PARAM_AUTO_SND_TGT_DISABLE:
len = sprintf(buf, "%u\n", session->auto_snd_tgt_disable); len = sysfs_emit(buf, "%u\n", session->auto_snd_tgt_disable);
break; break;
case ISCSI_PARAM_DISCOVERY_SESS: case ISCSI_PARAM_DISCOVERY_SESS:
len = sprintf(buf, "%u\n", session->discovery_sess); len = sysfs_emit(buf, "%u\n", session->discovery_sess);
break; break;
case ISCSI_PARAM_PORTAL_TYPE: case ISCSI_PARAM_PORTAL_TYPE:
len = sprintf(buf, "%s\n", session->portal_type); len = sysfs_emit(buf, "%s\n", session->portal_type);
break; break;
case ISCSI_PARAM_CHAP_AUTH_EN: case ISCSI_PARAM_CHAP_AUTH_EN:
len = sprintf(buf, "%u\n", session->chap_auth_en); len = sysfs_emit(buf, "%u\n", session->chap_auth_en);
break; break;
case ISCSI_PARAM_DISCOVERY_LOGOUT_EN: case ISCSI_PARAM_DISCOVERY_LOGOUT_EN:
len = sprintf(buf, "%u\n", session->discovery_logout_en); len = sysfs_emit(buf, "%u\n", session->discovery_logout_en);
break; break;
case ISCSI_PARAM_BIDI_CHAP_EN: case ISCSI_PARAM_BIDI_CHAP_EN:
len = sprintf(buf, "%u\n", session->bidi_chap_en); len = sysfs_emit(buf, "%u\n", session->bidi_chap_en);
break; break;
case ISCSI_PARAM_DISCOVERY_AUTH_OPTIONAL: case ISCSI_PARAM_DISCOVERY_AUTH_OPTIONAL:
len = sprintf(buf, "%u\n", session->discovery_auth_optional); len = sysfs_emit(buf, "%u\n", session->discovery_auth_optional);
break; break;
case ISCSI_PARAM_DEF_TIME2WAIT: case ISCSI_PARAM_DEF_TIME2WAIT:
len = sprintf(buf, "%d\n", session->time2wait); len = sysfs_emit(buf, "%d\n", session->time2wait);
break; break;
case ISCSI_PARAM_DEF_TIME2RETAIN: case ISCSI_PARAM_DEF_TIME2RETAIN:
len = sprintf(buf, "%d\n", session->time2retain); len = sysfs_emit(buf, "%d\n", session->time2retain);
break; break;
case ISCSI_PARAM_TSID: case ISCSI_PARAM_TSID:
len = sprintf(buf, "%u\n", session->tsid); len = sysfs_emit(buf, "%u\n", session->tsid);
break; break;
case ISCSI_PARAM_ISID: case ISCSI_PARAM_ISID:
len = sprintf(buf, "%02x%02x%02x%02x%02x%02x\n", len = sysfs_emit(buf, "%02x%02x%02x%02x%02x%02x\n",
session->isid[0], session->isid[1], session->isid[0], session->isid[1],
session->isid[2], session->isid[3], session->isid[2], session->isid[3],
session->isid[4], session->isid[5]); session->isid[4], session->isid[5]);
break; break;
case ISCSI_PARAM_DISCOVERY_PARENT_IDX: case ISCSI_PARAM_DISCOVERY_PARENT_IDX:
len = sprintf(buf, "%u\n", session->discovery_parent_idx); len = sysfs_emit(buf, "%u\n", session->discovery_parent_idx);
break; break;
case ISCSI_PARAM_DISCOVERY_PARENT_TYPE: case ISCSI_PARAM_DISCOVERY_PARENT_TYPE:
if (session->discovery_parent_type) if (session->discovery_parent_type)
len = sprintf(buf, "%s\n", len = sysfs_emit(buf, "%s\n",
session->discovery_parent_type); session->discovery_parent_type);
else else
len = sprintf(buf, "\n"); len = sysfs_emit(buf, "\n");
break; break;
default: default:
return -ENOSYS; return -ENOSYS;
@@ -3518,16 +3518,16 @@ int iscsi_conn_get_addr_param(struct sockaddr_storage *addr,
case ISCSI_PARAM_CONN_ADDRESS: case ISCSI_PARAM_CONN_ADDRESS:
case ISCSI_HOST_PARAM_IPADDRESS: case ISCSI_HOST_PARAM_IPADDRESS:
if (sin) if (sin)
len = sprintf(buf, "%pI4\n", &sin->sin_addr.s_addr); len = sysfs_emit(buf, "%pI4\n", &sin->sin_addr.s_addr);
else else
len = sprintf(buf, "%pI6\n", &sin6->sin6_addr); len = sysfs_emit(buf, "%pI6\n", &sin6->sin6_addr);
break; break;
case ISCSI_PARAM_CONN_PORT: case ISCSI_PARAM_CONN_PORT:
case ISCSI_PARAM_LOCAL_PORT: case ISCSI_PARAM_LOCAL_PORT:
if (sin) if (sin)
len = sprintf(buf, "%hu\n", be16_to_cpu(sin->sin_port)); len = sysfs_emit(buf, "%hu\n", be16_to_cpu(sin->sin_port));
else else
len = sprintf(buf, "%hu\n", len = sysfs_emit(buf, "%hu\n",
be16_to_cpu(sin6->sin6_port)); be16_to_cpu(sin6->sin6_port));
break; break;
default: default:
@@ -3546,88 +3546,88 @@ int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
switch(param) { switch(param) {
case ISCSI_PARAM_PING_TMO: case ISCSI_PARAM_PING_TMO:
len = sprintf(buf, "%u\n", conn->ping_timeout); len = sysfs_emit(buf, "%u\n", conn->ping_timeout);
break; break;
case ISCSI_PARAM_RECV_TMO: case ISCSI_PARAM_RECV_TMO:
len = sprintf(buf, "%u\n", conn->recv_timeout); len = sysfs_emit(buf, "%u\n", conn->recv_timeout);
break; break;
case ISCSI_PARAM_MAX_RECV_DLENGTH: case ISCSI_PARAM_MAX_RECV_DLENGTH:
len = sprintf(buf, "%u\n", conn->max_recv_dlength); len = sysfs_emit(buf, "%u\n", conn->max_recv_dlength);
break; break;
case ISCSI_PARAM_MAX_XMIT_DLENGTH: case ISCSI_PARAM_MAX_XMIT_DLENGTH:
len = sprintf(buf, "%u\n", conn->max_xmit_dlength); len = sysfs_emit(buf, "%u\n", conn->max_xmit_dlength);
break; break;
case ISCSI_PARAM_HDRDGST_EN: case ISCSI_PARAM_HDRDGST_EN:
len = sprintf(buf, "%d\n", conn->hdrdgst_en); len = sysfs_emit(buf, "%d\n", conn->hdrdgst_en);
break; break;
case ISCSI_PARAM_DATADGST_EN: case ISCSI_PARAM_DATADGST_EN:
len = sprintf(buf, "%d\n", conn->datadgst_en); len = sysfs_emit(buf, "%d\n", conn->datadgst_en);
break; break;
case ISCSI_PARAM_IFMARKER_EN: case ISCSI_PARAM_IFMARKER_EN:
len = sprintf(buf, "%d\n", conn->ifmarker_en); len = sysfs_emit(buf, "%d\n", conn->ifmarker_en);
break; break;
case ISCSI_PARAM_OFMARKER_EN: case ISCSI_PARAM_OFMARKER_EN:
len = sprintf(buf, "%d\n", conn->ofmarker_en); len = sysfs_emit(buf, "%d\n", conn->ofmarker_en);
break; break;
case ISCSI_PARAM_EXP_STATSN: case ISCSI_PARAM_EXP_STATSN:
len = sprintf(buf, "%u\n", conn->exp_statsn); len = sysfs_emit(buf, "%u\n", conn->exp_statsn);
break; break;
case ISCSI_PARAM_PERSISTENT_PORT: case ISCSI_PARAM_PERSISTENT_PORT:
len = sprintf(buf, "%d\n", conn->persistent_port); len = sysfs_emit(buf, "%d\n", conn->persistent_port);
break; break;
case ISCSI_PARAM_PERSISTENT_ADDRESS: case ISCSI_PARAM_PERSISTENT_ADDRESS:
len = sprintf(buf, "%s\n", conn->persistent_address); len = sysfs_emit(buf, "%s\n", conn->persistent_address);
break; break;
case ISCSI_PARAM_STATSN: case ISCSI_PARAM_STATSN:
len = sprintf(buf, "%u\n", conn->statsn); len = sysfs_emit(buf, "%u\n", conn->statsn);
break; break;
case ISCSI_PARAM_MAX_SEGMENT_SIZE: case ISCSI_PARAM_MAX_SEGMENT_SIZE:
len = sprintf(buf, "%u\n", conn->max_segment_size); len = sysfs_emit(buf, "%u\n", conn->max_segment_size);
break; break;
case ISCSI_PARAM_KEEPALIVE_TMO: case ISCSI_PARAM_KEEPALIVE_TMO:
len = sprintf(buf, "%u\n", conn->keepalive_tmo); len = sysfs_emit(buf, "%u\n", conn->keepalive_tmo);
break; break;
case ISCSI_PARAM_LOCAL_PORT: case ISCSI_PARAM_LOCAL_PORT:
len = sprintf(buf, "%u\n", conn->local_port); len = sysfs_emit(buf, "%u\n", conn->local_port);
break; break;
case ISCSI_PARAM_TCP_TIMESTAMP_STAT: case ISCSI_PARAM_TCP_TIMESTAMP_STAT:
len = sprintf(buf, "%u\n", conn->tcp_timestamp_stat); len = sysfs_emit(buf, "%u\n", conn->tcp_timestamp_stat);
break; break;
case ISCSI_PARAM_TCP_NAGLE_DISABLE: case ISCSI_PARAM_TCP_NAGLE_DISABLE:
len = sprintf(buf, "%u\n", conn->tcp_nagle_disable); len = sysfs_emit(buf, "%u\n", conn->tcp_nagle_disable);
break; break;
case ISCSI_PARAM_TCP_WSF_DISABLE: case ISCSI_PARAM_TCP_WSF_DISABLE:
len = sprintf(buf, "%u\n", conn->tcp_wsf_disable); len = sysfs_emit(buf, "%u\n", conn->tcp_wsf_disable);
break; break;
case ISCSI_PARAM_TCP_TIMER_SCALE: case ISCSI_PARAM_TCP_TIMER_SCALE:
len = sprintf(buf, "%u\n", conn->tcp_timer_scale); len = sysfs_emit(buf, "%u\n", conn->tcp_timer_scale);
break; break;
case ISCSI_PARAM_TCP_TIMESTAMP_EN: case ISCSI_PARAM_TCP_TIMESTAMP_EN:
len = sprintf(buf, "%u\n", conn->tcp_timestamp_en); len = sysfs_emit(buf, "%u\n", conn->tcp_timestamp_en);
break; break;
case ISCSI_PARAM_IP_FRAGMENT_DISABLE: case ISCSI_PARAM_IP_FRAGMENT_DISABLE:
len = sprintf(buf, "%u\n", conn->fragment_disable); len = sysfs_emit(buf, "%u\n", conn->fragment_disable);
break; break;
case ISCSI_PARAM_IPV4_TOS: case ISCSI_PARAM_IPV4_TOS:
len = sprintf(buf, "%u\n", conn->ipv4_tos); len = sysfs_emit(buf, "%u\n", conn->ipv4_tos);
break; break;
case ISCSI_PARAM_IPV6_TC: case ISCSI_PARAM_IPV6_TC:
len = sprintf(buf, "%u\n", conn->ipv6_traffic_class); len = sysfs_emit(buf, "%u\n", conn->ipv6_traffic_class);
break; break;
case ISCSI_PARAM_IPV6_FLOW_LABEL: case ISCSI_PARAM_IPV6_FLOW_LABEL:
len = sprintf(buf, "%u\n", conn->ipv6_flow_label); len = sysfs_emit(buf, "%u\n", conn->ipv6_flow_label);
break; break;
case ISCSI_PARAM_IS_FW_ASSIGNED_IPV6: case ISCSI_PARAM_IS_FW_ASSIGNED_IPV6:
len = sprintf(buf, "%u\n", conn->is_fw_assigned_ipv6); len = sysfs_emit(buf, "%u\n", conn->is_fw_assigned_ipv6);
break; break;
case ISCSI_PARAM_TCP_XMIT_WSF: case ISCSI_PARAM_TCP_XMIT_WSF:
len = sprintf(buf, "%u\n", conn->tcp_xmit_wsf); len = sysfs_emit(buf, "%u\n", conn->tcp_xmit_wsf);
break; break;
case ISCSI_PARAM_TCP_RECV_WSF: case ISCSI_PARAM_TCP_RECV_WSF:
len = sprintf(buf, "%u\n", conn->tcp_recv_wsf); len = sysfs_emit(buf, "%u\n", conn->tcp_recv_wsf);
break; break;
case ISCSI_PARAM_LOCAL_IPADDR: case ISCSI_PARAM_LOCAL_IPADDR:
len = sprintf(buf, "%s\n", conn->local_ipaddr); len = sysfs_emit(buf, "%s\n", conn->local_ipaddr);
break; break;
default: default:
return -ENOSYS; return -ENOSYS;
@@ -3645,13 +3645,13 @@ int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param,
switch (param) { switch (param) {
case ISCSI_HOST_PARAM_NETDEV_NAME: case ISCSI_HOST_PARAM_NETDEV_NAME:
len = sprintf(buf, "%s\n", ihost->netdev); len = sysfs_emit(buf, "%s\n", ihost->netdev);
break; break;
case ISCSI_HOST_PARAM_HWADDRESS: case ISCSI_HOST_PARAM_HWADDRESS:
len = sprintf(buf, "%s\n", ihost->hwaddress); len = sysfs_emit(buf, "%s\n", ihost->hwaddress);
break; break;
case ISCSI_HOST_PARAM_INITIATOR_NAME: case ISCSI_HOST_PARAM_INITIATOR_NAME:
len = sprintf(buf, "%s\n", ihost->initiatorname); len = sysfs_emit(buf, "%s\n", ihost->initiatorname);
break; break;
default: default:
return -ENOSYS; return -ENOSYS;

View File

@@ -119,7 +119,11 @@ show_transport_handle(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iscsi_internal *priv = dev_to_iscsi_internal(dev); struct iscsi_internal *priv = dev_to_iscsi_internal(dev);
return sprintf(buf, "%llu\n", (unsigned long long)iscsi_handle(priv->iscsi_transport));
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
return sysfs_emit(buf, "%llu\n",
(unsigned long long)iscsi_handle(priv->iscsi_transport));
} }
static DEVICE_ATTR(handle, S_IRUGO, show_transport_handle, NULL); static DEVICE_ATTR(handle, S_IRUGO, show_transport_handle, NULL);
@@ -129,7 +133,7 @@ show_transport_##name(struct device *dev, \
struct device_attribute *attr,char *buf) \ struct device_attribute *attr,char *buf) \
{ \ { \
struct iscsi_internal *priv = dev_to_iscsi_internal(dev); \ struct iscsi_internal *priv = dev_to_iscsi_internal(dev); \
return sprintf(buf, format"\n", priv->iscsi_transport->name); \ return sysfs_emit(buf, format"\n", priv->iscsi_transport->name);\
} \ } \
static DEVICE_ATTR(name, S_IRUGO, show_transport_##name, NULL); static DEVICE_ATTR(name, S_IRUGO, show_transport_##name, NULL);
@@ -170,7 +174,7 @@ static ssize_t
show_ep_handle(struct device *dev, struct device_attribute *attr, char *buf) show_ep_handle(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev);
return sprintf(buf, "%llu\n", (unsigned long long) ep->id); return sysfs_emit(buf, "%llu\n", (unsigned long long) ep->id);
} }
static ISCSI_ATTR(ep, handle, S_IRUGO, show_ep_handle, NULL); static ISCSI_ATTR(ep, handle, S_IRUGO, show_ep_handle, NULL);
@@ -2763,6 +2767,9 @@ iscsi_set_param(struct iscsi_transport *transport, struct iscsi_uevent *ev)
struct iscsi_cls_session *session; struct iscsi_cls_session *session;
int err = 0, value = 0; int err = 0, value = 0;
if (ev->u.set_param.len > PAGE_SIZE)
return -EINVAL;
session = iscsi_session_lookup(ev->u.set_param.sid); session = iscsi_session_lookup(ev->u.set_param.sid);
conn = iscsi_conn_lookup(ev->u.set_param.sid, ev->u.set_param.cid); conn = iscsi_conn_lookup(ev->u.set_param.sid, ev->u.set_param.cid);
if (!conn || !session) if (!conn || !session)
@@ -2910,6 +2917,9 @@ iscsi_set_host_param(struct iscsi_transport *transport,
if (!transport->set_host_param) if (!transport->set_host_param)
return -ENOSYS; return -ENOSYS;
if (ev->u.set_host_param.len > PAGE_SIZE)
return -EINVAL;
shost = scsi_host_lookup(ev->u.set_host_param.host_no); shost = scsi_host_lookup(ev->u.set_host_param.host_no);
if (!shost) { if (!shost) {
printk(KERN_ERR "set_host_param could not find host no %u\n", printk(KERN_ERR "set_host_param could not find host no %u\n",
@@ -3497,6 +3507,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
{ {
int err = 0; int err = 0;
u32 portid; u32 portid;
u32 pdu_len;
struct iscsi_uevent *ev = nlmsg_data(nlh); struct iscsi_uevent *ev = nlmsg_data(nlh);
struct iscsi_transport *transport = NULL; struct iscsi_transport *transport = NULL;
struct iscsi_internal *priv; struct iscsi_internal *priv;
@@ -3504,6 +3515,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
struct iscsi_cls_conn *conn; struct iscsi_cls_conn *conn;
struct iscsi_endpoint *ep = NULL; struct iscsi_endpoint *ep = NULL;
if (!netlink_capable(skb, CAP_SYS_ADMIN))
return -EPERM;
if (nlh->nlmsg_type == ISCSI_UEVENT_PATH_UPDATE) if (nlh->nlmsg_type == ISCSI_UEVENT_PATH_UPDATE)
*group = ISCSI_NL_GRP_UIP; *group = ISCSI_NL_GRP_UIP;
else else
@@ -3611,6 +3625,14 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
err = -EINVAL; err = -EINVAL;
break; break;
case ISCSI_UEVENT_SEND_PDU: case ISCSI_UEVENT_SEND_PDU:
pdu_len = nlh->nlmsg_len - sizeof(*nlh) - sizeof(*ev);
if ((ev->u.send_pdu.hdr_size > pdu_len) ||
(ev->u.send_pdu.data_size > (pdu_len - ev->u.send_pdu.hdr_size))) {
err = -EINVAL;
break;
}
conn = iscsi_conn_lookup(ev->u.send_pdu.sid, ev->u.send_pdu.cid); conn = iscsi_conn_lookup(ev->u.send_pdu.sid, ev->u.send_pdu.cid);
if (conn) if (conn)
ev->r.retcode = transport->send_pdu(conn, ev->r.retcode = transport->send_pdu(conn,
@@ -4017,7 +4039,7 @@ show_priv_session_state(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent); struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent);
return sprintf(buf, "%s\n", iscsi_session_state_name(session->state)); return sysfs_emit(buf, "%s\n", iscsi_session_state_name(session->state));
} }
static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state,
NULL); NULL);
@@ -4026,7 +4048,7 @@ show_priv_session_creator(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent); struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent);
return sprintf(buf, "%d\n", session->creator); return sysfs_emit(buf, "%d\n", session->creator);
} }
static ISCSI_CLASS_ATTR(priv_sess, creator, S_IRUGO, show_priv_session_creator, static ISCSI_CLASS_ATTR(priv_sess, creator, S_IRUGO, show_priv_session_creator,
NULL); NULL);
@@ -4035,7 +4057,7 @@ show_priv_session_target_id(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent); struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent);
return sprintf(buf, "%d\n", session->target_id); return sysfs_emit(buf, "%d\n", session->target_id);
} }
static ISCSI_CLASS_ATTR(priv_sess, target_id, S_IRUGO, static ISCSI_CLASS_ATTR(priv_sess, target_id, S_IRUGO,
show_priv_session_target_id, NULL); show_priv_session_target_id, NULL);
@@ -4048,8 +4070,8 @@ show_priv_session_##field(struct device *dev, \
struct iscsi_cls_session *session = \ struct iscsi_cls_session *session = \
iscsi_dev_to_session(dev->parent); \ iscsi_dev_to_session(dev->parent); \
if (session->field == -1) \ if (session->field == -1) \
return sprintf(buf, "off\n"); \ return sysfs_emit(buf, "off\n"); \
return sprintf(buf, format"\n", session->field); \ return sysfs_emit(buf, format"\n", session->field); \
} }
#define iscsi_priv_session_attr_store(field) \ #define iscsi_priv_session_attr_store(field) \

View File

@@ -2219,6 +2219,7 @@ static int fwserial_create(struct fw_unit *unit)
err = fw_core_add_address_handler(&port->rx_handler, err = fw_core_add_address_handler(&port->rx_handler,
&fw_high_memory_region); &fw_high_memory_region);
if (err) { if (err) {
tty_port_destroy(&port->port);
kfree(port); kfree(port);
goto free_ports; goto free_ports;
} }
@@ -2301,6 +2302,7 @@ static int fwserial_create(struct fw_unit *unit)
free_ports: free_ports:
for (--i; i >= 0; --i) { for (--i; i >= 0; --i) {
fw_core_remove_address_handler(&serial->ports[i]->rx_handler);
tty_port_destroy(&serial->ports[i]->port); tty_port_destroy(&serial->ports[i]->port);
kfree(serial->ports[i]); kfree(serial->ports[i]);
} }

View File

@@ -86,6 +86,8 @@ static void swap_copy24(u8 *dest, const u8 *source, unsigned int bytes)
{ {
unsigned int i = 0; unsigned int i = 0;
if (bytes < 2)
return;
while (i < bytes - 2) { while (i < bytes - 2) {
dest[i] = source[i + 2]; dest[i] = source[i + 2];
dest[i + 1] = source[i + 1]; dest[i + 1] = source[i + 1];

View File

@@ -495,7 +495,7 @@ con_insert_unipair(struct uni_pagedir *p, u_short unicode, u_short fontpos)
p2[unicode & 0x3f] = fontpos; p2[unicode & 0x3f] = fontpos;
p->sum += (fontpos << 20) + unicode; p->sum += (fontpos << 20U) + unicode;
return 0; return 0;
} }

View File

@@ -1020,6 +1020,7 @@ static void dlfb_ops_destroy(struct fb_info *info)
} }
vfree(dlfb->backing_buffer); vfree(dlfb->backing_buffer);
kfree(dlfb->edid); kfree(dlfb->edid);
dlfb_free_urb_list(dlfb);
usb_put_dev(dlfb->udev); usb_put_dev(dlfb->udev);
kfree(dlfb); kfree(dlfb);

View File

@@ -1249,7 +1249,6 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans)
struct btrfs_root *gang[8]; struct btrfs_root *gang[8];
int i; int i;
int ret; int ret;
int err = 0;
spin_lock(&fs_info->fs_roots_radix_lock); spin_lock(&fs_info->fs_roots_radix_lock);
while (1) { while (1) {
@@ -1261,6 +1260,8 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans)
break; break;
for (i = 0; i < ret; i++) { for (i = 0; i < ret; i++) {
struct btrfs_root *root = gang[i]; struct btrfs_root *root = gang[i];
int ret2;
radix_tree_tag_clear(&fs_info->fs_roots_radix, radix_tree_tag_clear(&fs_info->fs_roots_radix,
(unsigned long)root->root_key.objectid, (unsigned long)root->root_key.objectid,
BTRFS_ROOT_TRANS_TAG); BTRFS_ROOT_TRANS_TAG);
@@ -1282,17 +1283,17 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans)
root->node); root->node);
} }
err = btrfs_update_root(trans, fs_info->tree_root, ret2 = btrfs_update_root(trans, fs_info->tree_root,
&root->root_key, &root->root_key,
&root->root_item); &root->root_item);
if (ret2)
return ret2;
spin_lock(&fs_info->fs_roots_radix_lock); spin_lock(&fs_info->fs_roots_radix_lock);
if (err)
break;
btrfs_qgroup_free_meta_all_pertrans(root); btrfs_qgroup_free_meta_all_pertrans(root);
} }
} }
spin_unlock(&fs_info->fs_roots_radix_lock); spin_unlock(&fs_info->fs_roots_radix_lock);
return err; return 0;
} }
/* /*

View File

@@ -848,7 +848,11 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry,
if (whiteout) { if (whiteout) {
f2fs_i_links_write(inode, false); f2fs_i_links_write(inode, false);
spin_lock(&inode->i_lock);
inode->i_state |= I_LINKABLE; inode->i_state |= I_LINKABLE;
spin_unlock(&inode->i_lock);
*whiteout = inode; *whiteout = inode;
} else { } else {
d_tmpfile(dentry, inode); d_tmpfile(dentry, inode);
@@ -1034,7 +1038,11 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
err = f2fs_add_link(old_dentry, whiteout); err = f2fs_add_link(old_dentry, whiteout);
if (err) if (err)
goto put_out_dir; goto put_out_dir;
spin_lock(&whiteout->i_lock);
whiteout->i_state &= ~I_LINKABLE; whiteout->i_state &= ~I_LINKABLE;
spin_unlock(&whiteout->i_lock);
iput(whiteout); iput(whiteout);
} }

View File

@@ -88,11 +88,11 @@
#define BLKS_PER_SEC(sbi) \ #define BLKS_PER_SEC(sbi) \
((sbi)->segs_per_sec * (sbi)->blocks_per_seg) ((sbi)->segs_per_sec * (sbi)->blocks_per_seg)
#define GET_SEC_FROM_SEG(sbi, segno) \ #define GET_SEC_FROM_SEG(sbi, segno) \
((segno) / (sbi)->segs_per_sec) (((segno) == -1) ? -1: (segno) / (sbi)->segs_per_sec)
#define GET_SEG_FROM_SEC(sbi, secno) \ #define GET_SEG_FROM_SEC(sbi, secno) \
((secno) * (sbi)->segs_per_sec) ((secno) * (sbi)->segs_per_sec)
#define GET_ZONE_FROM_SEC(sbi, secno) \ #define GET_ZONE_FROM_SEC(sbi, secno) \
((secno) / (sbi)->secs_per_zone) (((secno) == -1) ? -1: (secno) / (sbi)->secs_per_zone)
#define GET_ZONE_FROM_SEG(sbi, segno) \ #define GET_ZONE_FROM_SEG(sbi, segno) \
GET_ZONE_FROM_SEC(sbi, GET_SEC_FROM_SEG(sbi, segno)) GET_ZONE_FROM_SEC(sbi, GET_SEC_FROM_SEG(sbi, segno))

View File

@@ -281,5 +281,6 @@
* fsck() must be run to repair * fsck() must be run to repair
*/ */
#define FM_EXTENDFS 0x00000008 /* file system extendfs() in progress */ #define FM_EXTENDFS 0x00000008 /* file system extendfs() in progress */
#define FM_STATE_MAX 0x0000000f /* max value of s_state */
#endif /* _H_JFS_FILSYS */ #endif /* _H_JFS_FILSYS */

View File

@@ -49,6 +49,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/log2.h>
#include "jfs_incore.h" #include "jfs_incore.h"
#include "jfs_filsys.h" #include "jfs_filsys.h"
@@ -378,6 +379,15 @@ static int chkSuper(struct super_block *sb)
sbi->bsize = bsize; sbi->bsize = bsize;
sbi->l2bsize = le16_to_cpu(j_sb->s_l2bsize); sbi->l2bsize = le16_to_cpu(j_sb->s_l2bsize);
/* check some fields for possible corruption */
if (sbi->l2bsize != ilog2((u32)bsize) ||
j_sb->pad != 0 ||
le32_to_cpu(j_sb->s_state) > FM_STATE_MAX) {
rc = -EINVAL;
jfs_err("jfs_mount: Mount Failure: superblock is corrupt!");
goto out;
}
/* /*
* For now, ignore s_pbsize, l2bfactor. All I/O going through buffer * For now, ignore s_pbsize, l2bfactor. All I/O going through buffer
* cache. * cache.

View File

@@ -15,6 +15,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/mm.h>
#include "sysfs.h" #include "sysfs.h"
#include "../kernfs/kernfs-internal.h" #include "../kernfs/kernfs-internal.h"
@@ -556,3 +557,57 @@ void sysfs_remove_bin_file(struct kobject *kobj,
kernfs_remove_by_name(kobj->sd, attr->attr.name); kernfs_remove_by_name(kobj->sd, attr->attr.name);
} }
EXPORT_SYMBOL_GPL(sysfs_remove_bin_file); EXPORT_SYMBOL_GPL(sysfs_remove_bin_file);
/**
* sysfs_emit - scnprintf equivalent, aware of PAGE_SIZE buffer.
* @buf: start of PAGE_SIZE buffer.
* @fmt: format
* @...: optional arguments to @format
*
*
* Returns number of characters written to @buf.
*/
int sysfs_emit(char *buf, const char *fmt, ...)
{
va_list args;
int len;
if (WARN(!buf || offset_in_page(buf),
"invalid sysfs_emit: buf:%p\n", buf))
return 0;
va_start(args, fmt);
len = vscnprintf(buf, PAGE_SIZE, fmt, args);
va_end(args);
return len;
}
EXPORT_SYMBOL_GPL(sysfs_emit);
/**
* sysfs_emit_at - scnprintf equivalent, aware of PAGE_SIZE buffer.
* @buf: start of PAGE_SIZE buffer.
* @at: offset in @buf to start write in bytes
* @at must be >= 0 && < PAGE_SIZE
* @fmt: format
* @...: optional arguments to @fmt
*
*
* Returns number of characters written starting at &@buf[@at].
*/
int sysfs_emit_at(char *buf, int at, const char *fmt, ...)
{
va_list args;
int len;
if (WARN(!buf || offset_in_page(buf) || at < 0 || at >= PAGE_SIZE,
"invalid sysfs_emit_at: buf:%p at:%d\n", buf, at))
return 0;
va_start(args, fmt);
len = vscnprintf(buf + at, PAGE_SIZE - at, fmt, args);
va_end(args);
return len;
}
EXPORT_SYMBOL_GPL(sysfs_emit_at);

View File

@@ -849,7 +849,7 @@ xfs_setattr_size(
ASSERT(xfs_isilocked(ip, XFS_MMAPLOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_MMAPLOCK_EXCL));
ASSERT(S_ISREG(inode->i_mode)); ASSERT(S_ISREG(inode->i_mode));
ASSERT((iattr->ia_valid & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET| ASSERT((iattr->ia_valid & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET|
ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0); ATTR_MTIME_SET|ATTR_TIMES_SET)) == 0);
oldsize = inode->i_size; oldsize = inode->i_size;
newsize = iattr->ia_size; newsize = iattr->ia_size;

View File

@@ -299,6 +299,11 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn)
return kernfs_enable_ns(kn); return kernfs_enable_ns(kn);
} }
__printf(2, 3)
int sysfs_emit(char *buf, const char *fmt, ...);
__printf(3, 4)
int sysfs_emit_at(char *buf, int at, const char *fmt, ...);
#else /* CONFIG_SYSFS */ #else /* CONFIG_SYSFS */
static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
@@ -505,6 +510,17 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn)
{ {
} }
__printf(2, 3)
static inline int sysfs_emit(char *buf, const char *fmt, ...)
{
return 0;
}
__printf(3, 4)
static inline int sysfs_emit_at(char *buf, int at, const char *fmt, ...)
{
return 0;
}
#endif /* CONFIG_SYSFS */ #endif /* CONFIG_SYSFS */
static inline int __must_check sysfs_create_file(struct kobject *kobj, static inline int __must_check sysfs_create_file(struct kobject *kobj,

View File

@@ -36,7 +36,7 @@ enum zs_mapmode {
struct zs_pool_stats { struct zs_pool_stats {
/* How many pages were migrated (freed) */ /* How many pages were migrated (freed) */
unsigned long pages_compacted; atomic_long_t pages_compacted;
}; };
struct zs_pool; struct zs_pool;

View File

@@ -1171,14 +1171,16 @@ static inline void destroy_compound_gigantic_page(struct page *page,
static void update_and_free_page(struct hstate *h, struct page *page) static void update_and_free_page(struct hstate *h, struct page *page)
{ {
int i; int i;
struct page *subpage = page;
if (hstate_is_gigantic(h) && !gigantic_page_supported()) if (hstate_is_gigantic(h) && !gigantic_page_supported())
return; return;
h->nr_huge_pages--; h->nr_huge_pages--;
h->nr_huge_pages_node[page_to_nid(page)]--; h->nr_huge_pages_node[page_to_nid(page)]--;
for (i = 0; i < pages_per_huge_page(h); i++) { for (i = 0; i < pages_per_huge_page(h);
page[i].flags &= ~(1 << PG_locked | 1 << PG_error | i++, subpage = mem_map_next(subpage, page, i)) {
subpage->flags &= ~(1 << PG_locked | 1 << PG_error |
1 << PG_referenced | 1 << PG_dirty | 1 << PG_referenced | 1 << PG_dirty |
1 << PG_active | 1 << PG_private | 1 << PG_active | 1 << PG_private |
1 << PG_writeback); 1 << PG_writeback);
@@ -4704,21 +4706,23 @@ static bool vma_shareable(struct vm_area_struct *vma, unsigned long addr)
void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma, void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
unsigned long *start, unsigned long *end) unsigned long *start, unsigned long *end)
{ {
unsigned long a_start, a_end; unsigned long v_start = ALIGN(vma->vm_start, PUD_SIZE),
v_end = ALIGN_DOWN(vma->vm_end, PUD_SIZE);
if (!(vma->vm_flags & VM_MAYSHARE)) /*
* vma need span at least one aligned PUD size and the start,end range
* must at least partialy within it.
*/
if (!(vma->vm_flags & VM_MAYSHARE) || !(v_end > v_start) ||
(*end <= v_start) || (*start >= v_end))
return; return;
/* Extend the range to be PUD aligned for a worst case scenario */ /* Extend the range to be PUD aligned for a worst case scenario */
a_start = ALIGN_DOWN(*start, PUD_SIZE); if (*start > v_start)
a_end = ALIGN(*end, PUD_SIZE); *start = ALIGN_DOWN(*start, PUD_SIZE);
/* if (*end < v_end)
* Intersect the range with the vma range, since pmd sharing won't be *end = ALIGN(*end, PUD_SIZE);
* across vma after all
*/
*start = max(vma->vm_start, a_start);
*end = min(vma->vm_end, a_end);
} }
/* /*

View File

@@ -39,7 +39,6 @@ static struct bio *get_swap_bio(gfp_t gfp_flags,
bio->bi_iter.bi_sector = map_swap_page(page, &bdev); bio->bi_iter.bi_sector = map_swap_page(page, &bdev);
bio_set_dev(bio, bdev); bio_set_dev(bio, bdev);
bio->bi_iter.bi_sector <<= PAGE_SHIFT - 9;
bio->bi_end_io = end_io; bio->bi_end_io = end_io;
for (i = 0; i < nr; i++) for (i = 0; i < nr; i++)
@@ -263,11 +262,6 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
return ret; return ret;
} }
static sector_t swap_page_sector(struct page *page)
{
return (sector_t)__page_file_index(page) << (PAGE_SHIFT - 9);
}
static inline void count_swpout_vm_event(struct page *page) static inline void count_swpout_vm_event(struct page *page)
{ {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE #ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -326,7 +320,8 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
return ret; return ret;
} }
ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc); ret = bdev_write_page(sis->bdev, map_swap_page(page, &sis->bdev),
page, wbc);
if (!ret) { if (!ret) {
count_swpout_vm_event(page); count_swpout_vm_event(page);
return 0; return 0;
@@ -386,7 +381,7 @@ int swap_readpage(struct page *page, bool synchronous)
goto out; goto out;
} }
ret = bdev_read_page(sis->bdev, swap_page_sector(page), page); ret = bdev_read_page(sis->bdev, map_swap_page(page, &sis->bdev), page);
if (!ret) { if (!ret) {
if (trylock_page(page)) { if (trylock_page(page)) {
swap_slot_free_notify(page); swap_slot_free_notify(page);

View File

@@ -2305,7 +2305,7 @@ sector_t map_swap_page(struct page *page, struct block_device **bdev)
{ {
swp_entry_t entry; swp_entry_t entry;
entry.val = page_private(page); entry.val = page_private(page);
return map_swap_entry(entry, bdev); return map_swap_entry(entry, bdev) << (PAGE_SHIFT - 9);
} }
/* /*

View File

@@ -2285,11 +2285,13 @@ static unsigned long zs_can_compact(struct size_class *class)
return obj_wasted * class->pages_per_zspage; return obj_wasted * class->pages_per_zspage;
} }
static void __zs_compact(struct zs_pool *pool, struct size_class *class) static unsigned long __zs_compact(struct zs_pool *pool,
struct size_class *class)
{ {
struct zs_compact_control cc; struct zs_compact_control cc;
struct zspage *src_zspage; struct zspage *src_zspage;
struct zspage *dst_zspage = NULL; struct zspage *dst_zspage = NULL;
unsigned long pages_freed = 0;
spin_lock(&class->lock); spin_lock(&class->lock);
while ((src_zspage = isolate_zspage(class, true))) { while ((src_zspage = isolate_zspage(class, true))) {
@@ -2319,7 +2321,7 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)
putback_zspage(class, dst_zspage); putback_zspage(class, dst_zspage);
if (putback_zspage(class, src_zspage) == ZS_EMPTY) { if (putback_zspage(class, src_zspage) == ZS_EMPTY) {
free_zspage(pool, class, src_zspage); free_zspage(pool, class, src_zspage);
pool->stats.pages_compacted += class->pages_per_zspage; pages_freed += class->pages_per_zspage;
} }
spin_unlock(&class->lock); spin_unlock(&class->lock);
cond_resched(); cond_resched();
@@ -2330,12 +2332,15 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)
putback_zspage(class, src_zspage); putback_zspage(class, src_zspage);
spin_unlock(&class->lock); spin_unlock(&class->lock);
return pages_freed;
} }
unsigned long zs_compact(struct zs_pool *pool) unsigned long zs_compact(struct zs_pool *pool)
{ {
int i; int i;
struct size_class *class; struct size_class *class;
unsigned long pages_freed = 0;
for (i = ZS_SIZE_CLASSES - 1; i >= 0; i--) { for (i = ZS_SIZE_CLASSES - 1; i >= 0; i--) {
class = pool->size_class[i]; class = pool->size_class[i];
@@ -2343,10 +2348,11 @@ unsigned long zs_compact(struct zs_pool *pool)
continue; continue;
if (class->index != i) if (class->index != i)
continue; continue;
__zs_compact(pool, class); pages_freed += __zs_compact(pool, class);
} }
atomic_long_add(pages_freed, &pool->stats.pages_compacted);
return pool->stats.pages_compacted; return pages_freed;
} }
EXPORT_SYMBOL_GPL(zs_compact); EXPORT_SYMBOL_GPL(zs_compact);
@@ -2363,13 +2369,12 @@ static unsigned long zs_shrinker_scan(struct shrinker *shrinker,
struct zs_pool *pool = container_of(shrinker, struct zs_pool, struct zs_pool *pool = container_of(shrinker, struct zs_pool,
shrinker); shrinker);
pages_freed = pool->stats.pages_compacted;
/* /*
* Compact classes and calculate compaction delta. * Compact classes and calculate compaction delta.
* Can run concurrently with a manually triggered * Can run concurrently with a manually triggered
* (by user) compaction. * (by user) compaction.
*/ */
pages_freed = zs_compact(pool) - pages_freed; pages_freed = zs_compact(pool);
return pages_freed ? pages_freed : SHRINK_STOP; return pages_freed ? pages_freed : SHRINK_STOP;
} }

View File

@@ -305,6 +305,9 @@ void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
struct hci_request req; struct hci_request req;
int err; int err;
if (!mgr)
return;
cp.phy_handle = hcon->handle; cp.phy_handle = hcon->handle;
cp.len_so_far = cpu_to_le16(0); cp.len_so_far = cpu_to_le16(0);
cp.max_len = cpu_to_le16(hdev->amp_assoc_size); cp.max_len = cpu_to_le16(hdev->amp_assoc_size);

View File

@@ -59,9 +59,8 @@ static BRPORT_ATTR(_name, 0644, \
static int store_flag(struct net_bridge_port *p, unsigned long v, static int store_flag(struct net_bridge_port *p, unsigned long v,
unsigned long mask) unsigned long mask)
{ {
unsigned long flags; unsigned long flags = p->flags;
int err;
flags = p->flags;
if (v) if (v)
flags |= mask; flags |= mask;
@@ -69,6 +68,10 @@ static int store_flag(struct net_bridge_port *p, unsigned long v,
flags &= ~mask; flags &= ~mask;
if (flags != p->flags) { if (flags != p->flags) {
err = br_switchdev_set_port_flag(p, flags, mask);
if (err)
return err;
p->flags = flags; p->flags = flags;
br_port_flags_change(p, mask); br_port_flags_change(p, mask);
} }

View File

@@ -3471,7 +3471,7 @@ static int pktgen_thread_worker(void *arg)
struct pktgen_dev *pkt_dev = NULL; struct pktgen_dev *pkt_dev = NULL;
int cpu = t->cpu; int cpu = t->cpu;
BUG_ON(smp_processor_id() != cpu); WARN_ON(smp_processor_id() != cpu);
init_waitqueue_head(&t->queue); init_waitqueue_head(&t->queue);
complete(&t->start_done); complete(&t->start_done);

View File

@@ -3092,7 +3092,19 @@ EXPORT_SYMBOL(skb_split);
*/ */
static int skb_prepare_for_shift(struct sk_buff *skb) static int skb_prepare_for_shift(struct sk_buff *skb)
{ {
return skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC); int ret = 0;
if (skb_cloned(skb)) {
/* Save and restore truesize: pskb_expand_head() may reallocate
* memory where ksize(kmalloc(S)) != ksize(kmalloc(S)), but we
* cannot change truesize at this point.
*/
unsigned int save_truesize = skb->truesize;
ret = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
skb->truesize = save_truesize;
}
return ret;
} }
/** /**

View File

@@ -1191,7 +1191,7 @@ static ssize_t smk_write_net4addr(struct file *file, const char __user *buf,
return -EPERM; return -EPERM;
if (*ppos != 0) if (*ppos != 0)
return -EINVAL; return -EINVAL;
if (count < SMK_NETLBLADDRMIN) if (count < SMK_NETLBLADDRMIN || count > PAGE_SIZE - 1)
return -EINVAL; return -EINVAL;
data = memdup_user_nul(buf, count); data = memdup_user_nul(buf, count);
@@ -1451,7 +1451,7 @@ static ssize_t smk_write_net6addr(struct file *file, const char __user *buf,
return -EPERM; return -EPERM;
if (*ppos != 0) if (*ppos != 0)
return -EINVAL; return -EINVAL;
if (count < SMK_NETLBLADDRMIN) if (count < SMK_NETLBLADDRMIN || count > PAGE_SIZE - 1)
return -EINVAL; return -EINVAL;
data = memdup_user_nul(buf, count); data = memdup_user_nul(buf, count);
@@ -1858,6 +1858,10 @@ static ssize_t smk_write_ambient(struct file *file, const char __user *buf,
if (!smack_privileged(CAP_MAC_ADMIN)) if (!smack_privileged(CAP_MAC_ADMIN))
return -EPERM; return -EPERM;
/* Enough data must be present */
if (count == 0 || count > PAGE_SIZE)
return -EINVAL;
data = memdup_user_nul(buf, count); data = memdup_user_nul(buf, count);
if (IS_ERR(data)) if (IS_ERR(data))
return PTR_ERR(data); return PTR_ERR(data);
@@ -2029,6 +2033,9 @@ static ssize_t smk_write_onlycap(struct file *file, const char __user *buf,
if (!smack_privileged(CAP_MAC_ADMIN)) if (!smack_privileged(CAP_MAC_ADMIN))
return -EPERM; return -EPERM;
if (count > PAGE_SIZE)
return -EINVAL;
data = memdup_user_nul(buf, count); data = memdup_user_nul(buf, count);
if (IS_ERR(data)) if (IS_ERR(data))
return PTR_ERR(data); return PTR_ERR(data);
@@ -2116,6 +2123,9 @@ static ssize_t smk_write_unconfined(struct file *file, const char __user *buf,
if (!smack_privileged(CAP_MAC_ADMIN)) if (!smack_privileged(CAP_MAC_ADMIN))
return -EPERM; return -EPERM;
if (count > PAGE_SIZE)
return -EINVAL;
data = memdup_user_nul(buf, count); data = memdup_user_nul(buf, count);
if (IS_ERR(data)) if (IS_ERR(data))
return PTR_ERR(data); return PTR_ERR(data);
@@ -2669,6 +2679,10 @@ static ssize_t smk_write_syslog(struct file *file, const char __user *buf,
if (!smack_privileged(CAP_MAC_ADMIN)) if (!smack_privileged(CAP_MAC_ADMIN))
return -EPERM; return -EPERM;
/* Enough data must be present */
if (count == 0 || count > PAGE_SIZE)
return -EINVAL;
data = memdup_user_nul(buf, count); data = memdup_user_nul(buf, count);
if (IS_ERR(data)) if (IS_ERR(data))
return PTR_ERR(data); return PTR_ERR(data);
@@ -2761,10 +2775,13 @@ static ssize_t smk_write_relabel_self(struct file *file, const char __user *buf,
return -EPERM; return -EPERM;
/* /*
* No partial write.
* Enough data must be present. * Enough data must be present.
*/ */
if (*ppos != 0) if (*ppos != 0)
return -EINVAL; return -EINVAL;
if (count == 0 || count > PAGE_SIZE)
return -EINVAL;
data = memdup_user_nul(buf, count); data = memdup_user_nul(buf, count);
if (IS_ERR(data)) if (IS_ERR(data))

View File

@@ -2507,6 +2507,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950), SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950), SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
@@ -7179,6 +7180,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),

View File

@@ -409,6 +409,19 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
BYT_RT5640_SSP0_AIF1 | BYT_RT5640_SSP0_AIF1 |
BYT_RT5640_MCLK_EN), BYT_RT5640_MCLK_EN),
}, },
{ /* Acer One 10 S1002 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "One S1002"),
},
.driver_data = (void *)(BYT_RT5640_IN1_MAP |
BYT_RT5640_JD_SRC_JD2_IN4N |
BYT_RT5640_OVCD_TH_2000UA |
BYT_RT5640_OVCD_SF_0P75 |
BYT_RT5640_DIFF_MIC |
BYT_RT5640_SSP0_AIF2 |
BYT_RT5640_MCLK_EN),
},
{ {
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"), DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
@@ -510,6 +523,16 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
BYT_RT5640_MONO_SPEAKER | BYT_RT5640_MONO_SPEAKER |
BYT_RT5640_MCLK_EN), BYT_RT5640_MCLK_EN),
}, },
{ /* Estar Beauty HD MID 7316R */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Estar"),
DMI_MATCH(DMI_PRODUCT_NAME, "eSTAR BEAUTY HD Intel Quad core"),
},
.driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
BYT_RT5640_MONO_SPEAKER |
BYT_RT5640_SSP0_AIF1 |
BYT_RT5640_MCLK_EN),
},
{ {
.matches = { .matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
@@ -746,6 +769,20 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
BYT_RT5640_SSP0_AIF2 | BYT_RT5640_SSP0_AIF2 |
BYT_RT5640_MCLK_EN), BYT_RT5640_MCLK_EN),
}, },
{ /* Voyo Winpad A15 */
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
/* Above strings are too generic, also match on BIOS date */
DMI_MATCH(DMI_BIOS_DATE, "11/20/2014"),
},
.driver_data = (void *)(BYT_RT5640_IN1_MAP |
BYT_RT5640_JD_SRC_JD2_IN4N |
BYT_RT5640_OVCD_TH_2000UA |
BYT_RT5640_OVCD_SF_0P75 |
BYT_RT5640_DIFF_MIC |
BYT_RT5640_MCLK_EN),
},
{ /* Catch-all for generic Insyde tablets, must be last */ { /* Catch-all for generic Insyde tablets, must be last */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),