Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fix from Guenter Roeck:
"Fix potential crash condition in applesmc driver"

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (applesmc) Check key count before proceeding

+10 -1
+10 -1
drivers/hwmon/applesmc.c
··· 525 525 { 526 526 struct applesmc_registers *s = &smcreg; 527 527 bool left_light_sensor, right_light_sensor; 528 + unsigned int count; 528 529 u8 tmp[1]; 529 530 int ret; 530 531 531 532 if (s->init_complete) 532 533 return 0; 533 534 534 - ret = read_register_count(&s->key_count); 535 + ret = read_register_count(&count); 535 536 if (ret) 536 537 return ret; 538 + 539 + if (s->cache && s->key_count != count) { 540 + pr_warn("key count changed from %d to %d\n", 541 + s->key_count, count); 542 + kfree(s->cache); 543 + s->cache = NULL; 544 + } 545 + s->key_count = count; 537 546 538 547 if (!s->cache) 539 548 s->cache = kcalloc(s->key_count, sizeof(*s->cache), GFP_KERNEL);