Re: 3.19: Sony playstation controller causes kernel oops

From: David Herrmann
Date: Mon Feb 23 2015 - 06:57:39 EST


Hi Jiri

On Sun, Feb 22, 2015 at 10:50 PM, Jiri Kosina <jkosina@xxxxxxx> wrote:
> [ some CCs added and full dmesg kept for reference ]
>
> On Sun, 22 Feb 2015, Pavel Machek wrote:
>
>> Hi!
>>
>> I plugged in part of PS move to the PC, to let it charge. Got: full
>> dmesg in attachment. I believe I charged it in PC before, but it may
>> be year ago or more.
>>
>> Ideas?
>
> Ok, this is embarassing. I guess the patch below fixes it, right? (the
> spinlock got introduced in d2d782fccee, so I guess you didn't have it a
> year ago)
>
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index 31e9d25..3756a62 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -2140,6 +2140,7 @@ static int __init sony_init(void)
> {
> dbg_hid("Sony:%s\n", __func__);
>
> + spin_lock_init(&sony_dev_list_lock);
> return hid_register_driver(&sony_driver);
> }

Nice catch. I'd prefer the patch below, though. For both:
Reviewed-by: David Herrmann <dh.herrmann@xxxxxxxxx>

The bug is non-critical (global memory, so initialized to 0 which is
fine for spinlocks). It only spits out warnings if you enable
lock-debugging. We might mark it for stable 3.14+.

Thanks
David


diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 31e9d25..5d3e40a 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -804,7 +804,7 @@ union sixaxis_output_report_01 {
#define DS4_REPORT_0x81_SIZE 7
#define SIXAXIS_REPORT_0xF2_SIZE 18

-static spinlock_t sony_dev_list_lock;
+static DEFINE_SPINLOCK(sony_dev_list_lock);
static LIST_HEAD(sony_device_list);
static DEFINE_IDA(sony_device_id_allocator);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/