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

[PATCH] MPBL0010 driver sysfs permissions wide open

The MPBL0010 Telco clock driver (drivers/char/tlclk.c) uses 0222 (anyone
can write) permissions on its writable sysfs entries. Alter the
permissions to 0220 (owner and group can write).

The use case for this driver is to configure the fail over behavior of the
clock hardware. That should be done by the more privileged users.

Signed-off-by: Mark Bellon <mbellon@mvista.com>
Acked-by: "Gross, Mark" <mark.gross@intel.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Mark Bellon and committed by
Linus Torvalds
31cc48bf 14a6283e

+18 -18
+18 -18
drivers/char/tlclk.c
··· 327 327 return strnlen(buf, count); 328 328 } 329 329 330 - static DEVICE_ATTR(received_ref_clk3a, S_IWUGO, NULL, 330 + static DEVICE_ATTR(received_ref_clk3a, (S_IWUSR|S_IWGRP), NULL, 331 331 store_received_ref_clk3a); 332 332 333 333 ··· 349 349 return strnlen(buf, count); 350 350 } 351 351 352 - static DEVICE_ATTR(received_ref_clk3b, S_IWUGO, NULL, 352 + static DEVICE_ATTR(received_ref_clk3b, (S_IWUSR|S_IWGRP), NULL, 353 353 store_received_ref_clk3b); 354 354 355 355 ··· 371 371 return strnlen(buf, count); 372 372 } 373 373 374 - static DEVICE_ATTR(enable_clk3b_output, S_IWUGO, NULL, 374 + static DEVICE_ATTR(enable_clk3b_output, (S_IWUSR|S_IWGRP), NULL, 375 375 store_enable_clk3b_output); 376 376 377 377 static ssize_t store_enable_clk3a_output(struct device *d, ··· 392 392 return strnlen(buf, count); 393 393 } 394 394 395 - static DEVICE_ATTR(enable_clk3a_output, S_IWUGO, NULL, 395 + static DEVICE_ATTR(enable_clk3a_output, (S_IWUSR|S_IWGRP), NULL, 396 396 store_enable_clk3a_output); 397 397 398 398 static ssize_t store_enable_clkb1_output(struct device *d, ··· 413 413 return strnlen(buf, count); 414 414 } 415 415 416 - static DEVICE_ATTR(enable_clkb1_output, S_IWUGO, NULL, 416 + static DEVICE_ATTR(enable_clkb1_output, (S_IWUSR|S_IWGRP), NULL, 417 417 store_enable_clkb1_output); 418 418 419 419 ··· 435 435 return strnlen(buf, count); 436 436 } 437 437 438 - static DEVICE_ATTR(enable_clka1_output, S_IWUGO, NULL, 438 + static DEVICE_ATTR(enable_clka1_output, (S_IWUSR|S_IWGRP), NULL, 439 439 store_enable_clka1_output); 440 440 441 441 static ssize_t store_enable_clkb0_output(struct device *d, ··· 456 456 return strnlen(buf, count); 457 457 } 458 458 459 - static DEVICE_ATTR(enable_clkb0_output, S_IWUGO, NULL, 459 + static DEVICE_ATTR(enable_clkb0_output, (S_IWUSR|S_IWGRP), NULL, 460 460 store_enable_clkb0_output); 461 461 462 462 static ssize_t store_enable_clka0_output(struct device *d, ··· 477 477 return strnlen(buf, count); 478 478 } 479 479 480 - static DEVICE_ATTR(enable_clka0_output, S_IWUGO, NULL, 480 + static DEVICE_ATTR(enable_clka0_output, (S_IWUSR|S_IWGRP), NULL, 481 481 store_enable_clka0_output); 482 482 483 483 static ssize_t store_select_amcb2_transmit_clock(struct device *d, ··· 519 519 return strnlen(buf, count); 520 520 } 521 521 522 - static DEVICE_ATTR(select_amcb2_transmit_clock, S_IWUGO, NULL, 522 + static DEVICE_ATTR(select_amcb2_transmit_clock, (S_IWUSR|S_IWGRP), NULL, 523 523 store_select_amcb2_transmit_clock); 524 524 525 525 static ssize_t store_select_amcb1_transmit_clock(struct device *d, ··· 560 560 return strnlen(buf, count); 561 561 } 562 562 563 - static DEVICE_ATTR(select_amcb1_transmit_clock, S_IWUGO, NULL, 563 + static DEVICE_ATTR(select_amcb1_transmit_clock, (S_IWUSR|S_IWGRP), NULL, 564 564 store_select_amcb1_transmit_clock); 565 565 566 566 static ssize_t store_select_redundant_clock(struct device *d, ··· 581 581 return strnlen(buf, count); 582 582 } 583 583 584 - static DEVICE_ATTR(select_redundant_clock, S_IWUGO, NULL, 584 + static DEVICE_ATTR(select_redundant_clock, (S_IWUSR|S_IWGRP), NULL, 585 585 store_select_redundant_clock); 586 586 587 587 static ssize_t store_select_ref_frequency(struct device *d, ··· 602 602 return strnlen(buf, count); 603 603 } 604 604 605 - static DEVICE_ATTR(select_ref_frequency, S_IWUGO, NULL, 605 + static DEVICE_ATTR(select_ref_frequency, (S_IWUSR|S_IWGRP), NULL, 606 606 store_select_ref_frequency); 607 607 608 608 static ssize_t store_filter_select(struct device *d, ··· 623 623 return strnlen(buf, count); 624 624 } 625 625 626 - static DEVICE_ATTR(filter_select, S_IWUGO, NULL, store_filter_select); 626 + static DEVICE_ATTR(filter_select, (S_IWUSR|S_IWGRP), NULL, store_filter_select); 627 627 628 628 static ssize_t store_hardware_switching_mode(struct device *d, 629 629 struct device_attribute *attr, const char *buf, size_t count) ··· 643 643 return strnlen(buf, count); 644 644 } 645 645 646 - static DEVICE_ATTR(hardware_switching_mode, S_IWUGO, NULL, 646 + static DEVICE_ATTR(hardware_switching_mode, (S_IWUSR|S_IWGRP), NULL, 647 647 store_hardware_switching_mode); 648 648 649 649 static ssize_t store_hardware_switching(struct device *d, ··· 664 664 return strnlen(buf, count); 665 665 } 666 666 667 - static DEVICE_ATTR(hardware_switching, S_IWUGO, NULL, 667 + static DEVICE_ATTR(hardware_switching, (S_IWUSR|S_IWGRP), NULL, 668 668 store_hardware_switching); 669 669 670 670 static ssize_t store_refalign (struct device *d, ··· 684 684 return strnlen(buf, count); 685 685 } 686 686 687 - static DEVICE_ATTR(refalign, S_IWUGO, NULL, store_refalign); 687 + static DEVICE_ATTR(refalign, (S_IWUSR|S_IWGRP), NULL, store_refalign); 688 688 689 689 static ssize_t store_mode_select (struct device *d, 690 690 struct device_attribute *attr, const char *buf, size_t count) ··· 704 704 return strnlen(buf, count); 705 705 } 706 706 707 - static DEVICE_ATTR(mode_select, S_IWUGO, NULL, store_mode_select); 707 + static DEVICE_ATTR(mode_select, (S_IWUSR|S_IWGRP), NULL, store_mode_select); 708 708 709 709 static ssize_t store_reset (struct device *d, 710 710 struct device_attribute *attr, const char *buf, size_t count) ··· 724 724 return strnlen(buf, count); 725 725 } 726 726 727 - static DEVICE_ATTR(reset, S_IWUGO, NULL, store_reset); 727 + static DEVICE_ATTR(reset, (S_IWUSR|S_IWGRP), NULL, store_reset); 728 728 729 729 static struct attribute *tlclk_sysfs_entries[] = { 730 730 &dev_attr_current_ref.attr,